Bug 1260651 part.51 Rename nsAutoLockRulesSniffing to mozilla::AutoLockRulesSniffing r=mccr8
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 24 Jun 2016 21:19:18 +0900
changeset 346484 617181bb9d3b7b3e8929cfc36ab00cb0c9a55e53
parent 346483 fb2d027f7f6c62b688ab0ce845fd6ff11b277aa7
child 346485 3863562790ed6df00144c0beb6ddaad4a63fed6f
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1260651
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1260651 part.51 Rename nsAutoLockRulesSniffing to mozilla::AutoLockRulesSniffing r=mccr8 MozReview-Commit-ID: BnZ1Y3YXfMK
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/TextEditRules.cpp
editor/libeditor/TextEditRules.h
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -256,17 +256,17 @@ HTMLEditRules::Init(nsPlaintextEditor* a
   }
 
   NS_ENSURE_STATE(node);
 
   mUtilRange = new nsRange(node);
 
   // set up mDocChangeRange to be whole doc
   // temporarily turn off rules sniffing
-  nsAutoLockRulesSniffing lockIt(static_cast<TextEditRules*>(this));
+  AutoLockRulesSniffing lockIt(this);
   if (!mDocChangeRange) {
     mDocChangeRange = new nsRange(node);
   }
 
   if (node->IsElement()) {
     ErrorResult rv;
     mDocChangeRange->SelectNode(*node, rv);
     NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
@@ -295,17 +295,17 @@ HTMLEditRules::BeforeEdit(EditAction act
 {
   if (mLockRulesSniffing) {
     return NS_OK;
   }
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
-  nsAutoLockRulesSniffing lockIt(this);
+  AutoLockRulesSniffing lockIt(this);
   mDidExplicitlySetInterline = false;
 
   if (!mActionNesting) {
     mActionNesting++;
 
     // Clear our flag about if just deleted a range
     mDidRangedDelete = false;
 
@@ -377,17 +377,17 @@ HTMLEditRules::AfterEdit(EditAction acti
 {
   if (mLockRulesSniffing) {
     return NS_OK;
   }
 
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
-  nsAutoLockRulesSniffing lockIt(this);
+  AutoLockRulesSniffing lockIt(this);
 
   MOZ_ASSERT(mActionNesting > 0);
   nsresult rv = NS_OK;
   mActionNesting--;
   if (!mActionNesting) {
     // Do all the tricky stuff
     rv = AfterEditInner(action, aDirection);
 
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -172,17 +172,17 @@ TextEditRules::DetachEditor()
 }
 
 NS_IMETHODIMP
 TextEditRules::BeforeEdit(EditAction action,
                           nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) return NS_OK;
 
-  nsAutoLockRulesSniffing lockIt(this);
+  AutoLockRulesSniffing lockIt(this);
   mDidExplicitlySetInterline = false;
   if (!mActionNesting)
   {
     // let rules remember the top level action
     mTheAction = action;
   }
   mActionNesting++;
 
@@ -198,17 +198,17 @@ TextEditRules::BeforeEdit(EditAction act
 }
 
 NS_IMETHODIMP
 TextEditRules::AfterEdit(EditAction action,
                          nsIEditor::EDirection aDirection)
 {
   if (mLockRulesSniffing) return NS_OK;
 
-  nsAutoLockRulesSniffing lockIt(this);
+  AutoLockRulesSniffing lockIt(this);
 
   NS_PRECONDITION(mActionNesting>0, "bad action nesting!");
   nsresult res = NS_OK;
   if (!--mActionNesting)
   {
     NS_ENSURE_STATE(mEditor);
     RefPtr<Selection> selection = mEditor->GetSelection();
     NS_ENSURE_STATE(selection);
--- a/editor/libeditor/TextEditRules.h
+++ b/editor/libeditor/TextEditRules.h
@@ -11,23 +11,23 @@
 #include "nsEditRules.h"
 #include "nsEditor.h"
 #include "nsIEditor.h"
 #include "nsISupportsImpl.h"
 #include "nsITimer.h"
 #include "nsString.h"
 #include "nscore.h"
 
-class nsAutoLockRulesSniffing;
 class nsIDOMElement;
 class nsIDOMNode;
 class nsPlaintextEditor;
 
 namespace mozilla {
 
+class AutoLockRulesSniffing;
 namespace dom {
 class Selection;
 } // namespace dom
 
 /**
  * Object that encapsulates HTML text-specific editing rules.
  *
  * To be a good citizen, edit rules must live by these restrictions:
@@ -245,17 +245,17 @@ protected:
   bool mDeleteBidiImmediately;
   // The top level editor action.
   EditAction mTheAction;
   nsCOMPtr<nsITimer> mTimer;
   uint32_t mLastStart;
   uint32_t mLastLength;
 
   // friends
-  friend class nsAutoLockRulesSniffing;
+  friend class AutoLockRulesSniffing;
 };
 
 class TextRulesInfo final : public nsRulesInfo
 {
 public:
   explicit TextRulesInfo(EditAction aAction)
     : nsRulesInfo(aAction)
     , inString(nullptr)
@@ -292,37 +292,44 @@ public:
 
   // kMakeBasicBlock
   const nsAString* blockType;
 
   // kInsertElement
   const nsIDOMElement* insertElement;
 };
 
-} // namespace mozilla
-
-/***************************************************************************
- * stack based helper class for StartOperation()/EndOperation() sandwich.
- * this class sets a bool letting us know to ignore any rules sniffing
+/**
+ * Stack based helper class for StartOperation()/EndOperation() sandwich.
+ * This class sets a bool letting us know to ignore any rules sniffing
  * that tries to occur reentrantly.
  */
-class nsAutoLockRulesSniffing
+class MOZ_STACK_CLASS AutoLockRulesSniffing final
 {
-  public:
+public:
+  explicit AutoLockRulesSniffing(TextEditRules* aRules)
+    : mRules(aRules)
+  {
+    if (mRules) {
+      mRules->mLockRulesSniffing = true;
+    }
+  }
 
-  explicit nsAutoLockRulesSniffing(mozilla::TextEditRules *rules) : mRules(rules)
-                 {if (mRules) mRules->mLockRulesSniffing = true;}
-  ~nsAutoLockRulesSniffing()
-                 {if (mRules) mRules->mLockRulesSniffing = false;}
+  ~AutoLockRulesSniffing()
+  {
+    if (mRules) {
+      mRules->mLockRulesSniffing = false;
+    }
+  }
 
-  protected:
-  mozilla::TextEditRules *mRules;
+protected:
+  TextEditRules* mRules;
 };
 
-
+} // namespace mozilla
 
 /***************************************************************************
  * stack based helper class for turning on/off the edit listener.
  */
 class nsAutoLockListener
 {
 public: