LibWeb/CSS: Implement StylePropertyMap::set()

With this commit, only direct CSSStyleValues created from internal
StyleValues can be converted back to a StyleValue. More subtests will
pass as create_an_internal_representation() is implemented for the
various CSSStyleValue subclasses. :^)

Gets us... a LOT of WPT passes, because there's a ton of coverage for
each property.
This commit is contained in:
Sam Atkins 2025-10-02 14:30:55 +01:00 committed by Andreas Kling
commit 84f0f37a29
Notes: github-actions[bot] 2025-10-04 20:58:08 +00:00
13 changed files with 361 additions and 279 deletions

View file

@ -122,4 +122,14 @@ WebIDL::ExceptionOr<String> CSSStyleValue::to_string() const
return String {};
}
// https://drafts.css-houdini.org/css-typed-om-1/#create-an-internal-representation
WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSStyleValue::create_an_internal_representation(PropertyNameAndID const&) const
{
// If value is a direct CSSStyleValue,
// Return values associated value.
if (!m_source_value)
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("Missing {}::create_an_internal_representation() overload", class_name())) };
return NonnullRefPtr { *m_source_value };
}
}