Backed out changeset d511913b5284 (bug 1387522) for failing mochitest editor/libeditor/tests/test_bug767684.html. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sun, 13 Aug 2017 20:21:26 +0200
changeset 645660 4be1e24368459311e7e1cc2bddf895f5f205e829
parent 645659 d511913b5284d14fc7afbca119b04e88c1a27207
child 645661 be93c09fd3e37112fda7693205b7c1f70675091f
push id73820
push userbmo:gl@mozilla.com
push dateSun, 13 Aug 2017 22:09:20 +0000
reviewersbackout
bugs1387522, 767684
milestone57.0a1
backs outd511913b5284d14fc7afbca119b04e88c1a27207
Backed out changeset d511913b5284 (bug 1387522) for failing mochitest editor/libeditor/tests/test_bug767684.html. r=backout
editor/libeditor/HTMLStyleEditor.cpp
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -1533,31 +1533,29 @@ HTMLEditor::RelativeFontChangeHelper(int
   if (aSizeChange != 1 && aSizeChange != -1) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   // If this is a font node with size, put big/small inside it.
   if (aNode->IsHTMLElement(nsGkAtoms::font) &&
       aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::size)) {
     // Cycle through children and adjust relative font size.
-    for (nsIContent* child = aNode->GetFirstChild();
-         child; child = child->GetNextSibling()) {
-      nsresult rv = RelativeFontChangeOnNode(aSizeChange, child);
+    for (uint32_t i = aNode->GetChildCount(); i--; ) {
+      nsresult rv = RelativeFontChangeOnNode(aSizeChange, aNode->GetChildAt(i));
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // RelativeFontChangeOnNode already calls us recursively,
     // so we don't need to check our children again.
     return NS_OK;
   }
 
   // Otherwise cycle through the children.
-  for (nsIContent* child = aNode->GetFirstChild();
-       child; child = child->GetNextSibling()) {
-    nsresult rv = RelativeFontChangeHelper(aSizeChange, child);
+  for (uint32_t i = aNode->GetChildCount(); i--; ) {
+    nsresult rv = RelativeFontChangeHelper(aSizeChange, aNode->GetChildAt(i));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 nsresult
 HTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange,
@@ -1613,19 +1611,18 @@ HTMLEditor::RelativeFontChangeOnNode(int
 
     return NS_OK;
   }
 
   // none of the above?  then cycle through the children.
   // MOOSE: we should group the children together if possible
   // into a single "big" or "small".  For the moment they are
   // each getting their own.
-  for (nsIContent* child = aNode->GetFirstChild();
-       child; child = child->GetNextSibling()) {
-    nsresult rv = RelativeFontChangeOnNode(aSizeChange, child);
+  for (uint32_t i = aNode->GetChildCount(); i--; ) {
+    nsresult rv = RelativeFontChangeOnNode(aSizeChange, aNode->GetChildAt(i));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLEditor::GetFontFaceState(bool* aMixed,