Bug 1260651 part.10 Rename nsAutoRules to mozilla::AutoRules r=mccr8 draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 23 Jun 2016 18:15:42 +0900
changeset 385842 5f24a81daad81d5e4238ef2dc9c7db1557fca656
parent 385841 e4a115eefcb028c799f757d04d8a6b659af5f8e6
child 385843 8a195c3a937e9cd83ba4a23b0aa8c3c13b57970f
push id22587
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 06:59:31 +0000
reviewersmccr8
bugs1260651
milestone50.0a1
Bug 1260651 part.10 Rename nsAutoRules to mozilla::AutoRules r=mccr8 MozReview-Commit-ID: u3MVijmoBv
editor/libeditor/EditorUtils.h
editor/libeditor/nsEditor.cpp
editor/libeditor/nsEditor.h
editor/libeditor/nsHTMLAbsPosition.cpp
editor/libeditor/nsHTMLDataTransfer.cpp
editor/libeditor/nsHTMLEditor.cpp
editor/libeditor/nsHTMLEditorStyle.cpp
editor/libeditor/nsPlaintextEditor.cpp
editor/libeditor/nsTableEditor.cpp
editor/libeditor/nsTextEditRules.cpp
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -90,51 +90,52 @@ class MOZ_RAII nsAutoSelectionReset
 
     /** destructor restores mSel to its former state */
     ~nsAutoSelectionReset();
 
     /** Abort: cancel selection saver */
     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
  */
 class MOZ_RAII AutoTransactionsConserveSelection final
 {
 public:
   explicit AutoTransactionsConserveSelection(nsEditor* aEditor
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -11,17 +11,17 @@
 #include <string.h>                     // for strcmp
 
 #include "ChangeAttributeTxn.h"         // for ChangeAttributeTxn
 #include "CreateElementTxn.h"           // for CreateElementTxn
 #include "DeleteNodeTxn.h"              // for DeleteNodeTxn
 #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
 #include "InsertTextTxn.h"              // for InsertTextTxn
 #include "JoinNodeTxn.h"                // for JoinNodeTxn
 #include "PlaceholderTxn.h"             // for PlaceholderTxn
 #include "SplitNodeTxn.h"               // for SplitNodeTxn
 #include "mozFlushType.h"               // for mozFlushType::Flush_Frames
@@ -803,17 +803,17 @@ NS_IMETHODIMP
 nsEditor::Undo(uint32_t aCount)
 {
   ForceCompositionEnd();
 
   bool hasTxnMgr, hasTransaction = false;
   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;
   }
 
   for (uint32_t i = 0; i < aCount; ++i) {
     nsresult rv = mTxnMgr->UndoTransaction();
     NS_ENSURE_SUCCESS(rv, rv);
@@ -842,17 +842,17 @@ NS_IMETHODIMP nsEditor::CanUndo(bool *aI
 
 NS_IMETHODIMP
 nsEditor::Redo(uint32_t aCount)
 {
   bool hasTxnMgr, hasTransaction = false;
   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;
   }
 
   for (uint32_t i = 0; i < aCount; ++i) {
     nsresult rv = mTxnMgr->RedoTransaction();
     NS_ENSURE_SUCCESS(rv, rv);
@@ -1341,17 +1341,17 @@ nsEditor::CreateNode(const nsAString& aT
 
 already_AddRefed<Element>
 nsEditor::CreateNode(nsIAtom* aTag,
                      nsINode* aParent,
                      int32_t aPosition)
 {
   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),
                              GetAsDOMNode(aParent), aPosition);
   }
 
   nsCOMPtr<Element> ret;
 
@@ -1382,17 +1382,17 @@ nsEditor::InsertNode(nsIDOMNode* aNode, 
   NS_ENSURE_TRUE(node && parent, NS_ERROR_NULL_POINTER);
 
   return InsertNode(*node, *parent, 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(),
                              aPosition);
   }
 
   RefPtr<InsertNodeTxn> txn = CreateTxnForInsertNode(aNode, aParent,
                                                        aPosition);
@@ -1420,18 +1420,17 @@ nsEditor::SplitNode(nsIDOMNode* aNode,
   nsCOMPtr<nsIContent> newNode = SplitNode(*node, aOffset, rv);
   *aNewLeftNode = GetAsDOMNode(newNode.forget().take());
   return rv.StealNSResult();
 }
 
 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);
   }
 
   RefPtr<SplitNodeTxn> txn = CreateTxnForSplitNode(aNode, aOffset);
   aResult = DoTransaction(txn);
 
@@ -1465,18 +1464,18 @@ nsEditor::JoinNodes(nsIDOMNode* aLeftNod
 }
 
 nsresult
 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.
   int32_t offset = parent->IndexOf(&aRightNode);
   // Find the number of children of the lefthand node
   uint32_t oldLeftNodeLen = aLeftNode.Length();
 
   for (auto& listener : mActionListeners) {
@@ -1508,17 +1507,18 @@ nsEditor::DeleteNode(nsIDOMNode* aNode)
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   NS_ENSURE_STATE(node);
   return DeleteNode(node);
 }
 
 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) {
     listener->WillDeleteNode(aNode->AsDOMNode());
   }
 
   RefPtr<DeleteNodeTxn> txn;
   nsresult res = CreateTxnForDeleteNode(aNode, getter_AddRefs(txn));
@@ -2591,17 +2591,18 @@ nsEditor::CreateTxnForInsertText(const n
 nsresult
 nsEditor::DeleteText(nsGenericDOMDataNode& aCharData, uint32_t aOffset,
                      uint32_t aLength)
 {
   RefPtr<DeleteTextTxn> txn =
     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) {
     listener->WillDeleteText(
         static_cast<nsIDOMCharacterData*>(GetAsDOMNode(&aCharData)), aOffset,
         aLength);
   }
 
@@ -3990,17 +3991,17 @@ nsEditor::DeleteSelectionImpl(EDirection
   nsresult res = CreateTxnForDeleteSelection(aAction, getter_AddRefs(txn),
                                              getter_AddRefs(deleteNode),
                                              &deleteCharOffset,
                                              &deleteCharLength);
   nsCOMPtr<nsIDOMCharacterData> deleteCharData(do_QueryInterface(deleteNode));
 
   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) {
         listener->WillDeleteSelection(selection);
       }
     } else if (deleteCharData) {
       for (auto& listener : mActionListeners) {
         listener->WillDeleteText(deleteCharData, deleteCharOffset, 1);
--- a/editor/libeditor/nsEditor.h
+++ b/editor/libeditor/nsEditor.h
@@ -49,16 +49,17 @@ class nsIPresShell;
 class nsISupports;
 class nsITransaction;
 class nsIWidget;
 class nsRange;
 class nsString;
 class nsTransactionManager;
 
 namespace mozilla {
+class AutoRules;
 class AutoTransactionsConserveSelection;
 class ErrorResult;
 class TextComposition;
 struct EditorDOMPoint;
 
 namespace dom {
 class ChangeAttributeTxn;
 class CreateElementTxn;
@@ -880,16 +881,16 @@ protected:
   bool mShouldTxnSetSelection;  // turn off for conservative selection adjustment by txns
   bool mDidPreDestroy;    // whether PreDestroy has been called
   bool mDidPostCreate;    // whether PostCreate has been called
   bool mDispatchInputEvent;
   bool mIsInEditAction;   // true while the instance is handling an edit action
   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;
 };
 
 
 #endif
--- a/editor/libeditor/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/nsHTMLAbsPosition.cpp
@@ -52,20 +52,20 @@ using namespace mozilla;
 using namespace mozilla::dom;
 
 #define  BLACK_BG_RGB_TRIGGER 0xd0
 
 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:
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsTextRulesInfo ruleInfo(aEnabled ? EditAction::setAbsolutePosition :
                                       EditAction::removeAbsolutePosition);
@@ -157,20 +157,20 @@ nsHTMLEditor::SetElementZIndex(nsIDOMEle
   mHTMLCSSUtils->SetCSSProperty(*element, *nsGkAtoms::z_index, zIndexStr);
   return NS_OK;
 }
 
 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:
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsTextRulesInfo ruleInfo(aChange < 0 ? EditAction::decreaseZIndex :
                                          EditAction::increaseZIndex);
   bool cancel, handled;
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -105,17 +105,17 @@ static nsresult FindTargetNode(nsIDOMNod
 nsresult
 nsHTMLEditor::LoadHTML(const nsAString & aInputString)
 {
   NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
 
   // 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();
   NS_ENSURE_STATE(selection);
 
   nsTextRulesInfo ruleInfo(EditAction::loadHTML);
   bool cancel, handled;
   // Protect the edit rules object from dying
@@ -206,17 +206,17 @@ nsHTMLEditor::DoInsertHTMLWithContext(co
   NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
 
   // Prevent the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   // 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();
   NS_ENSURE_STATE(selection);
 
   // create a dom document fragment that represents the structure to paste
   nsCOMPtr<nsIDOMNode> fragmentAsNode, streamStartParent, streamEndParent;
   int32_t streamStartOffset = 0, streamEndOffset = 0;
@@ -1652,17 +1652,18 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsQuota
   nsAutoString citation;
   return PasteAsCitedQuotation(citation, aSelectionType);
 }
 
 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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   // give rules a chance to handle or cancel
   nsTextRulesInfo ruleInfo(EditAction::insertElement);
   bool cancel, handled;
@@ -1844,17 +1845,18 @@ nsHTMLEditor::InsertAsPlaintextQuotation
                                          bool aAddCites,
                                          nsIDOMNode **aNodeInserted)
 {
   // get selection
   RefPtr<Selection> selection = GetSelection();
   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);
   bool cancel, handled;
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
   nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1933,17 +1935,18 @@ nsHTMLEditor::InsertAsCitedQuotation(con
     return InsertAsPlaintextQuotation(aQuotedText, true, aNodeInserted);
   }
 
   // get selection
   RefPtr<Selection> selection = GetSelection();
   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);
   bool cancel, handled;
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
   nsresult rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -1180,23 +1180,23 @@ nsHTMLEditor::CollapseSelectionToDeepest
  * This is mostly like InsertHTMLWithCharsetAndContext, but we can't use that
  * because it is selection-based and the rules code won't let us edit under the
  * <head> node
  */
 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);
 
   RefPtr<nsContentList> nodeList =
     doc->GetElementsByTagName(NS_LITERAL_STRING("head"));
   NS_ENSURE_TRUE(nodeList, NS_ERROR_NULL_POINTER);
 
@@ -1491,17 +1491,18 @@ nsHTMLEditor::InsertElementAtSelection(n
 
   nsCOMPtr<Element> element = do_QueryInterface(aElement);
   NS_ENSURE_TRUE(element, NS_ERROR_NULL_POINTER);
 
   nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);
 
   ForceCompositionEnd();
   nsAutoEditBatch beginBatching(this);
-  nsAutoRules beginRulesSniffing(this, EditAction::insertElement, nsIEditor::eNext);
+  AutoRules beginRulesSniffing(this, EditAction::insertElement,
+                               nsIEditor::eNext);
 
   RefPtr<Selection> selection = GetSelection();
   if (!selection) {
     return NS_ERROR_FAILURE;
   }
 
   // hand off to the rules system, see if it has anything to say about this
   bool cancel, handled;
@@ -1928,17 +1929,17 @@ nsHTMLEditor::MakeOrChangeList(const nsA
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsTextRulesInfo ruleInfo(EditAction::makeList);
   ruleInfo.blockType = &aListType;
   ruleInfo.entireList = entireList;
@@ -2001,17 +2002,17 @@ nsHTMLEditor::RemoveList(const nsAString
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsTextRulesInfo ruleInfo(EditAction::removeList);
   if (aListType.LowerCaseEqualsLiteral("ol"))
     ruleInfo.bOrdered = true;
@@ -2032,17 +2033,18 @@ nsHTMLEditor::MakeDefinitionItem(const n
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsTextRulesInfo ruleInfo(EditAction::makeDefListItem);
   ruleInfo.blockType = &aItemType;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
@@ -2063,17 +2065,18 @@ nsHTMLEditor::InsertBasicBlock(const nsA
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsTextRulesInfo ruleInfo(EditAction::makeBasicBlock);
   ruleInfo.blockType = &aBlockType;
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
@@ -2136,17 +2139,17 @@ nsHTMLEditor::Indent(const nsAString& aI
 
   bool cancel, handled;
   EditAction opID = EditAction::indent;
   if (aIndent.LowerCaseEqualsLiteral("outdent"))
   {
     opID = EditAction::outdent;
   }
   nsAutoEditBatch beginBatching(this);
-  nsAutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
+  AutoRules beginRulesSniffing(this, opID, nsIEditor::eNext);
 
   // pre-process
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsTextRulesInfo ruleInfo(opID);
   res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   if (cancel || (NS_FAILED(res))) return res;
@@ -2208,17 +2211,17 @@ nsHTMLEditor::Indent(const nsAString& aI
 
 NS_IMETHODIMP
 nsHTMLEditor::Align(const nsAString& aAlignType)
 {
   // Protect the edit rules object from dying
   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;
 
   // Find out if the selection is collapsed:
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsTextRulesInfo ruleInfo(EditAction::align);
@@ -4524,18 +4527,18 @@ nsHTMLEditor::SetCSSBackgroundColor(cons
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_STATE(selection);
 
   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);
 
   bool cancel, handled;
   nsTextRulesInfo ruleInfo(EditAction::setTextProperty);
   nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(res, res);
   if (!cancel && !handled) {
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -120,17 +120,18 @@ nsHTMLEditor::SetInlineProperty(nsIAtom*
   if (selection->Collapsed()) {
     // Manipulating text attributes on a collapsed selection only sets state
     // for the next text insertion
     mTypeInState->SetProp(aProperty, aAttribute, aValue);
     return NS_OK;
   }
 
   nsAutoEditBatch batchIt(this);
-  nsAutoRules beginRulesSniffing(this, EditAction::insertElement, nsIEditor::eNext);
+  AutoRules beginRulesSniffing(this, EditAction::insertElement,
+                               nsIEditor::eNext);
   nsAutoSelectionReset selectionResetter(selection, this);
   AutoTransactionsConserveSelection dontSpazMySelection(this);
 
   bool cancel, handled;
   nsTextRulesInfo ruleInfo(EditAction::setTextProperty);
   // Protect the edit rules object from dying
   nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(res, res);
@@ -1164,17 +1165,18 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePro
     val = &aValue;
   return GetInlinePropertyBase(*aProperty, att, val, aFirst, aAny, aAll, &outValue);
 }
 
 
 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);
   return ApplyDefaultProperties();
 }
 
 NS_IMETHODIMP nsHTMLEditor::RemoveInlineProperty(nsIAtom *aProperty, const nsAString &aAttribute)
 {
@@ -1205,18 +1207,18 @@ nsHTMLEditor::RemoveInlinePropertyImpl(n
       mTypeInState->ClearProp(aProperty, *aAttribute);
     } else {
       mTypeInState->ClearAllProps();
     }
     return NS_OK;
   }
 
   nsAutoEditBatch batchIt(this);
-  nsAutoRules beginRulesSniffing(this, EditAction::removeTextProperty,
-                                 nsIEditor::eNext);
+  AutoRules beginRulesSniffing(this, EditAction::removeTextProperty,
+                               nsIEditor::eNext);
   nsAutoSelectionReset selectionResetter(selection, this);
   AutoTransactionsConserveSelection dontSpazMySelection(this);
 
   bool cancel, handled;
   nsTextRulesInfo ruleInfo(EditAction::removeTextProperty);
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
   nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
@@ -1354,18 +1356,18 @@ nsHTMLEditor::RelativeFontChange(FontSiz
     // Manipulating text attributes on a collapsed selection only sets state
     // for the next text insertion
     mTypeInState->SetProp(&atom, EmptyString(), EmptyString());
     return NS_OK;
   }
 
   // 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);
 
   // Loop through the ranges in the selection
   uint32_t rangeCount = selection->RangeCount();
   for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
     RefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
 
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsPlaintextEditor.h"
 
-#include "EditorUtils.h"  // nsAutoEditBatch, nsAutoRules
+#include "EditorUtils.h"  // nsAutoEditBatch, AutoRules
 #include "gfxFontUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/TextComposition.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
@@ -535,17 +535,17 @@ NS_IMETHODIMP nsPlaintextEditor::CreateB
 
 nsresult
 nsPlaintextEditor::InsertBR(nsCOMPtr<nsIDOMNode>* outBRNode)
 {
   NS_ENSURE_TRUE(outBRNode, NS_ERROR_NULL_POINTER);
   *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);
 
   nsresult res;
   if (!selection->Collapsed()) {
     res = DeleteSelection(nsIEditor::eNone, nsIEditor::eStrip);
     NS_ENSURE_SUCCESS(res, res);
@@ -655,17 +655,17 @@ nsPlaintextEditor::DeleteSelection(EDire
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   nsresult result;
 
   // 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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   // If there is an existing selection when an extended delete is requested,
   //  platforms that use "caret-style" caret positioning collapse the
   //  selection to the  start and then create a new selection.
@@ -712,17 +712,17 @@ NS_IMETHODIMP nsPlaintextEditor::InsertT
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   EditAction opID = EditAction::insertText;
   if (ShouldHandleIMEComposition()) {
     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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   nsAutoString resultString;
   // XXX can we trust instring to outlive ruleInfo,
   // XXX and ruleInfo not to refer to instring in its dtor?
   //nsAutoString instring(aStringToInsert);
@@ -749,17 +749,17 @@ NS_IMETHODIMP nsPlaintextEditor::InsertT
 NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak()
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
 
   // Protect the edit rules object from dying
   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();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   nsTextRulesInfo ruleInfo(EditAction::insertBreak);
   ruleInfo.maxLength = mMaxTextLength;
   bool cancel, handled;
@@ -1095,17 +1095,17 @@ nsPlaintextEditor::Undo(uint32_t aCount)
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   AutoUpdateViewBatch beginViewBatching(this);
 
   ForceCompositionEnd();
 
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
 
-  nsAutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
+  AutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
 
   nsTextRulesInfo ruleInfo(EditAction::undo);
   RefPtr<Selection> selection = GetSelection();
   bool cancel, handled;
   nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
 
   if (!cancel && NS_SUCCEEDED(result))
   {
@@ -1124,17 +1124,17 @@ nsPlaintextEditor::Redo(uint32_t aCount)
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
   AutoUpdateViewBatch beginViewBatching(this);
 
   ForceCompositionEnd();
 
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
 
-  nsAutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
+  AutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
 
   nsTextRulesInfo ruleInfo(EditAction::redo);
   RefPtr<Selection> selection = GetSelection();
   bool cancel, handled;
   nsresult result = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
 
   if (!cancel && NS_SUCCEEDED(result))
   {
@@ -1422,17 +1422,17 @@ nsPlaintextEditor::InsertAsQuotation(con
   if (!aQuotedText.IsEmpty() && (aQuotedText.Last() != char16_t('\n')))
     quotedStuff.Append(char16_t('\n'));
 
   // get selection
   RefPtr<Selection> selection = GetSelection();
   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);
   bool cancel, handled;
   rv = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cancel) return NS_OK; // rules canceled the operation
   if (!handled)
--- a/editor/libeditor/nsTableEditor.cpp
+++ b/editor/libeditor/nsTableEditor.cpp
@@ -395,17 +395,17 @@ nsHTMLEditor::InsertTableColumn(int32_t 
                       &curStartRowIndex, &curStartColIndex,
                       &rowSpan, &colSpan,
                       &actualRowSpan, &actualColSpan, &isSelected);
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(curCell, NS_ERROR_FAILURE);
 
   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)
   {
     startColIndex += actualColSpan;
     //Detect when user is adding after a COLSPAN=0 case
     // Assume they want to stop the "0" behavior and
     // really add a new column. Thus we set the
@@ -527,17 +527,17 @@ nsHTMLEditor::InsertTableRow(int32_t aNu
   NS_ENSURE_TRUE(curCell, NS_ERROR_FAILURE);
 
   int32_t rowCount, colCount;
   res = GetTableSize(table, &rowCount, &colCount);
   NS_ENSURE_SUCCESS(res, res);
 
   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)
   {
     // Use row after current cell
     startRowIndex += actualRowSpan;
 
     //Detect when user is adding after a ROWSPAN=0 case
     // Assume they want to stop the "0" behavior and
@@ -728,17 +728,17 @@ nsHTMLEditor::DeleteTableCell(int32_t aN
                          &startRowIndex, &startColIndex);
 
   NS_ENSURE_SUCCESS(res, res);
   // Don't fail if we didn't find a table or cell
   NS_ENSURE_TRUE(table && cell, NS_EDITOR_ELEMENT_NOT_FOUND);
 
   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;
   res = GetFirstSelectedCell(getter_AddRefs(range), getter_AddRefs(firstCell));
   NS_ENSURE_SUCCESS(res, res);
 
   int32_t rangeCount;
   res = selection->GetRangeCount(&rangeCount);
@@ -921,17 +921,17 @@ nsHTMLEditor::DeleteTableCellContents()
                        &startRowIndex, &startColIndex);
   NS_ENSURE_SUCCESS(res, res);
   // Don't fail if no cell found
   NS_ENSURE_TRUE(cell, NS_EDITOR_ELEMENT_NOT_FOUND);
 
 
   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);
 
 
   nsCOMPtr<nsIDOMElement> firstCell;
   nsCOMPtr<nsIDOMRange> range;
   res = GetFirstSelectedCell(getter_AddRefs(range), getter_AddRefs(firstCell));
   NS_ENSURE_SUCCESS(res, res);
@@ -962,17 +962,17 @@ nsHTMLEditor::DeleteTableCellContents()
 }
 
 NS_IMETHODIMP
 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;
   aCell->HasChildNodes(&hasChild);
 
   while (hasChild)
   {
     aCell->GetLastChild(getter_AddRefs(child));
@@ -1006,17 +1006,17 @@ nsHTMLEditor::DeleteTableColumn(int32_t 
   if(startColIndex == 0 && aNumber >= colCount)
     return DeleteTable2(table, selection);
 
   // Check for counts too high
   aNumber = std::min(aNumber,(colCount-startColIndex));
 
   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;
   nsCOMPtr<nsIDOMRange> range;
   res = GetFirstSelectedCell(getter_AddRefs(range), getter_AddRefs(firstCell));
   NS_ENSURE_SUCCESS(res, res);
 
   int32_t rangeCount;
@@ -1180,17 +1180,17 @@ nsHTMLEditor::DeleteTableRow(int32_t aNu
   NS_ENSURE_SUCCESS(res, res);
 
   // Shortcut the case of deleting all rows in table
   if(startRowIndex == 0 && aNumber >= rowCount)
     return DeleteTable2(table, selection);
 
   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;
   res = GetFirstSelectedCell(getter_AddRefs(range), getter_AddRefs(firstCell));
   NS_ENSURE_SUCCESS(res, res);
 
   int32_t rangeCount;
   res = selection->GetRangeCount(&rangeCount);
@@ -1267,17 +1267,17 @@ nsHTMLEditor::DeleteRow(nsIDOMElement *a
   nsCOMPtr<nsIDOMElement> cell;
   nsCOMPtr<nsIDOMElement> cellInDeleteRow;
   int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
   bool    isSelected;
   int32_t colIndex = 0;
   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
   nsTArray<nsCOMPtr<nsIDOMElement> > spanCellList;
   nsTArray<int32_t> newSpanList;
 
   int32_t rowCount, colCount;
   res = GetTableSize(aTable, &rowCount, &colCount);
@@ -1696,17 +1696,17 @@ nsHTMLEditor::SplitTableCell()
   NS_ENSURE_SUCCESS(res, res);
 
   // Must have some span to split
   if (actualRowSpan <= 1 && actualColSpan <= 1)
     return NS_OK;
 
   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);
   //...so suppress Rules System selection munging
   AutoTransactionsConserveSelection dontChangeSelection(this);
 
   nsCOMPtr<nsIDOMElement> newCell;
   int32_t rowIndex = startRowIndex;
@@ -1915,17 +1915,17 @@ nsHTMLEditor::SplitCellIntoRows(nsIDOMEl
 NS_IMETHODIMP
 nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell)
 {
   nsCOMPtr<Element> sourceCell = do_QueryInterface(aSourceCell);
   NS_ENSURE_TRUE(sourceCell, NS_ERROR_NULL_POINTER);
 
   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
   //  when replacing nodes
   RefPtr<Selection> selection = GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
   nsAutoSelectionReset selectionResetter(selection, this);
 
@@ -2171,17 +2171,18 @@ nsHTMLEditor::JoinTableCells(bool aMerge
             NS_ENSURE_SUCCESS(res, res);
           }
         }
       }
     }
 
     // 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++)
     {
       nsIDOMElement *elementPtr = deleteList[i];
       if (elementPtr)
       {
         nsCOMPtr<nsIDOMNode> node = do_QueryInterface(elementPtr);
         res = DeleteNode(node);
@@ -2294,17 +2295,17 @@ nsHTMLEditor::MergeCells(nsCOMPtr<nsIDOM
                          nsCOMPtr<nsIDOMElement> aCellToMerge,
                          bool aDeleteCellToMerge)
 {
   nsCOMPtr<dom::Element> targetCell = do_QueryInterface(aTargetCell);
   nsCOMPtr<dom::Element> cellToMerge = do_QueryInterface(aCellToMerge);
   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)) {
     // Get index of last child in target cell
     // If we fail or don't have children,
     //  we insert at index 0
     int32_t insertIndex = 0;
 
@@ -2472,17 +2473,17 @@ nsHTMLEditor::NormalizeTable(nsIDOMEleme
   res = GetTableSize(table, &rowCount, &colCount);
   NS_ENSURE_SUCCESS(res, res);
 
   // Save current selection
   nsAutoSelectionReset selectionResetter(selection, this);
 
   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;
   bool    isSelected;
 
   // Scan all cells in each row to detect bad rowspan values
   for(rowIndex = 0; rowIndex < rowCount; rowIndex++)
   {
--- a/editor/libeditor/nsTextEditRules.cpp
+++ b/editor/libeditor/nsTextEditRules.cpp
@@ -1166,17 +1166,17 @@ nsTextEditRules::CreateBogusNodeIfNeeded
   NS_ENSURE_TRUE(mEditor, NS_ERROR_NULL_POINTER);
 
   if (mBogusNode) {
     // Let's not create more than one, ok?
     return NS_OK;
   }
 
   // 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) {
     // We don't even have a body yet, don't insert any bogus nodes at
     // this point.
     return NS_OK;
   }