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

@ -1015,7 +1015,7 @@ protected:
bool ParseGridColumnRow(nsCSSPropertyID aStartPropID,
nsCSSPropertyID aEndPropID);
bool ParseGridArea();
bool ParseGridGap();
bool ParseGap();
bool ParseInitialLetter();
@ -9732,8 +9732,8 @@ CSSParserImpl::ParseGrid()
// "Also, the gutter properties are reset by this shorthand,
// even though they can't be set by it."
value.SetFloatValue(0.0f, eCSSUnit_Pixel);
AppendValue(eCSSProperty_grid_row_gap, value);
AppendValue(eCSSProperty_grid_column_gap, value);
AppendValue(eCSSProperty_row_gap, value);
AppendValue(eCSSProperty_column_gap, value);
// [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>
auto res = ParseGridShorthandAutoProps(NS_STYLE_GRID_AUTO_FLOW_ROW);
@ -10041,12 +10041,12 @@ CSSParserImpl::ParseGridArea()
}
bool
CSSParserImpl::ParseGridGap()
CSSParserImpl::ParseGap()
{
nsCSSValue first;
if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) {
AppendValue(eCSSProperty_grid_row_gap, first);
AppendValue(eCSSProperty_grid_column_gap, first);
AppendValue(eCSSProperty_row_gap, first);
AppendValue(eCSSProperty_column_gap, first);
return true;
}
if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) !=
@ -10058,8 +10058,8 @@ CSSParserImpl::ParseGridGap()
if (result == CSSParseResult::Error) {
return false;
}
AppendValue(eCSSProperty_grid_row_gap, first);
AppendValue(eCSSProperty_grid_column_gap,
AppendValue(eCSSProperty_row_gap, first);
AppendValue(eCSSProperty_column_gap,
result == CSSParseResult::NotFound ? first : second);
return true;
}
@ -11959,8 +11959,8 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID)
eCSSProperty_grid_row_end);
case eCSSProperty_grid_area:
return ParseGridArea();
case eCSSProperty_grid_gap:
return ParseGridGap();
case eCSSProperty_gap:
return ParseGap();
case eCSSProperty_image_region:
return ParseRect(eCSSProperty_image_region);
case eCSSProperty_align_content: