ladybird/Libraries/LibWeb/CSS/CSSNumericValue.idl
Sam Atkins a139ad1c44
Some checks are pending
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
LibWeb/CSS: Implement CSSNumericValue.to()
Tries to convert the CSSNumericValue to a CSSUnitValue with the given
unit.

This gets us the remaining 11 WPT subtests for this method.
2025-09-12 13:45:41 +02:00

47 lines
1.4 KiB
Text

#import <CSS/CSSStyleValue.idl>
#import <CSS/CSSUnitValue.idl>
// https://drafts.css-houdini.org/css-typed-om-1/#enumdef-cssnumericbasetype
enum CSSNumericBaseType {
"length",
"angle",
"time",
"frequency",
"resolution",
"flex",
"percent",
};
// https://drafts.css-houdini.org/css-typed-om-1/#dictdef-cssnumerictype
dictionary CSSNumericType {
long length;
long angle;
long time;
long frequency;
long resolution;
long flex;
long percent;
CSSNumericBaseType percentHint;
};
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue
[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
interface CSSNumericValue : CSSStyleValue {
[FIXME] CSSNumericValue add(CSSNumberish... values);
[FIXME] CSSNumericValue sub(CSSNumberish... values);
[FIXME] CSSNumericValue mul(CSSNumberish... values);
[FIXME] CSSNumericValue div(CSSNumberish... values);
[FIXME] CSSNumericValue min(CSSNumberish... values);
[FIXME] CSSNumericValue max(CSSNumberish... values);
[ImplementedAs=equals_for_bindings] boolean equals(CSSNumberish... value);
CSSUnitValue to(USVString unit);
// FIXME: CSSMathSum toSum(USVString... units);
[ImplementedAs=type_for_bindings] CSSNumericType type();
[Exposed=Window] static CSSNumericValue parse(USVString cssText);
};
// https://drafts.css-houdini.org/css-typed-om-1/#typedefdef-cssnumberish
typedef (double or CSSNumericValue) CSSNumberish;