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

@ -25,7 +25,7 @@ public:
static WebIDL::ExceptionOr<GC::Ref<CSSStyleValue>> parse(JS::VM&, String property, String css_text);
static WebIDL::ExceptionOr<GC::RootVector<GC::Ref<CSSStyleValue>>> parse_all(JS::VM&, String property, String css_text);
virtual String to_string() const;
virtual WebIDL::ExceptionOr<String> to_string() const;
protected:
explicit CSSStyleValue(JS::Realm&);