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

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

Issue 826893003: [CSS Grid Layout] Remove stack from grid-auto-flow syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@remove-stack
Patch Set: Adding perftests Created 5 years, 12 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/RenderGrid.cpp
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index 5221e3ece7743c67a854c39e39114332caa1b9f9..0a50fa3ac28b3e6a304ae47e7f37437d29b9f383 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -194,6 +194,7 @@ public:
RenderGrid::RenderGrid(Element* element)
: RenderBlock(element)
, m_gridIsDirty(true)
+ , m_hasAutoPlacedItems(false)
, m_orderIterator(this)
{
ASSERT(!childrenInline());
@@ -233,9 +234,8 @@ void RenderGrid::addChild(RenderObject* newChild, RenderObject* beforeChild)
if (newChild->parent() != this)
return;
- // FIXME: Implement properly "stack" value in auto-placement algorithm.
- if (!style()->isGridAutoFlowAlgorithmStack()) {
- // The grid needs to be recomputed as it might contain auto-placed items that will change their position.
+ if (hasAutoPlacedItems()) {
+ // The grid needs to be recomputed as it contains auto-placed items that might change their position.
dirtyGrid();
return;
}
@@ -283,9 +283,8 @@ void RenderGrid::removeChild(RenderObject* child)
ASSERT(child->isBox());
- // FIXME: Implement properly "stack" value in auto-placement algorithm.
- if (!style()->isGridAutoFlowAlgorithmStack()) {
- // The grid needs to be recomputed as it might contain auto-placed items that will change their position.
+ if (hasAutoPlacedItems()) {
+ // The grid needs to be recomputed as it contains auto-placed items that will change their position.
dirtyGrid();
return;
}
@@ -917,6 +916,7 @@ void RenderGrid::placeItemsOnGrid()
OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositionsFromStyle(*style(), *child, ForRows);
OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPositionsFromStyle(*style(), *child, ForColumns);
if (!rowPositions || !columnPositions) {
+ setHasAutoPlacedItems();
GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? columnPositions.get() : rowPositions.get();
if (!majorAxisPositions)
autoMajorAxisAutoGridItems.append(child);
@@ -930,14 +930,6 @@ void RenderGrid::placeItemsOnGrid()
ASSERT(gridRowCount() >= GridResolvedPosition::explicitGridRowCount(*style()));
ASSERT(gridColumnCount() >= GridResolvedPosition::explicitGridColumnCount(*style()));
- // FIXME: Implement properly "stack" value in auto-placement algorithm.
- if (style()->isGridAutoFlowAlgorithmStack()) {
- // If we did collect some grid items, they won't be placed thus never laid out.
- ASSERT(!autoMajorAxisAutoGridItems.size());
- ASSERT(!specifiedMajorAxisAutoGridItems.size());
- return;
- }
-
placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems);
placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems);
@@ -1093,6 +1085,7 @@ void RenderGrid::dirtyGrid()
m_grid.resize(0);
m_gridItemCoordinate.clear();
m_gridIsDirty = true;
+ m_hasAutoPlacedItems = false;
m_gridItemsOverflowingGridArea.resize(0);
m_gridItemsIndexesMap.clear();
}

Powered by Google App Engine
This is Rietveld 408576698