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()]; |