From f1c2ba75d1067ae2610eacbfae56b7b71ebfa223 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sat, 2 Apr 2022 20:22:31 +0800 Subject: Issue #1838 - Part 6: Re-resolve row-gap against the sum of row track sizes for auto-sized grid containers Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1458902 --- layout/generic/nsGridContainerFrame.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'layout/generic/nsGridContainerFrame.cpp') diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index f3904094db..0a953d6fff 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -6214,6 +6214,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)); -- cgit v1.2.3