mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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:
Notes:
github-actions[bot]
2025-09-24 11:28:48 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/d3d695e9d25 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6227
@@ -89,7 +89,7 @@ WebIDL::ExceptionOr<void> CSSVariableReferenceValue::set_fallback(GC::Ptr<CSSUnp
|
||||
}
|
||||
|
||||
// https://drafts.css-houdini.org/css-typed-om-1/#serialize-a-cssvariablereferencevalue
|
||||
String CSSVariableReferenceValue::to_string() const
|
||||
WebIDL::ExceptionOr<String> CSSVariableReferenceValue::to_string() const
|
||||
{
|
||||
// To serialize a CSSVariableReferenceValue this:
|
||||
// 1. Let s initially be "var(".
|
||||
@@ -103,7 +103,7 @@ String CSSVariableReferenceValue::to_string() const
|
||||
if (m_fallback) {
|
||||
// AD-HOC: Tested behaviour requires we append "," without the space. https://github.com/w3c/css-houdini-drafts/issues/1148
|
||||
s.append(","sv);
|
||||
s.append(m_fallback->to_string());
|
||||
s.append(TRY(m_fallback->to_string()));
|
||||
}
|
||||
|
||||
// 4. Append ")" to s and return s.
|
||||
|
||||
Reference in New Issue
Block a user