Bug 1260651 part.5 Rename nsDOMSubtreeIterator to mozilla::DOMSubtreeIterator r=mccr8 draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 23 Jun 2016 17:25:03 +0900
changeset 385695 d2590baa75a45072b2cc87a4bdb4df23a041dfef
parent 385694 4d862f60e594ffcd67d76b7562a8b917895b4fdb
child 385696 44e6ff51818b440ed26c47b8d9e04ee0fecc52a3
push id22582
push usermasayuki@d-toybox.com
push dateSat, 09 Jul 2016 03:13:39 +0000
reviewersmccr8
bugs1260651
milestone50.0a1
Bug 1260651 part.5 Rename nsDOMSubtreeIterator to mozilla::DOMSubtreeIterator r=mccr8 MozReview-Commit-ID: EGb5Lx4teaS
editor/libeditor/EditorUtils.cpp
editor/libeditor/EditorUtils.h
editor/libeditor/nsHTMLDataTransfer.cpp
editor/libeditor/nsHTMLEditRules.cpp
--- a/editor/libeditor/EditorUtils.cpp
+++ b/editor/libeditor/EditorUtils.cpp
@@ -101,38 +101,39 @@ nsDOMIterator::AppendList(const nsBoolDo
     nsCOMPtr<nsINode> node = mIter->GetCurrentNode();
 
     if (functor(node)) {
       arrayOfNodes.AppendElement(*node);
     }
   }
 }
 
-nsDOMSubtreeIterator::nsDOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
+namespace mozilla {
+
+DOMSubtreeIterator::DOMSubtreeIterator(
+                      MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
   : nsDOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT)
 {
 }
 
 nsresult
-nsDOMSubtreeIterator::Init(nsRange& aRange)
+DOMSubtreeIterator::Init(nsRange& aRange)
 {
   mIter = NS_NewContentSubtreeIterator();
   return mIter->Init(&aRange);
 }
 
-nsDOMSubtreeIterator::~nsDOMSubtreeIterator()
+DOMSubtreeIterator::~DOMSubtreeIterator()
 {
 }
 
 /******************************************************************************
  * some general purpose editor utils
  *****************************************************************************/
 
-namespace mozilla {
-
 bool
 EditorUtils::IsDescendantOf(nsINode* aNode,
                             nsINode* aParent,
                             int32_t* aOffset)
 {
   MOZ_ASSERT(aNode && aParent);
   if (aNode == aParent) {
     return false;
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -211,27 +211,27 @@ class MOZ_RAII nsDOMIterator
 
     void AppendList(const nsBoolDomIterFunctor& functor,
                     nsTArray<mozilla::OwningNonNull<nsINode>>& arrayOfNodes) const;
   protected:
     nsCOMPtr<nsIContentIterator> mIter;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-class MOZ_RAII nsDOMSubtreeIterator : public nsDOMIterator
+namespace mozilla {
+
+class MOZ_RAII DOMSubtreeIterator final : public nsDOMIterator
 {
-  public:
-    explicit nsDOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
-    virtual ~nsDOMSubtreeIterator();
+public:
+  explicit DOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
+  virtual ~DOMSubtreeIterator();
 
-    nsresult Init(nsRange& aRange);
+  nsresult Init(nsRange& aRange);
 };
 
-namespace mozilla {
-
 class TrivialFunctor final : public nsBoolDomIterFunctor
 {
 public:
   // Used to build list of all nodes iterator covers
   virtual bool operator()(nsINode* aNode) const
   {
     return true;
   }
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -2247,17 +2247,17 @@ nsHTMLEditor::CreateListOfNodesToPaste(D
   nsresult rv = nsRange::CreateRange(aStartNode, aStartOffset,
                                      aEndNode, aEndOffset,
                                      getter_AddRefs(docFragRange));
   MOZ_ASSERT(NS_SUCCEEDED(rv));
   NS_ENSURE_SUCCESS(rv, );
 
   // Now use a subtree iterator over the range to create a list of nodes
   TrivialFunctor functor;
-  nsDOMSubtreeIterator iter;
+  DOMSubtreeIterator iter;
   rv = iter.Init(*docFragRange);
   NS_ENSURE_SUCCESS(rv, );
   iter.AppendList(functor, outNodeList);
 }
 
 void
 nsHTMLEditor::GetListAndTableParents(StartOrEnd aStartOrEnd,
                                      nsTArray<OwningNonNull<nsINode>>& aNodeList,
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -2355,17 +2355,17 @@ nsHTMLEditRules::WillDeleteSelection(Sel
 
         uint32_t rangeCount = aSelection->RangeCount();
         for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
           OwningNonNull<nsRange> range = *aSelection->GetRangeAt(rangeIdx);
 
           // Build a list of nodes in the range
           nsTArray<OwningNonNull<nsINode>> arrayOfNodes;
           TrivialFunctor functor;
-          nsDOMSubtreeIterator iter;
+          DOMSubtreeIterator iter;
           nsresult res = iter.Init(*range);
           NS_ENSURE_SUCCESS(res, res);
           iter.AppendList(functor, arrayOfNodes);
 
           // Now that we have the list, delete non-table elements
           int32_t listCount = arrayOfNodes.Length();
           for (int32_t j = 0; j < listCount; j++) {
             nsCOMPtr<nsINode> somenode = do_QueryInterface(arrayOfNodes[0]);
@@ -5620,17 +5620,17 @@ nsHTMLEditRules::GetNodesForOperation(ns
     for (auto& item : rangeItemArray) {
       mHTMLEditor->mRangeUpdater.DropRangeItem(item);
       aArrayOfRanges.AppendElement(item->GetRange());
     }
     NS_ENSURE_SUCCESS(res, res);
   }
   // Gather up a list of all the nodes
   for (auto& range : aArrayOfRanges) {
-    nsDOMSubtreeIterator iter;
+    DOMSubtreeIterator iter;
     res = iter.Init(*range);
     NS_ENSURE_SUCCESS(res, res);
     if (aOutArrayOfNodes.Length() == 0) {
       iter.AppendList(TrivialFunctor(), aOutArrayOfNodes);
     } else {
       // We don't want duplicates in aOutArrayOfNodes, so we use an
       // iterator/functor that only return nodes that are not already in
       // aOutArrayOfNodes.