Bug 1260651 part.8 Rename nsAutoUpdateViewBatch to mozilla::AutoUpdateViewBatch r=mccr8 draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 07 Jul 2016 13:09:51 +0900
changeset 385698 146923a0c7f8ef1ccd32727c924963d83066efc2
parent 385697 a8981068b80d55f7fabfc13b89defbd00e909680
child 385699 c22e30bde5775b89b671d2cfc0ea7174bdfd911d
push id22582
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 03:13:39 +0000
reviewersmccr8
bugs1260651
milestone50.0a1
Bug 1260651 part.8 Rename nsAutoUpdateViewBatch to mozilla::AutoUpdateViewBatch r=mccr8 MozReview-Commit-ID: GsisMrwLlET
editor/libeditor/EditorUtils.h
editor/libeditor/nsEditor.cpp
editor/libeditor/nsPlaintextEditor.cpp
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -157,49 +157,52 @@ class MOZ_RAII nsAutoTxnsConserveSelecti
   }
 
   protected:
   nsEditor *mEd;
   bool mOldState;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
+namespace mozilla {
+
 /***************************************************************************
  * stack based helper class for batching reflow and paint requests.
  */
-class MOZ_RAII nsAutoUpdateViewBatch
+class MOZ_RAII AutoUpdateViewBatch final
 {
-  public:
-
-  explicit nsAutoUpdateViewBatch(nsEditor *ed MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : mEd(ed)
+public:
+  explicit AutoUpdateViewBatch(nsEditor* aEditor
+                               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    : mEditor(aEditor)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    NS_ASSERTION(mEd, "null mEd pointer!");
+    NS_ASSERTION(mEditor, "null mEditor pointer!");
 
-    if (mEd)
-      mEd->BeginUpdateViewBatch();
+    if (mEditor) {
+      mEditor->BeginUpdateViewBatch();
+    }
   }
 
-  ~nsAutoUpdateViewBatch()
+  ~AutoUpdateViewBatch()
   {
-    if (mEd)
-      mEd->EndUpdateViewBatch();
+    if (mEditor) {
+      mEditor->EndUpdateViewBatch();
+    }
   }
 
-  protected:
-  nsEditor *mEd;
+protected:
+  nsEditor* mEditor;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /******************************************************************************
  * some helper classes for iterating the dom tree
  *****************************************************************************/
 
-namespace mozilla {
-
 class BoolDomIterFunctor
 {
 public:
   virtual bool operator()(nsINode* aNode) const = 0;
 };
 
 class MOZ_RAII DOMIterator
 {
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -707,17 +707,17 @@ nsEditor::DoTransaction(nsITransaction* 
     // XXX: these selection batch calls no-ops.
     // XXX:
     // XXX: I suspect that this was placed here to avoid multiple
     // XXX: selection changed notifications from happening until after
     // XXX: the transaction was done. I suppose that can still happen
     // XXX: if an embedding application called DoTransaction() directly
     // XXX: to pump its own transactions through the system, but in that
     // XXX: case, wouldn't we want to use Begin/EndUpdateViewBatch() or
-    // XXX: its auto equivalent nsAutoUpdateViewBatch to ensure that
+    // XXX: its auto equivalent AutoUpdateViewBatch to ensure that
     // XXX: selection listeners have access to accurate frame data?
     // XXX:
     // XXX: Note that if we did add Begin/EndUpdateViewBatch() calls
     // XXX: we will need to make sure that they are disabled during
     // XXX: the init of the editor for text widgets to avoid layout
     // XXX: re-entry during initial reflow. - kin
 
     // get the selection and start a batch change
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -1089,17 +1089,17 @@ nsPlaintextEditor::SetNewlineHandling(in
 }
 
 NS_IMETHODIMP
 nsPlaintextEditor::Undo(uint32_t aCount)
 {
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
-  nsAutoUpdateViewBatch beginViewBatching(this);
+  AutoUpdateViewBatch beginViewBatching(this);
 
   ForceCompositionEnd();
 
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
 
   nsAutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone);
 
   nsTextRulesInfo ruleInfo(EditAction::undo);
@@ -1118,17 +1118,17 @@ nsPlaintextEditor::Undo(uint32_t aCount)
 }
 
 NS_IMETHODIMP
 nsPlaintextEditor::Redo(uint32_t aCount)
 {
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
-  nsAutoUpdateViewBatch beginViewBatching(this);
+  AutoUpdateViewBatch beginViewBatching(this);
 
   ForceCompositionEnd();
 
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
 
   nsAutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone);
 
   nsTextRulesInfo ruleInfo(EditAction::redo);