LibWeb: Handle CSS-wide keywords in style_property_for_sided_shorthand

CSS-wide keywords should not be concatenated in the same way as other
values unless they are all the same.
This commit is contained in:
Callum Law 2025-06-12 19:50:51 +12:00 committed by Sam Atkins
commit 7d81823eb3
Notes: github-actions[bot] 2025-06-16 11:38:51 +00:00
2 changed files with 6 additions and 3 deletions

View file

@ -479,6 +479,9 @@ static Optional<StyleProperty> style_property_for_sided_shorthand(PropertyID pro
bool const top_and_bottom_same = top_value == bottom_value; bool const top_and_bottom_same = top_value == bottom_value;
bool const left_and_right_same = left_value == right_value; bool const left_and_right_same = left_value == right_value;
if ((top_value->is_css_wide_keyword() || right_value->is_css_wide_keyword() || bottom_value->is_css_wide_keyword() || left_value->is_css_wide_keyword()) && (!top_and_bottom_same || !left_and_right_same || top_value != left_value))
return {};
RefPtr<CSSStyleValue const> value; RefPtr<CSSStyleValue const> value;
if (top_and_bottom_same && left_and_right_same && top_value == left_value) { if (top_and_bottom_same && left_and_right_same && top_value == left_value) {

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 11 tests Found 11 tests
5 Pass 6 Pass
6 Fail 5 Fail
Fail All properties can serialize 'initial' Fail All properties can serialize 'initial'
Fail All properties (except 'all') can serialize their initial value (computed) Fail All properties (except 'all') can serialize their initial value (computed)
Fail All properties (except 'all') can serialize their initial value (specified) Fail All properties (except 'all') can serialize their initial value (specified)
@ -11,7 +11,7 @@ Fail All shorthands can serialize their longhands set to 'initial'
Fail All shorthands (except 'all') can serialize their longhands set to their initial value Fail All shorthands (except 'all') can serialize their longhands set to their initial value
Pass All aliases can serialize target property set to 'initial' Pass All aliases can serialize target property set to 'initial'
Pass All aliases can serialize target property set to its initial value Pass All aliases can serialize target property set to its initial value
Fail Can't serialize shorthand when longhands are set to different css-wide keywords Pass Can't serialize shorthand when longhands are set to different css-wide keywords
Pass Can't serialize shorthand when longhands have different priority Pass Can't serialize shorthand when longhands have different priority
Pass Can't serialize shorthand set to 'initial' when some longhand is missing Pass Can't serialize shorthand set to 'initial' when some longhand is missing
Pass Can't serialize shorthand set to initial value when some longhand is missing Pass Can't serialize shorthand set to initial value when some longhand is missing