Backed out changeset 094e8f3937e8 (bug 1375131) for bustage
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 23 Jun 2017 12:28:59 +0200
changeset 365785 a966daa11b06e3fcf3632deb767666867030b5ed
parent 365784 6adb1c9cd7eec48796d0ef99175d164abfe2343a
child 365786 391c04c22f939624a30969f1a43cc7e94ad62920
push id45372
push usercbook@mozilla.com
push dateFri, 23 Jun 2017 10:29:09 +0000
treeherderautoland@a966daa11b06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1375131
milestone56.0a1
backs out094e8f3937e826868e2bea4a5688204720247ac2
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
Backed out changeset 094e8f3937e8 (bug 1375131) for bustage
editor/libeditor/EditorUtils.h
editor/libeditor/HTMLEditRules.cpp
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 #ifndef mozilla_EditorUtils_h
 #define mozilla_EditorUtils_h
 
-#include "mozilla/dom/Selection.h"
 #include "mozilla/EditorBase.h"
 #include "mozilla/GuardObjects.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsIDOMNode.h"
 #include "nsIEditor.h"
 #include "nscore.h"
 
@@ -22,16 +21,20 @@ class nsIDOMDocument;
 class nsIDOMEvent;
 class nsISimpleEnumerator;
 class nsITransferable;
 class nsRange;
 
 namespace mozilla {
 template <class T> class OwningNonNull;
 
+namespace dom {
+class Selection;
+} // namespace dom
+
 /***************************************************************************
  * EditActionResult is useful to return multiple results of an editor
  * action handler without out params.
  * Note that when you return an anonymous instance from a method, you should
  * use EditActionIgnored(), EditActionHandled() or EditActionCanceled() for
  * easier to read.  In other words, EditActionResult should be used when
  * declaring return type of a method, being an argument or defined as a local
  * variable.
@@ -314,33 +317,16 @@ public:
     }
   }
 
 protected:
   EditorBase* mEditorBase;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-class MOZ_STACK_CLASS AutoRangeArray final
-{
-public:
-  AutoRangeArray(dom::Selection* aSelection)
-  {
-    if (!aSelection) {
-      return;
-    }
-    uint32_t rangeCount = aSelection->RangeCount();
-    for (uint32_t i = 0; i < rangeCount; i++) {
-      mRanges.AppendElement(*aSelection->GetRangeAt(i));
-    }
-  }
-
-  AutoTArray<mozilla::OwningNonNull<nsRange>, 8> mRanges;
-};
-
 /******************************************************************************
  * some helper classes for iterating the dom tree
  *****************************************************************************/
 
 class BoolDomIterFunctor
 {
 public:
   virtual bool operator()(nsINode* aNode) const = 0;
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -2447,18 +2447,20 @@ HTMLEditRules::WillDeleteSelection(Selec
           NS_ENSURE_SUCCESS(rv, rv);
           return NS_OK;
         }
 
         // Else blocks not same type, or not siblings.  Delete everything
         // except table elements.
         join = true;
 
-        AutoRangeArray arrayOfRanges(aSelection);
-        for (auto& range : arrayOfRanges.mRanges) {
+        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;
           DOMSubtreeIterator iter;
           nsresult rv = iter.Init(*range);
           NS_ENSURE_SUCCESS(rv, rv);
           iter.AppendList(functor, arrayOfNodes);