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 385840 e086a556ac67cf6a8a0247eaa6015654fbd03271
parent 385839 3763e662e454b8598329cefda1762cd4832bf843
child 385841 e4a115eefcb028c799f757d04d8a6b659af5f8e6
push id22587
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 06:59:31 +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);