From c79f261bec40a61373d45508c1935f839454c95d Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 14 Oct 2024 11:24:48 +0100 Subject: [PATCH] LibWeb/CSS: Mark grid-[gap, column-gap, row-gap] properties as aliases These are legacy name aliases for the properties without the 'grid-' prefix. See https://drafts.csswg.org/css-align-3/#gap-legacy --- .../css/getComputedStyle-print-all.txt | 4 +- Userland/Libraries/LibWeb/CSS/Properties.json | 40 ++----------------- .../Libraries/LibWeb/CSS/StyleComputer.cpp | 12 +----- 3 files changed, 5 insertions(+), 51 deletions(-) diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt index d1eb154fe65..1a8fe4c32b4 100644 --- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt +++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt @@ -113,15 +113,13 @@ grid-auto-columns: auto grid-auto-flow: row grid-auto-rows: auto grid-column-end: auto -grid-column-gap: auto grid-column-start: auto grid-row-end: auto -grid-row-gap: auto grid-row-start: auto grid-template-areas: grid-template-columns: grid-template-rows: -height: 2091px +height: 2057px inline-size: auto inset-block-end: auto inset-block-start: auto diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index 89dfc40e757..55d603ca048 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -1382,17 +1382,7 @@ ] }, "grid-column-gap": { - "animation-type": "by-computed-value", - "inherited": false, - "initial": "auto", - "valid-types": [ - "length [0,∞]", - "percentage [0,∞]" - ], - "valid-identifiers": [ - "auto" - ], - "percentages-resolve-to": "length" + "legacy-alias-for": "column-gap" }, "grid-column-start": { "animation-type": "discrete", @@ -1406,21 +1396,7 @@ ] }, "grid-gap": { - "inherited": false, - "initial": "auto", - "valid-types": [ - "length [0,∞]", - "percentage [0,∞]" - ], - "max-values": 2, - "valid-identifiers": [ - "auto" - ], - "percentages-resolve-to": "length", - "longhands": [ - "grid-row-gap", - "grid-column-gap" - ] + "legacy-alias-for": "gap" }, "grid-row": { "inherited": false, @@ -1448,17 +1424,7 @@ ] }, "grid-row-gap": { - "animation-type": "by-computed-value", - "inherited": false, - "initial": "auto", - "valid-types": [ - "length [0,∞]", - "percentage [0,∞]" - ], - "valid-identifiers": [ - "auto" - ], - "percentages-resolve-to": "length" + "legacy-alias-for": "row-gap" }, "grid-row-start": { "animation-type": "discrete", diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 3f98ac3eac2..37824efe17b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -726,7 +726,7 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i return; } - if (property_id == CSS::PropertyID::Gap || property_id == CSS::PropertyID::GridGap) { + if (property_id == CSS::PropertyID::Gap) { if (value.is_value_list()) { auto const& values_list = value.as_value_list(); set_longhand_property(CSS::PropertyID::RowGap, values_list.values()[0]); @@ -738,16 +738,6 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i return; } - if (property_id == CSS::PropertyID::RowGap || property_id == CSS::PropertyID::GridRowGap) { - set_longhand_property(CSS::PropertyID::RowGap, value); - return; - } - - if (property_id == CSS::PropertyID::ColumnGap || property_id == CSS::PropertyID::GridColumnGap) { - set_longhand_property(CSS::PropertyID::ColumnGap, value); - return; - } - if (property_id == CSS::PropertyID::MaxInlineSize || property_id == CSS::PropertyID::MinInlineSize) { // FIXME: Use writing-mode to determine if we should set width or height. bool is_horizontal = true;