LibWeb: Use discrete interpolation for degenerate ratios
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, 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

Degenerate ratios cannot be interpolated.
This commit is contained in:
Tim Ledbetter 2025-04-11 09:59:25 +01:00 committed by Sam Atkins
parent b3980d40f7
commit f07a3fe6da
Notes: github-actions[bot] 2025-04-11 10:39:08 +00:00
3 changed files with 387 additions and 0 deletions

View file

@ -616,6 +616,11 @@ NonnullRefPtr<CSSStyleValue const> interpolate_value(DOM::Element& element, Calc
auto from_ratio = from.as_ratio().ratio();
auto to_ratio = to.as_ratio().ratio();
// https://drafts.csswg.org/css-values/#combine-ratio
// If either <ratio> is degenerate, the values cannot be interpolated.
if (from_ratio.is_degenerate() || to_ratio.is_degenerate())
return delta >= 0.5f ? to : from;
// The interpolation of a <ratio> is defined by converting each <ratio> to a number by dividing the first value
// by the second (so a ratio of 3 / 2 would become 1.5), taking the logarithm of that result (so the 1.5 would
// become approximately 0.176), then interpolating those values. The result during the interpolation is

View file

@ -0,0 +1,252 @@
Harness status: OK
Found 246 tests
184 Pass
62 Fail
Fail CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
Fail CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
Fail CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
Fail CSS Transitions: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
Pass CSS Animations: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
Pass CSS Animations: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
Pass CSS Animations: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
Pass Web Animations: property <aspect-ratio> from [0.5] to [2] at (-0.5) should be [0.25 / 1]
Pass Web Animations: property <aspect-ratio> from [0.5] to [2] at (0) should be [0.5 / 1]
Pass Web Animations: property <aspect-ratio> from [0.5] to [2] at (0.5) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [0.5] to [2] at (1) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [0.5] to [2] at (1.5) should be [4 / 1]
Fail CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
Fail CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
Fail CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
Fail CSS Transitions: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (-0.5) should be [0.25 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0) should be [0.5 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (0.5) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 2] to [2 / 1] at (1.5) should be [4 / 1]
Fail CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (-0.5) should be [0.25 / 1]
Fail CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (0) should be [0.5 / 1]
Fail CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (1) should be [2 / 1]
Fail CSS Transitions: property <aspect-ratio> from [] to [2 / 1] at (1.5) should be [4 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (-0.5) should be [0.25 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (0) should be [0.5 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (1) should be [2 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [] to [2 / 1] at (1.5) should be [4 / 1]
Fail CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (-0.5) should be [0.25 / 1]
Fail CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (0) should be [0.5 / 1]
Fail CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (0.5) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (1) should be [2 / 1]
Fail CSS Animations: property <aspect-ratio> from [] to [2 / 1] at (1.5) should be [4 / 1]
Fail CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
Fail CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
Fail CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
Fail CSS Transitions: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
Fail CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (-0.5) should be [auto 0.25 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0) should be [auto 0.5 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (0.5) should be [auto 1 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1) should be [auto 2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 2] to [auto 2 / 1] at (1.5) should be [auto 4 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [auto]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [auto]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [auto]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [auto]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [auto]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [auto]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [auto]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [auto]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [auto]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (-0.3) should be [auto]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0) should be [auto]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.3) should be [auto]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.5) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (0.6) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto] to [2 / 1] at (1.5) should be [2 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [auto 1 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [auto 1 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [auto 1 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [auto 1 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [auto 1 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [auto 1 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [auto 1 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [auto 1 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [auto 1 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
Pass CSS Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (-0.3) should be [auto 1 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0) should be [auto 1 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.3) should be [auto 1 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.5) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (0.6) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1) should be [2 / 1]
Pass Web Animations: property <aspect-ratio> from [auto 1 / 1] to [2 / 1] at (1.5) should be [2 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 0]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 0]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 0]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 0]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 0]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 0]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 0]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 0]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 0]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (-0.3) should be [1 / 0]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0) should be [1 / 0]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.3) should be [1 / 0]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.5) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (0.6) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 0] to [1 / 1] at (1.5) should be [1 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [1 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [1 / 1]
Fail CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [1 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
Pass CSS Transitions with transition-behavior:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [1 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [1 / 1]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [1 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
Pass CSS Transitions: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
Pass CSS Transitions with transition: all: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [1 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
Pass CSS Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (-0.3) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.3) should be [1 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.5) should be [0 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (0.6) should be [0 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1) should be [0 / 1]
Pass Web Animations: property <aspect-ratio> from [1 / 1] to [0 / 1] at (1.5) should be [0 / 1]
Pass Compositing: property <aspect-ratio> underlying [2 / 1] from replace [0.5 / 1] to add [1 / 1] at (0) should be [0.5 / 1]
Fail Compositing: property <aspect-ratio> underlying [2 / 1] from replace [0.5 / 1] to add [1 / 1] at (0.5) should be [1 / 1]
Fail Compositing: property <aspect-ratio> underlying [2 / 1] from replace [0.5 / 1] to add [1 / 1] at (1) should be [2 / 1]

View file

@ -0,0 +1,130 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>aspect-ratio interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
<meta name="assert" content="aspect-ratio supports animation">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/interpolation-testcommon.js"></script>
<style>
.target {
font-size: 16px;
background-color: black;
width: 10px;
aspect-ratio: 0.5;
}
</style>
<body>
<template id="target-template">
<div class="container">
<div class="target"></div>
</div>
</template>
</body>
<script>
test_interpolation({
property: 'aspect-ratio',
from: '0.5',
to: '2',
}, [
{at: -0.5, expect: '0.25 / 1'},
{at: 0, expect: '0.5 / 1'},
{at: 0.5, expect: '1 / 1'},
{at: 1, expect: '2 / 1'},
{at: 1.5, expect: '4 / 1'}
]);
test_interpolation({
property: 'aspect-ratio',
from: '1 / 2',
to: '2 / 1',
}, [
{at: -0.5, expect: '0.25 / 1'},
{at: 0, expect: '0.5 / 1'},
{at: 0.5, expect: '1 / 1'},
{at: 1, expect: '2 / 1'},
{at: 1.5, expect: '4 / 1'}
]);
// Test neutral keyframe
test_interpolation({
property: 'aspect-ratio',
from: '',
to: '2 / 1',
}, [
{at: -0.5, expect: '0.25 / 1'},
{at: 0, expect: '0.5 / 1'},
{at: 0.5, expect: '1 / 1'},
{at: 1, expect: '2 / 1'},
{at: 1.5, expect: '4 / 1'}
]);
test_interpolation({
property: 'aspect-ratio',
from: 'auto 1 / 2',
to: 'auto 2 / 1',
}, [
{at: -0.5, expect: 'auto 0.25 / 1'},
{at: 0, expect: 'auto 0.5 / 1'},
{at: 0.5, expect: 'auto 1 / 1'},
{at: 1, expect: 'auto 2 / 1'},
{at: 1.5, expect: 'auto 4 / 1'}
]);
test_no_interpolation({
property: 'aspect-ratio',
from: 'auto',
to: '2 / 1',
});
test_no_interpolation({
property: 'aspect-ratio',
from: 'auto 1 / 1',
to: '2 / 1',
});
// If either number in the ratio is 0 or infinite, it represents a degenerate
// ratio and will not be interpolated:
// https://drafts.csswg.org/css-values-4/#combine-ratio
test_no_interpolation({
property: 'aspect-ratio',
from: '1 / 0',
to: '1 / 1',
});
test_no_interpolation({
property: 'aspect-ratio',
from: '1 / 1',
to: '0 / 1',
});
// Addition of <ratio>s is not possible.
// https://drafts.csswg.org/css-values/#combine-ratio
//
// And if a value type does not define a specific procedure for addition or is
// defined as not additive, its addition operation is simply Vresult = Va.
// (The first value is Va, the second value is Vb, and the result is Vresult.)
// https://drafts.csswg.org/css-values-4/#not-additive,
//
// So in this test case:
// 1. The 1st keyframe: { aspectRatio: 0.5/1, composite: 'replace', offset: 0 }
// 2. The 2nd keyframe: { aspectRatio: 1/1, composite: 'add', offset: 1 }
// and the underlying value is 2/1. Based on the spec, the composited from_value
// is 0.5/1 (because we just replace it), and the composited to_value is 2/1
// (because we use Va as the result value).
test_composition({
property: 'aspect-ratio',
underlying: '2 / 1',
replaceFrom: '0.5 / 1',
addTo: '1 / 1',
}, [
{at: 0, expect: '0.5 / 1'},
{at: 0.5, expect: '1 / 1'},
{at: 1, expect: '2 / 1'}
]);
</script>
</body>