LibWeb/CSS: Make CSSStyleValue.to_string() return ExceptionOr

DOMMatrix.to_string() throws exceptions if any of its values are
non-finite. This ends up affecting CSSStyleValue because its subclass
CSSTransformValue (which is about to be added) serializes
CSSTransformComponents, and one of those is CSSMatrixComponent, which
calls DOMMatrix.to_string().

This is all quite unfortunate, and because at the time the spec for
DOMMatrix was written, CSS couldn't represent NaN or infinity. That's
no longer true, so I'm hoping the spec can be updated and this can be
reverted. https://github.com/w3c/fxtf-drafts/issues/611
This commit is contained in:
Sam Atkins 2025-09-16 15:06:38 +01:00
commit d3d695e9d2
Notes: github-actions[bot] 2025-09-24 11:28:48 +00:00
19 changed files with 48 additions and 44 deletions

View file

@ -55,7 +55,7 @@ WebIDL::ExceptionOr<void> CSSKeywordValue::set_value(FlyString value)
}
// https://drafts.css-houdini.org/css-typed-om-1/#keywordvalue-serialization
String CSSKeywordValue::to_string() const
WebIDL::ExceptionOr<String> CSSKeywordValue::to_string() const
{
// To serialize a CSSKeywordValue this:
// 1. Return thiss value internal slot.