Commit graph

7 commits

Author SHA1 Message Date
Sam Atkins
b2d55e4caa LibWeb/CSS: Support converting CSSUnitValue to a StyleValue
A lone CSSUnitValue can now be converted to a dimension StyleValue of
the relevant type, as long as the property allows that type. If the
value is out of the allowed range, it's wrapped in calc().

There are a few failing tests still, involving setting a negative
percentage and expecting to read the computed value as 0. Those also
fail in Chromium, and a similar negative-length test expects a negative
computed value (not 0), so this appears to be an incorrect test.

Also, we regress some of the `cursor` tests. This is because our "does
property X accept type Y?" code is too naive: `cursor` is defined to
accept "number [-∞,∞]" in the JSON, and that value range is used when
clamping the result of calculations or interpolation. But because that
entry is there, we think a single number is a valid value for `cursor`.
Solving this generally is a larger task than I want to take on right
now. :^)
2025-10-09 16:14:58 +02:00
Sam Atkins
a139ad1c44 LibWeb/CSS: Implement CSSNumericValue.to()
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
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
Sam Atkins
80abffd2e8 LibWeb/CSS: Implement "Create a sum value" 2025-09-12 13:45:41 +02:00
Sam Atkins
1c952b01ac LibWeb/CSS: Implement "Convert a CSSUnitValue" 2025-09-12 13:45:41 +02:00
Sam Atkins
59c4076066 LibWeb/CSS: Mark CSSStyleValue classes final where possible 2025-09-12 13:45:41 +02:00
Sam Atkins
7be645a091 LibWeb/CSS: Implement CSSNumericType.equals()
Some checks are pending
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
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
2025-08-29 11:57:10 +02:00
Sam Atkins
5384338788 LibWeb/CSS: Implement CSSUnitValue 2025-08-22 09:48:30 +01:00