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

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

Issue 769683004: [CSS Grid Layout] Fix crash in positioned items placed on implicit grid (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comment Created 6 years 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 | « LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-expected.txt ('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 52143edc58f62d17449814b43d03f7d0ad0677bd..efc94ae297152d88b6fdee2c3a22d7c5506dd0f8 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -1229,6 +1229,10 @@ void RenderGrid::offsetAndBreadthForPositionedChild(const RenderBox& child, Grid
GridResolvedPosition lastPosition = GridResolvedPosition((direction == ForColumns ? gridColumnCount() : gridRowCount()) - 1);
GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->resolvedFinalPosition;
+ // Positioned children do not grow the grid, so we need to clamp the positions to avoid ending up outside of it.
+ initialPosition = std::min<GridResolvedPosition>(initialPosition, lastPosition);
+ finalPosition = std::min<GridResolvedPosition>(finalPosition, lastPosition);
+
LayoutUnit start = startIsAuto ? LayoutUnit(0) : (direction == ForColumns) ? m_columnPositions[initialPosition.toInt()] : m_rowPositions[initialPosition.toInt()];
LayoutUnit end = endIsAuto ? (direction == ForColumns) ? logicalWidth() : logicalHeight() : (direction == ForColumns) ? m_columnPositions[finalPosition.next().toInt()] : m_rowPositions[finalPosition.next().toInt()];
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698