Bug 1424047 - Use list to store the display item stack in FlattenedDisplayItemIterator.
MozReview-Commit-ID: 9mvbAv46V7d
--- 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)