LibWeb/CSS: Implement CSSMathInvert

This is almost identical to CSSMathNegate.
This commit is contained in:
Sam Atkins 2025-08-19 16:23:12 +01:00 committed by Andreas Kling
commit 8efd0639cd
Notes: github-actions[bot] 2025-08-29 09:59:33 +00:00
8 changed files with 147 additions and 3 deletions

View file

@ -7,6 +7,7 @@
#include "CSSMathProduct.h"
#include <LibWeb/Bindings/CSSMathProductPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/CSSMathInvert.h>
#include <LibWeb/CSS/CSSNumericArray.h>
#include <LibWeb/WebIDL/DOMException.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -110,10 +111,9 @@ String CSSMathProduct::serialize_math_value(Nested nested, Parens parens) const
// 1. If arg is a CSSMathInvert, append " / " to s, then serialize args value internal slot with nested
// set to true, and append the result to s.
// FIXME: Detect CSSMathInvert once that's implemented.
if (false) {
if (auto* invert = as_if<CSSMathInvert>(*arg)) {
s.append(" / "sv);
s.append(arg->to_string({ .nested = true }));
s.append(invert->value()->to_string({ .nested = true }));
}
// 2. Otherwise, append " * " to s, then serialize arg with nested set to true, and append the result to s.