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

Unified Diff: Source/core/rendering/RenderGrid.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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderGrid.cpp
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index b7dd423fc7ebe6e1911df816b0ea3982ddcb3608..b1e831240b2e1e55e831c7cbac4648d30f29677d 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -662,20 +662,13 @@ void RenderGrid::placeItemsOnGrid()
void RenderGrid::populateExplicitGridAndOrderIterator()
{
- // FIXME: We should find a way to share OrderIterator's Vector's
- // initialization code with RenderFlexibleBox.
- Vector<int> orderValues;
- bool anyChildHasDefaultOrderValue = false;
+ OrderIteratorPopulator populator(m_orderIterator);
size_t maximumRowIndex = std::max<size_t>(1, explicitGridRowCount());
size_t maximumColumnIndex = std::max<size_t>(1, explicitGridColumnCount());
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);
// This function bypasses the cache (cachedGridCoordinate()) as it is used to build it.
OwnPtr<GridSpan> rowPositions = resolveGridPositionsFromStyle(child, ForRows);
@@ -692,15 +685,6 @@ void RenderGrid::populateExplicitGridAndOrderIterator()
m_grid.grow(maximumRowIndex);
for (size_t i = 0; i < m_grid.size(); ++i)
m_grid[i].grow(maximumColumnIndex);
-
- 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);
- }
-
- m_orderIterator.setOrderValues(orderValues);
}
void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(Vector<RenderBox*> autoGridItems)
« no previous file with comments | « Source/core/rendering/RenderFlexibleBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698