diff options
Diffstat (limited to 'layout/generic/nsGridContainerFrame.cpp')
-rw-r--r-- | layout/generic/nsGridContainerFrame.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp index 0af05be509..0a953d6fff 100644 --- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -2622,9 +2622,9 @@ nsGridContainerFrame::GridReflowInput::CalculateTrackSizes( const LogicalSize& aContentBox, SizingConstraint aConstraint) { - mCols.Initialize(mColFunctions, mGridStyle->mGridColumnGap, + mCols.Initialize(mColFunctions, mGridStyle->mColumnGap, aGrid.mGridColEnd, aContentBox.ISize(mWM)); - mRows.Initialize(mRowFunctions, mGridStyle->mGridRowGap, + mRows.Initialize(mRowFunctions, mGridStyle->mRowGap, aGrid.mGridRowEnd, aContentBox.BSize(mWM)); mCols.CalculateSizes(*this, mGridItems, mColFunctions, @@ -3378,7 +3378,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState, // to a 0,0 based grid after placing definite lines. auto areas = gridStyle->mGridTemplateAreas.get(); uint32_t numRepeatCols = aState.mColFunctions.InitRepeatTracks( - gridStyle->mGridColumnGap, + gridStyle->mColumnGap, aComputedMinSize.ISize(aState.mWM), aComputedSize.ISize(aState.mWM), aComputedMaxSize.ISize(aState.mWM)); @@ -3387,7 +3387,7 @@ nsGridContainerFrame::Grid::PlaceGridItems(GridReflowInput& aState, LineNameMap colLineNameMap(gridStyle->mGridTemplateColumns, numRepeatCols); uint32_t numRepeatRows = aState.mRowFunctions.InitRepeatTracks( - gridStyle->mGridRowGap, + gridStyle->mRowGap, aComputedMinSize.BSize(aState.mWM), aComputedSize.BSize(aState.mWM), aComputedMaxSize.BSize(aState.mWM)); @@ -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)); @@ -6585,7 +6590,7 @@ nsGridContainerFrame::IntrinsicISize(nsRenderingContext* aRenderingContext, if (grid.mGridColEnd == 0) { return 0; } - state.mCols.Initialize(state.mColFunctions, state.mGridStyle->mGridColumnGap, + state.mCols.Initialize(state.mColFunctions, state.mGridStyle->mColumnGap, grid.mGridColEnd, NS_UNCONSTRAINEDSIZE); auto constraint = aType == nsLayoutUtils::MIN_ISIZE ? SizingConstraint::eMinContent : SizingConstraint::eMaxContent; @@ -6593,7 +6598,7 @@ nsGridContainerFrame::IntrinsicISize(nsRenderingContext* aRenderingContext, NS_UNCONSTRAINEDSIZE, &GridArea::mCols, constraint); state.mCols.mGridGap = - nsLayoutUtils::ResolveGapToLength(state.mGridStyle->mGridColumnGap, + nsLayoutUtils::ResolveGapToLength(state.mGridStyle->mColumnGap, NS_UNCONSTRAINEDSIZE); nscoord length = 0; for (const TrackSize& sz : state.mCols.mSizes) { |