LibWeb/CSS: Implement CSSKeywordValue

CSSStyleValue is adjusted to allow for subclasses. Serialization for
CSSKeywordValue is implemented differently than the spec says because
of a spec bug: https://github.com/w3c/csswg-drafts/issues/12545
This commit is contained in:
Sam Atkins 2025-08-14 12:33:40 +01:00
commit a93c6a347f
Notes: github-actions[bot] 2025-08-21 09:23:30 +00:00
14 changed files with 150 additions and 21 deletions

View file

@ -18,6 +18,11 @@ GC::Ref<CSSStyleValue> CSSStyleValue::create(JS::Realm& realm, String associated
return realm.create<CSSStyleValue>(realm, move(associated_property), move(constructed_from_string));
}
CSSStyleValue::CSSStyleValue(JS::Realm& realm)
: PlatformObject(realm)
{
}
CSSStyleValue::CSSStyleValue(JS::Realm& realm, String associated_property, String constructed_from_string)
: PlatformObject(realm)
, m_associated_property(move(associated_property))
@ -39,9 +44,10 @@ String CSSStyleValue::to_string() const
// the serialization is the USVString from which the value was constructed.
return m_constructed_from_string.value();
}
// FIXME: otherwise, if the value was constructed using an IDL constructor
// otherwise, if the value was constructed using an IDL constructor
{
// the serialization is specified in the sections below.
// NB: This is handled by subclasses overriding this to_string() method.
}
// FIXME: otherwise, if the value was extracted from the CSSOM
{