Index: third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
index ec13d1934a0da3df498bbfaa44792491e7bfb277..de7fb5176c2c6efb5eaee2a622fc2272f1e7bd63 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
@@ -430,7 +430,7 @@ void LayoutGrid::repeatTracksSizingIfNeeded(GridSizingData& sizingData, LayoutUn |
// a new cycle of the sizing algorithm; there may be more. In addition, not all the |
// cases with orthogonal flows require this extra cycle; we need a more specific |
// condition to detect whether child's min-content contribution has changed or not. |
- if (m_hasAnyOrthogonalChild) { |
+ if (!m_orthogonalChildren.isEmpty()) { |
computeTrackSizesForDefiniteSize(ForColumns, sizingData, availableSpaceForColumns); |
computeTrackSizesForDefiniteSize(ForRows, sizingData, availableSpaceForRows); |
} |
@@ -452,6 +452,18 @@ void LayoutGrid::layoutBlock(bool relayoutChildren) |
LayoutSize previousSize = size(); |
+ // We need to clear both own and containingBlock override sizes to ensure we get the same |
+ // result when grid's intrinsic size it's computed again. |
cbiesinger
2016/09/27 09:47:42
Please add "in the updateLogicalWidth call below"
|
+ if (sizesLogicalWidthToFitContent(styleRef().logicalWidth()) || styleRef().logicalWidth().isIntrinsicOrAuto()) { |
+ for (auto* child : m_orthogonalChildren) { |
cbiesinger
2016/09/27 09:47:42
This is a little subtle because m_orthogonalChildr
|
+ if (child->isOutOfFlowPositioned()) |
+ continue; |
+ child->clearOverrideSize(); |
+ child->clearContainingBlockOverrideSize(); |
+ child->forceLayout(); |
+ } |
+ } |
+ |
updateLogicalWidth(); |
m_hasDefiniteLogicalHeight = hasDefiniteLogicalHeight(); |
@@ -1568,12 +1580,13 @@ void LayoutGrid::placeItemsOnGrid(SizingOperation sizingOperation) |
Vector<LayoutBox*> autoMajorAxisAutoGridItems; |
Vector<LayoutBox*> specifiedMajorAxisAutoGridItems; |
- m_hasAnyOrthogonalChild = false; |
+ m_orthogonalChildren.shrink(0); |
for (LayoutBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) { |
if (child->isOutOfFlowPositioned()) |
continue; |
- m_hasAnyOrthogonalChild = m_hasAnyOrthogonalChild || isOrthogonalChild(*child); |
+ if (isOrthogonalChild(*child)) |
+ m_orthogonalChildren.append(child); |
GridArea area = cachedGridArea(*child); |
if (!area.rows.isIndefinite()) |