From 32dff95bd84c77d24991125df8fa4bf39b6b502b Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Fri, 18 May 2018 21:09:21 +0200 Subject: [PATCH] Bug 1458902 - [css-grid] Re-resolve row-gap against the sum of row track sizes for auto-sized grid containers. r=dholbert Per CSSWG resolution in: https://github.com/w3c/csswg-drafts/issues/1921#issuecomment-342269371 --- layout/generic/nsGridContainerFrame.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 92377bee6be0..c6e285ba2ec1 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -5990,6 +5990,11 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext, computedISize, bSize); if (!prevInFlow) { + if (computedBSize == NS_AUTOHEIGHT && stylePos->mRowGap.HasPercent()) { + // Re-resolve the row-gap now that we know our intrinsic block-size. + gridReflowInput.mRows.mGridGap = + nsLayoutUtils::ResolveGapToLength(stylePos->mRowGap, bSize); + } // Apply 'align/justify-content' to the grid. // CalculateTrackSizes did the columns. gridReflowInput.mRows.AlignJustifyContent(stylePos, wm, contentArea.Size(wm));