Bug 1260651 part.6 Rename nsDOMIterator to mozilla::DOMIterator r=mccr8 draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 23 Jun 2016 17:30:39 +0900
changeset 385696 44e6ff51818b440ed26c47b8d9e04ee0fecc52a3
parent 385695 d2590baa75a45072b2cc87a4bdb4df23a041dfef
child 385697 a8981068b80d55f7fabfc13b89defbd00e909680
push id22582
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 03:13:39 +0000
reviewersmccr8
bugs1260651
milestone50.0a1
Bug 1260651 part.6 Rename nsDOMIterator to mozilla::DOMIterator r=mccr8 MozReview-Commit-ID: 6wBVUivS4xY
editor/libeditor/EditorUtils.cpp
editor/libeditor/EditorUtils.h
editor/libeditor/nsHTMLEditRules.cpp
--- a/editor/libeditor/EditorUtils.cpp
+++ b/editor/libeditor/EditorUtils.cpp
@@ -58,64 +58,63 @@ nsAutoSelectionReset::~nsAutoSelectionRe
 void
 nsAutoSelectionReset::Abort()
 {
   NS_ASSERTION(!mSel || mEd, "mEd should be non-null when mSel is");
   if (mSel)
     mEd->StopPreservingSelection();
 }
 
+namespace mozilla {
 
 /******************************************************************************
  * some helper classes for iterating the dom tree
  *****************************************************************************/
 
-nsDOMIterator::nsDOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
+DOMIterator::DOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
 {
   MOZ_GUARD_OBJECT_NOTIFIER_INIT;
   mIter = NS_NewContentIterator();
   DebugOnly<nsresult> res = mIter->Init(&aNode);
   MOZ_ASSERT(NS_SUCCEEDED(res));
 }
 
 nsresult
-nsDOMIterator::Init(nsRange& aRange)
+DOMIterator::Init(nsRange& aRange)
 {
   mIter = NS_NewContentIterator();
   return mIter->Init(&aRange);
 }
 
-nsDOMIterator::nsDOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
+DOMIterator::DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
 {
   MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 }
 
-nsDOMIterator::~nsDOMIterator()
+DOMIterator::~DOMIterator()
 {
 }
 
 void
-nsDOMIterator::AppendList(const nsBoolDomIterFunctor& functor,
-                          nsTArray<OwningNonNull<nsINode>>& arrayOfNodes) const
+DOMIterator::AppendList(const nsBoolDomIterFunctor& functor,
+                        nsTArray<OwningNonNull<nsINode>>& arrayOfNodes) const
 {
   // Iterate through dom and build list
   for (; !mIter->IsDone(); mIter->Next()) {
     nsCOMPtr<nsINode> node = mIter->GetCurrentNode();
 
     if (functor(node)) {
       arrayOfNodes.AppendElement(*node);
     }
   }
 }
 
-namespace mozilla {
-
 DOMSubtreeIterator::DOMSubtreeIterator(
                       MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
-  : nsDOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT)
+  : DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT)
 {
 }
 
 nsresult
 DOMSubtreeIterator::Init(nsRange& aRange)
 {
   mIter = NS_NewContentSubtreeIterator();
   return mIter->Init(&aRange);
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -194,36 +194,38 @@ class MOZ_RAII nsAutoUpdateViewBatch
  *****************************************************************************/
 
 class nsBoolDomIterFunctor
 {
   public:
     virtual bool operator()(nsINode* aNode) const = 0;
 };
 
-class MOZ_RAII nsDOMIterator
+namespace mozilla {
+
+class MOZ_RAII DOMIterator
 {
-  public:
-    explicit nsDOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
+public:
+  explicit DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
 
-    explicit nsDOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
-    virtual ~nsDOMIterator();
+  explicit DOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
+  virtual ~DOMIterator();
 
-    nsresult Init(nsRange& aRange);
+  nsresult Init(nsRange& aRange);
 
-    void AppendList(const nsBoolDomIterFunctor& functor,
-                    nsTArray<mozilla::OwningNonNull<nsINode>>& arrayOfNodes) const;
-  protected:
-    nsCOMPtr<nsIContentIterator> mIter;
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+  void AppendList(
+         const nsBoolDomIterFunctor& functor,
+         nsTArray<mozilla::OwningNonNull<nsINode>>& arrayOfNodes) const;
+
+protected:
+  nsCOMPtr<nsIContentIterator> mIter;
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-namespace mozilla {
-
-class MOZ_RAII DOMSubtreeIterator final : public nsDOMIterator
+class MOZ_RAII DOMSubtreeIterator final : public DOMIterator
 {
 public:
   explicit DOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
   virtual ~DOMSubtreeIterator();
 
   nsresult Init(nsRange& aRange);
 };
 
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -4685,17 +4685,17 @@ nsHTMLEditRules::WillAlign(Selection& aS
 nsresult
 nsHTMLEditRules::AlignInnerBlocks(nsINode& aNode, const nsAString* alignType)
 {
   NS_ENSURE_TRUE(alignType, NS_ERROR_NULL_POINTER);
 
   // Gather list of table cells or list items
   nsTArray<OwningNonNull<nsINode>> nodeArray;
   nsTableCellAndListItemFunctor functor;
-  nsDOMIterator iter(aNode);
+  DOMIterator iter(aNode);
   iter.AppendList(functor, nodeArray);
 
   // Now that we have the list, align their contents as requested
   for (auto& node : nodeArray) {
     nsresult res = AlignBlockContents(GetAsDOMNode(node), alignType);
     NS_ENSURE_SUCCESS(res, res);
   }
 
@@ -5950,17 +5950,17 @@ nsHTMLEditRules::BustUpInlinesAtBRs(nsIC
                                     nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   // First build up a list of all the break nodes inside the inline container.
   nsTArray<OwningNonNull<nsINode>> arrayOfBreaks;
   nsBRNodeFunctor functor;
-  nsDOMIterator iter(aNode);
+  DOMIterator iter(aNode);
   iter.AppendList(functor, arrayOfBreaks);
 
   // If there aren't any breaks, just put inNode itself in the array
   if (!arrayOfBreaks.Length()) {
     aOutArrayOfNodes.AppendElement(aNode);
     return NS_OK;
   }
 
@@ -7106,17 +7106,17 @@ nsHTMLEditRules::ClearCachedStyles()
 void
 nsHTMLEditRules::AdjustSpecialBreaks()
 {
   NS_ENSURE_TRUE(mHTMLEditor, );
 
   // Gather list of empty nodes
   nsTArray<OwningNonNull<nsINode>> nodeArray;
   nsEmptyEditableFunctor functor(mHTMLEditor);
-  nsDOMIterator iter;
+  DOMIterator iter;
   nsresult res = iter.Init(*mDocChangeRange);
   NS_ENSURE_SUCCESS(res, );
   iter.AppendList(functor, nodeArray);
 
   // Put moz-br's into these empty li's and td's
   for (auto& node : nodeArray) {
     // Need to put br at END of node.  It may have empty containers in it and
     // still pass the "IsEmptyNode" test, and we want the br's to be after