Bug 1424047 - Use list to store the display item stack in FlattenedDisplayItemIterator. draft
authorEthan Lin <ethlin@mozilla.com>
Fri, 08 Dec 2017 19:08:35 +0800
changeset 709623 2f79aec48f311287692116dcbd0fc79fedfcf69c
parent 709416 457b0fe91e0d49a5bc35014fb6f86729cd5bac9b
child 743468 d361f980ea7cf4dfeb65a36d653704b11d630bbc
push id92700
push userbmo:ethlin@mozilla.com
push dateFri, 08 Dec 2017 11:27:59 +0000
bugs1424047
milestone59.0a1
Bug 1424047 - Use list to store the display item stack in FlattenedDisplayItemIterator. MozReview-Commit-ID: 9mvbAv46V7d
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -6466,50 +6466,50 @@ public:
   nsDisplayItem* PeekNext()
   {
     return mNext;
   }
 
 private:
   bool AtEndOfNestedList()
   {
-    return !mNext && mStack.Length() > 0;
+    return !mNext && mStack.size() > 0;
   }
 
   bool ShouldFlattenNextItem()
   {
     return mNext && mNext->ShouldFlattenAway(mBuilder);
   }
 
   void ResolveFlattening()
   {
     // Handle the case where we reach the end of a nested list, or the current
     // item should start a new nested list. Repeat this until we find an actual
     // item, or the very end of the outer list.
     while (AtEndOfNestedList() || ShouldFlattenNextItem()) {
       if (AtEndOfNestedList()) {
         // Pop the last item off the stack.
-        mNext = mStack.LastElement();
-        mStack.RemoveElementAt(mStack.Length() - 1);
+        mNext = mStack.back();
+        mStack.pop_back();
         // We stored the item that was flattened, so advance to the next.
         mNext = mNext->GetAbove();
       } else {
         // This item wants to be flattened. Store the current item on the stack,
         // and use the first item in the child list instead.
-        mStack.AppendElement(mNext);
+        mStack.push_back(mNext);
         nsDisplayList* childItems = mNext->GetSameCoordinateSystemChildren();
         mNext = childItems->GetBottom();
       }
     }
   }
 
 
   nsDisplayListBuilder* mBuilder;
   nsDisplayItem* mNext;
-  AutoTArray<nsDisplayItem*, 10> mStack;
+  std::list<nsDisplayItem*> mStack;
 };
 
 /**
  * A display item that for webrender to handle SVG
  */
 class nsDisplaySVGWrapper : public nsDisplayWrapList {
 public:
   NS_DISPLAY_DECL_NAME("SVGWrapper", TYPE_SVG_WRAPPER)