Issue #1838 - Part 2: Remove grid- prefix from grid-(column|row)-gap properties

This removes the `grid` prefix from the gap-related properties of grid since they are now part of the box alignment specification. Former grid-gap* properties were aliased to the unprefixed properties to maintain compatibility.

The previously multi-column layout only `column-gap` property has been modified to apply to the Grid layout (and Flexbox in a following commit), moving the `mColumnGap` member variable from `nsStyleColumn` to `nsStylePosition`.

Notes:
* Bug 1398537 - support for percent values in column-gap for multi-column layout landed as part of Issue #1230. However, it was incomplete because it did not update `nsRuleNode` to allow transformation of percentage values for `column-gap`. This was consequently fixed as part of this commit.
* Bug 1456166 - this might not apply because we don't have that devtools test in UXP
* `nsRuleNode`, `nsCSSParser`, `Declaration`, and other related classes were merged into Stylo. These should be taken into consideration when porting patches from Mozilla.

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1398482
This commit is contained in:
FranklinDM 2022-04-02 13:46:07 +08:00 committed by roytam1
commit b4f2c83687
13 changed files with 103 additions and 121 deletions

View file

@ -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));
@ -6585,7 +6585,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 +6593,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) {