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

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: Updated after cbiesinger's review 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
« no previous file with comments | « Source/core/rendering/RenderFlexibleBox.h ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderFlexibleBox.cpp
diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
index 032a76d4ec6b2117af5d24842ea2ec2fa6f758c6..d1c9cfc192bfbb9eb0cfdfc63080be7e27ef337a 100644
--- a/Source/core/rendering/RenderFlexibleBox.cpp
+++ b/Source/core/rendering/RenderFlexibleBox.cpp
@@ -293,13 +293,12 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
RenderBlock::startDelayUpdateScrollInfo();
- Vector<LineContext> lineContexts;
- Vector<int> orderValues;
- computeMainAxisPreferredSizes(orderValues);
- m_orderIterator.setOrderValues(orderValues);
+ prepareOrderIteratorAndMargins();
ChildFrameRects oldChildRects;
appendChildFrameRects(oldChildRects);
+
+ Vector<LineContext> lineContexts;
layoutFlexItems(relayoutChildren, lineContexts);
updateLogicalHeight();
@@ -871,17 +870,13 @@ LayoutUnit RenderFlexibleBox::computeChildMarginValue(Length margin, RenderView*
return minimumValueForLength(margin, availableSize, view);
}
-void RenderFlexibleBox::computeMainAxisPreferredSizes(Vector<int>& orderValues)
+void RenderFlexibleBox::prepareOrderIteratorAndMargins()
{
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 +891,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)
« no previous file with comments | « Source/core/rendering/RenderFlexibleBox.h ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698