Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1777)

Unified Diff: Source/core/rendering/RenderFlexibleBox.cpp

Issue 18978010: Setting up OrderIterator shouldn't require an extra Vector (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderFlexibleBox.cpp
diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
index 032a76d4ec6b2117af5d24842ea2ec2fa6f758c6..9d56c19683a3961728c2713f45926a48a53eed7a 100644
--- a/Source/core/rendering/RenderFlexibleBox.cpp
+++ b/Source/core/rendering/RenderFlexibleBox.cpp
@@ -294,9 +294,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
RenderBlock::startDelayUpdateScrollInfo();
Vector<LineContext> lineContexts;
- Vector<int> orderValues;
- computeMainAxisPreferredSizes(orderValues);
- m_orderIterator.setOrderValues(orderValues);
+ computeMainAxisPreferredSizes();
ChildFrameRects oldChildRects;
appendChildFrameRects(oldChildRects);
@@ -871,17 +869,13 @@ LayoutUnit RenderFlexibleBox::computeChildMarginValue(Length margin, RenderView*
return minimumValueForLength(margin, availableSize, view);
}
-void RenderFlexibleBox::computeMainAxisPreferredSizes(Vector<int>& orderValues)
+void RenderFlexibleBox::computeMainAxisPreferredSizes()
cbiesinger 2013/07/10 19:35:32 I think you should keep the rename of this functio
Julien - ping for review 2013/07/10 21:15:48 Done.
{
RenderView* renderView = view();
- bool anyChildHasDefaultOrderValue = false;
+ OrderIteratorPopulator populator(m_orderIterator);
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- // Avoid growing the vector for the common-case default value of 0.
- if (int order = child->style()->order())
- orderValues.append(child->style()->order());
- else
- anyChildHasDefaultOrderValue = true;
+ populator.collectChild(child);
if (child->isOutOfFlowPositioned())
continue;
@@ -896,13 +890,6 @@ void RenderFlexibleBox::computeMainAxisPreferredSizes(Vector<int>& orderValues)
child->setMarginBottom(computeChildMarginValue(child->style()->marginBottom(), renderView));
}
}
-
- if (anyChildHasDefaultOrderValue) {
- // Avoid growing the vector to the default capacity of 16 if we're only going to put one item in it.
- if (orderValues.isEmpty())
- orderValues.reserveInitialCapacity(1);
- orderValues.append(0);
- }
}
LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize)

Powered by Google App Engine
This is Rietveld 408576698