LibWeb: Handle serialization of invalid font-variant in all contexts

Previously as we handled this in `get_property_internal` there were some
contexts that we missed, for instance `CSSStyleProperties::serialized`.
This commit is contained in:
Callum Law 2025-07-10 17:04:57 +12:00 committed by Sam Atkins
commit 09a5c04e5c
Notes: github-actions[bot] 2025-07-15 13:27:42 +00:00
4 changed files with 21 additions and 34 deletions

View file

@ -344,6 +344,10 @@ String ShorthandStyleValue::to_string(SerializationMode mode) const
auto position = longhand(PropertyID::FontVariantPosition);
auto emoji = longhand(PropertyID::FontVariantEmoji);
// If ligatures is `none` and any other value isn't `normal`, that's invalid.
if (ligatures->to_keyword() == Keyword::None && !first_is_equal_to_all_of(Keyword::Normal, caps->to_keyword(), alternates->to_keyword(), numeric->to_keyword(), east_asian->to_keyword(), position->to_keyword(), emoji->to_keyword()))
return ""_string;
Vector<String> values;
if (ligatures->to_keyword() != Keyword::Normal)
values.append(ligatures->to_string(mode));