mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1260651 part.10 Rename nsAutoRules to mozilla::AutoRules r=mccr8
MozReview-Commit-ID: u3MVijmoBv
This commit is contained in:
parent
6e4532ff79
commit
04f769e958
@ -95,41 +95,42 @@ class MOZ_RAII nsAutoSelectionReset
|
||||
void Abort();
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/***************************************************************************
|
||||
* stack based helper class for StartOperation()/EndOperation() sandwich
|
||||
*/
|
||||
class MOZ_RAII nsAutoRules
|
||||
class MOZ_RAII AutoRules final
|
||||
{
|
||||
public:
|
||||
|
||||
nsAutoRules(nsEditor *ed, EditAction action,
|
||||
nsIEditor::EDirection aDirection
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: mEd(ed), mDoNothing(false)
|
||||
public:
|
||||
AutoRules(nsEditor* aEditor, EditAction aAction,
|
||||
nsIEditor::EDirection aDirection
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: mEditor(aEditor)
|
||||
, mDoNothing(false)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
if (mEd && !mEd->mAction) // mAction will already be set if this is nested call
|
||||
{
|
||||
mEd->StartOperation(action, aDirection);
|
||||
}
|
||||
else mDoNothing = true; // nested calls will end up here
|
||||
}
|
||||
~nsAutoRules()
|
||||
{
|
||||
if (mEd && !mDoNothing)
|
||||
{
|
||||
mEd->EndOperation();
|
||||
// mAction will already be set if this is nested call
|
||||
if (mEditor && !mEditor->mAction) {
|
||||
mEditor->StartOperation(aAction, aDirection);
|
||||
} else {
|
||||
mDoNothing = true; // nested calls will end up here
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
nsEditor *mEd;
|
||||
~AutoRules()
|
||||
{
|
||||
if (mEditor && !mDoNothing) {
|
||||
mEditor->EndOperation();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
nsEditor* mEditor;
|
||||
bool mDoNothing;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/***************************************************************************
|
||||
* stack based helper class for turning off active selection adjustment
|
||||
* by low level transactions
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "DeleteRangeTxn.h" // for DeleteRangeTxn
|
||||
#include "DeleteTextTxn.h" // for DeleteTextTxn
|
||||
#include "EditAggregateTxn.h" // for EditAggregateTxn
|
||||
#include "EditorUtils.h" // for nsAutoRules, etc
|
||||
#include "EditorUtils.h" // for AutoRules, etc
|
||||
#include "EditTxn.h" // for EditTxn
|
||||
#include "IMETextTxn.h" // for IMETextTxn
|
||||
#include "InsertNodeTxn.h" // for InsertNodeTxn
|
||||
@ -808,7 +808,7 @@ nsEditor::Undo(uint32_t aCount)
|
||||
CanUndo(&hasTxnMgr, &hasTransaction);
|
||||
NS_ENSURE_TRUE(hasTransaction, NS_OK);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
|
||||
AutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
|
||||
|
||||
if (!mTxnMgr) {
|
||||
return NS_OK;
|
||||
@ -847,7 +847,7 @@ nsEditor::Redo(uint32_t aCount)
|
||||
CanRedo(&hasTxnMgr, &hasTransaction);
|
||||
NS_ENSURE_TRUE(hasTransaction, NS_OK);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
|
||||
AutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
|
||||
|
||||
if (!mTxnMgr) {
|
||||
return NS_OK;
|
||||
@ -1346,7 +1346,7 @@ nsEditor::CreateNode(nsIAtom* aTag,
|
||||
{
|
||||
MOZ_ASSERT(aTag && aParent);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::createNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::createNode, nsIEditor::eNext);
|
||||
|
||||
for (auto& listener : mActionListeners) {
|
||||
listener->WillCreateNode(nsDependentAtomString(aTag),
|
||||
@ -1387,7 +1387,7 @@ nsEditor::InsertNode(nsIDOMNode* aNode, nsIDOMNode* aParent, int32_t aPosition)
|
||||
nsresult
|
||||
nsEditor::InsertNode(nsIContent& aNode, nsINode& aParent, int32_t aPosition)
|
||||
{
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
for (auto& listener : mActionListeners) {
|
||||
listener->WillInsertNode(aNode.AsDOMNode(), aParent.AsDOMNode(),
|
||||
@ -1425,8 +1425,7 @@ nsEditor::SplitNode(nsIDOMNode* aNode,
|
||||
nsIContent*
|
||||
nsEditor::SplitNode(nsIContent& aNode, int32_t aOffset, ErrorResult& aResult)
|
||||
{
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::splitNode,
|
||||
nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::splitNode, nsIEditor::eNext);
|
||||
|
||||
for (auto& listener : mActionListeners) {
|
||||
listener->WillSplitNode(aNode.AsDOMNode(), aOffset);
|
||||
@ -1470,8 +1469,8 @@ nsEditor::JoinNodes(nsINode& aLeftNode, nsINode& aRightNode)
|
||||
nsCOMPtr<nsINode> parent = aLeftNode.GetParentNode();
|
||||
MOZ_ASSERT(parent);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::joinNode,
|
||||
nsIEditor::ePrevious);
|
||||
AutoRules beginRulesSniffing(this, EditAction::joinNode,
|
||||
nsIEditor::ePrevious);
|
||||
|
||||
// Remember some values; later used for saved selection updating.
|
||||
// Find the offset between the nodes to be joined.
|
||||
@ -1513,7 +1512,8 @@ nsEditor::DeleteNode(nsIDOMNode* aNode)
|
||||
nsresult
|
||||
nsEditor::DeleteNode(nsINode* aNode)
|
||||
{
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::createNode, nsIEditor::ePrevious);
|
||||
AutoRules beginRulesSniffing(this, EditAction::createNode,
|
||||
nsIEditor::ePrevious);
|
||||
|
||||
// save node location for selection updating code.
|
||||
for (auto& listener : mActionListeners) {
|
||||
@ -2596,7 +2596,8 @@ nsEditor::DeleteText(nsGenericDOMDataNode& aCharData, uint32_t aOffset,
|
||||
CreateTxnForDeleteText(aCharData, aOffset, aLength);
|
||||
NS_ENSURE_STATE(txn);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteText, nsIEditor::ePrevious);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteText,
|
||||
nsIEditor::ePrevious);
|
||||
|
||||
// Let listeners know what's up
|
||||
for (auto& listener : mActionListeners) {
|
||||
@ -3995,7 +3996,7 @@ nsEditor::DeleteSelectionImpl(EDirection aAction,
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
|
||||
// Notify nsIEditActionListener::WillDelete[Selection|Text|Node]
|
||||
if (!deleteNode) {
|
||||
for (auto& listener : mActionListeners) {
|
||||
|
@ -54,6 +54,7 @@ class nsString;
|
||||
class nsTransactionManager;
|
||||
|
||||
namespace mozilla {
|
||||
class AutoRules;
|
||||
class AutoTransactionsConserveSelection;
|
||||
class ErrorResult;
|
||||
class TextComposition;
|
||||
@ -885,9 +886,9 @@ protected:
|
||||
bool mHidingCaret; // whether caret is hidden forcibly.
|
||||
|
||||
friend bool NSCanUnload(nsISupports* serviceMgr);
|
||||
friend class mozilla::AutoRules;
|
||||
friend class mozilla::AutoTransactionsConserveSelection;
|
||||
friend class nsAutoSelectionReset;
|
||||
friend class nsAutoRules;
|
||||
friend class nsRangeUpdater;
|
||||
};
|
||||
|
||||
|
@ -57,10 +57,10 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this,
|
||||
aEnabled ? EditAction::setAbsolutePosition :
|
||||
EditAction::removeAbsolutePosition,
|
||||
nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this,
|
||||
aEnabled ? EditAction::setAbsolutePosition :
|
||||
EditAction::removeAbsolutePosition,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// the line below does not match the code; should it be removed?
|
||||
// Find out if the selection is collapsed:
|
||||
@ -162,10 +162,10 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this,
|
||||
(aChange < 0) ? EditAction::decreaseZIndex :
|
||||
EditAction::increaseZIndex,
|
||||
nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this,
|
||||
(aChange < 0) ? EditAction::decreaseZIndex :
|
||||
EditAction::increaseZIndex,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// brade: can we get rid of this comment?
|
||||
// Find out if the selection is collapsed:
|
||||
|
@ -110,7 +110,7 @@ nsHTMLEditor::LoadHTML(const nsAString & aInputString)
|
||||
// force IME commit; set up rules sniffing and batching
|
||||
ForceCompositionEnd();
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::loadHTML, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::loadHTML, nsIEditor::eNext);
|
||||
|
||||
// Get selection
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -211,7 +211,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
||||
// force IME commit; set up rules sniffing and batching
|
||||
ForceCompositionEnd();
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::htmlPaste, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::htmlPaste, nsIEditor::eNext);
|
||||
|
||||
// Get selection
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -1657,7 +1657,8 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAString & aCitation,
|
||||
int32_t aSelectionType)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertQuotation, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertQuotation,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// get selection
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -1849,7 +1850,8 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertQuotation, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertQuotation,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// give rules a chance to handle or cancel
|
||||
nsTextRulesInfo ruleInfo(EditAction::insertElement);
|
||||
@ -1938,7 +1940,8 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText,
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertQuotation, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertQuotation,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// give rules a chance to handle or cancel
|
||||
nsTextRulesInfo ruleInfo(EditAction::insertElement);
|
||||
|
@ -1185,13 +1185,13 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsAString& aSourceToInsert)
|
||||
{
|
||||
// don't do any post processing, rules get confused
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::ignore, nsIEditor::eNone);
|
||||
AutoRules beginRulesSniffing(this, EditAction::ignore, nsIEditor::eNone);
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
ForceCompositionEnd();
|
||||
|
||||
// Do not use nsAutoRules -- rules code won't let us insert in <head>. Use
|
||||
// Do not use AutoRules -- rules code won't let us insert in <head>. Use
|
||||
// the head node as a parent and delete/insert directly.
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocWeak);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
|
||||
@ -1496,7 +1496,8 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSele
|
||||
|
||||
ForceCompositionEnd();
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertElement, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertElement,
|
||||
nsIEditor::eNext);
|
||||
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
if (!selection) {
|
||||
@ -1933,7 +1934,7 @@ nsHTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList, cons
|
||||
bool cancel, handled;
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::makeList, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::makeList, nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -2006,7 +2007,7 @@ nsHTMLEditor::RemoveList(const nsAString& aListType)
|
||||
bool cancel, handled;
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::removeList, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::removeList, nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -2037,7 +2038,8 @@ nsHTMLEditor::MakeDefinitionItem(const nsAString& aItemType)
|
||||
bool cancel, handled;
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::makeDefListItem, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::makeDefListItem,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -2068,7 +2070,8 @@ nsHTMLEditor::InsertBasicBlock(const nsAString& aBlockType)
|
||||
bool cancel, handled;
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::makeBasicBlock, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::makeBasicBlock,
|
||||
nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -2141,7 +2144,7 @@ nsHTMLEditor::Indent(const nsAString& aIndent)
|
||||
opID = EditAction::outdent;
|
||||
}
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -2213,7 +2216,7 @@ nsHTMLEditor::Align(const nsAString& aAlignType)
|
||||
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::align, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::align, nsIEditor::eNext);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
bool cancel, handled;
|
||||
@ -4529,8 +4532,8 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor)
|
||||
bool isCollapsed = selection->Collapsed();
|
||||
|
||||
nsAutoEditBatch batchIt(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertElement,
|
||||
nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertElement,
|
||||
nsIEditor::eNext);
|
||||
nsAutoSelectionReset selectionResetter(selection, this);
|
||||
AutoTransactionsConserveSelection dontSpazMySelection(this);
|
||||
|
||||
|
@ -125,7 +125,8 @@ nsHTMLEditor::SetInlineProperty(nsIAtom* aProperty,
|
||||
}
|
||||
|
||||
nsAutoEditBatch batchIt(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertElement, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertElement,
|
||||
nsIEditor::eNext);
|
||||
nsAutoSelectionReset selectionResetter(selection, this);
|
||||
AutoTransactionsConserveSelection dontSpazMySelection(this);
|
||||
|
||||
@ -1169,7 +1170,8 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveAllInlineProperties()
|
||||
{
|
||||
nsAutoEditBatch batchIt(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::resetTextProperties, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::resetTextProperties,
|
||||
nsIEditor::eNext);
|
||||
|
||||
nsresult res = RemoveInlinePropertyImpl(nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
@ -1210,8 +1212,8 @@ nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom* aProperty,
|
||||
}
|
||||
|
||||
nsAutoEditBatch batchIt(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::removeTextProperty,
|
||||
nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::removeTextProperty,
|
||||
nsIEditor::eNext);
|
||||
nsAutoSelectionReset selectionResetter(selection, this);
|
||||
AutoTransactionsConserveSelection dontSpazMySelection(this);
|
||||
|
||||
@ -1359,8 +1361,8 @@ nsHTMLEditor::RelativeFontChange(FontSize aDir)
|
||||
|
||||
// Wrap with txn batching, rules sniffing, and selection preservation code
|
||||
nsAutoEditBatch batchIt(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::setTextProperty,
|
||||
nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::setTextProperty,
|
||||
nsIEditor::eNext);
|
||||
nsAutoSelectionReset selectionResetter(selection, this);
|
||||
AutoTransactionsConserveSelection dontSpazMySelection(this);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "nsPlaintextEditor.h"
|
||||
|
||||
#include "EditorUtils.h" // nsAutoEditBatch, nsAutoRules
|
||||
#include "EditorUtils.h" // nsAutoEditBatch, AutoRules
|
||||
#include "gfxFontUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -540,7 +540,7 @@ nsPlaintextEditor::InsertBR(nsCOMPtr<nsIDOMNode>* outBRNode)
|
||||
*outBRNode = nullptr;
|
||||
|
||||
// calling it text insertion to trigger moz br treatment by rules
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertText, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertText, nsIEditor::eNext);
|
||||
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_STATE(selection);
|
||||
@ -660,7 +660,7 @@ nsPlaintextEditor::DeleteSelection(EDirection aAction,
|
||||
|
||||
// delete placeholder txns merge.
|
||||
nsAutoPlaceHolderBatch batch(this, nsGkAtoms::DeleteTxnName);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteSelection, aAction);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -717,7 +717,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertText(const nsAString &aStringToInsert)
|
||||
opID = EditAction::insertIMEText;
|
||||
}
|
||||
nsAutoPlaceHolderBatch batch(this, nullptr);
|
||||
nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -754,7 +754,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak()
|
||||
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertBreak, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertBreak, nsIEditor::eNext);
|
||||
|
||||
// pre-process
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -1100,7 +1100,7 @@ nsPlaintextEditor::Undo(uint32_t aCount)
|
||||
|
||||
NotifyEditorObservers(eNotifyEditorObserversOfBefore);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
|
||||
AutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
|
||||
|
||||
nsTextRulesInfo ruleInfo(EditAction::undo);
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -1129,7 +1129,7 @@ nsPlaintextEditor::Redo(uint32_t aCount)
|
||||
|
||||
NotifyEditorObservers(eNotifyEditorObserversOfBefore);
|
||||
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
|
||||
AutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
|
||||
|
||||
nsTextRulesInfo ruleInfo(EditAction::redo);
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
@ -1427,7 +1427,7 @@ nsPlaintextEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertText, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertText, nsIEditor::eNext);
|
||||
|
||||
// give rules a chance to handle or cancel
|
||||
nsTextRulesInfo ruleInfo(EditAction::insertElement);
|
||||
|
@ -400,7 +400,7 @@ nsHTMLEditor::InsertTableColumn(int32_t aNumber, bool aAfter)
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent auto insertion of BR in new cell until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
// Use column after current cell if requested
|
||||
if (aAfter)
|
||||
@ -532,7 +532,7 @@ nsHTMLEditor::InsertTableRow(int32_t aNumber, bool aAfter)
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent auto insertion of BR in new cell until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
if (aAfter)
|
||||
{
|
||||
@ -733,7 +733,7 @@ nsHTMLEditor::DeleteTableCell(int32_t aNumber)
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> firstCell;
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
@ -926,7 +926,7 @@ nsHTMLEditor::DeleteTableCellContents()
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
//Don't let Rules System change the selection
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
@ -967,7 +967,7 @@ nsHTMLEditor::DeleteCellContents(nsIDOMElement *aCell)
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
bool hasChild;
|
||||
@ -1011,7 +1011,7 @@ nsHTMLEditor::DeleteTableColumn(int32_t aNumber)
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
|
||||
// Test if deletion is controlled by selected cells
|
||||
nsCOMPtr<nsIDOMElement> firstCell;
|
||||
@ -1185,7 +1185,7 @@ nsHTMLEditor::DeleteTableRow(int32_t aNumber)
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> firstCell;
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
@ -1272,7 +1272,7 @@ nsHTMLEditor::DeleteRow(nsIDOMElement *aTable, int32_t aRowIndex)
|
||||
nsresult res = NS_OK;
|
||||
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
|
||||
// The list of cells we will change rowspan in
|
||||
// and the new rowspan values for each
|
||||
@ -1701,7 +1701,7 @@ nsHTMLEditor::SplitTableCell()
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent auto insertion of BR in new cell until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
// We reset selection
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
|
||||
@ -1920,7 +1920,7 @@ nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElemen
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent auto insertion of BR in new cell created by ReplaceContainer
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
// Save current selection to restore when done
|
||||
// This is needed so ReplaceContainer can monitor selection
|
||||
@ -2176,7 +2176,8 @@ nsHTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
|
||||
// All cell contents are merged. Delete the empty cells we accumulated
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode,
|
||||
nsIEditor::eNext);
|
||||
|
||||
for (uint32_t i = 0, n = deleteList.Length(); i < n; i++)
|
||||
{
|
||||
@ -2299,7 +2300,7 @@ nsHTMLEditor::MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell,
|
||||
NS_ENSURE_TRUE(targetCell && cellToMerge, NS_ERROR_NULL_POINTER);
|
||||
|
||||
// Prevent rules testing until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
|
||||
|
||||
// Don't need to merge if cell is empty
|
||||
if (!IsEmptyCell(cellToMerge)) {
|
||||
@ -2477,7 +2478,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
// Prevent auto insertion of BR in new cell until we're done
|
||||
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
|
@ -1171,7 +1171,7 @@ nsTextEditRules::CreateBogusNodeIfNeeded(Selection* aSelection)
|
||||
}
|
||||
|
||||
// tell rules system to not do any post-processing
|
||||
nsAutoRules beginRulesSniffing(mEditor, EditAction::ignore, nsIEditor::eNone);
|
||||
AutoRules beginRulesSniffing(mEditor, EditAction::ignore, nsIEditor::eNone);
|
||||
|
||||
nsCOMPtr<dom::Element> body = mEditor->GetRoot();
|
||||
if (!body) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user