LibWeb: Round to the nearest integer when interpolating integer values

This commit is contained in:
Tim Ledbetter 2025-04-11 11:09:10 +01:00
parent 8257788a20
commit 6769cc5397
3 changed files with 393 additions and 2 deletions

View file

@ -586,8 +586,13 @@ NonnullRefPtr<CSSStyleValue const> interpolate_value(DOM::Element& element, Calc
layout_node = *node;
return CSSColorValue::create_from_color(interpolate_color(from.to_color(layout_node), to.to_color(layout_node), delta), ColorSyntax::Modern);
}
case CSSStyleValue::Type::Integer:
return IntegerStyleValue::create(interpolate_raw(from.as_integer().integer(), to.as_integer().integer(), delta));
case CSSStyleValue::Type::Integer: {
// https://drafts.csswg.org/css-values/#combine-integers
// Interpolation of <integer> is defined as Vresult = round((1 - p) × VA + p × VB);
// that is, interpolation happens in the real number space as for <number>s, and the result is converted to an <integer> by rounding to the nearest integer.
auto interpolated_value = interpolate_raw(from.as_integer().value(), to.as_integer().value(), delta);
return IntegerStyleValue::create(round_to<i64>(interpolated_value));
}
case CSSStyleValue::Type::Length: {
// FIXME: Absolutize values
auto const& from_length = from.as_length().length();

View file

@ -0,0 +1,256 @@
Harness status: OK
Found 250 tests
170 Pass
80 Fail
Fail CSS Transitions: property <z-index> from neutral to [5] at (-0.3) should be [-4]
Fail CSS Transitions: property <z-index> from neutral to [5] at (0) should be [-2]
Fail CSS Transitions: property <z-index> from neutral to [5] at (0.3) should be [0]
Fail CSS Transitions: property <z-index> from neutral to [5] at (0.6) should be [2]
Pass CSS Transitions: property <z-index> from neutral to [5] at (1) should be [5]
Fail CSS Transitions: property <z-index> from neutral to [5] at (1.5) should be [9]
Fail CSS Transitions with transition: all: property <z-index> from neutral to [5] at (-0.3) should be [-4]
Fail CSS Transitions with transition: all: property <z-index> from neutral to [5] at (0) should be [-2]
Fail CSS Transitions with transition: all: property <z-index> from neutral to [5] at (0.3) should be [0]
Fail CSS Transitions with transition: all: property <z-index> from neutral to [5] at (0.6) should be [2]
Pass CSS Transitions with transition: all: property <z-index> from neutral to [5] at (1) should be [5]
Fail CSS Transitions with transition: all: property <z-index> from neutral to [5] at (1.5) should be [9]
Fail CSS Animations: property <z-index> from neutral to [5] at (-0.3) should be [-4]
Fail CSS Animations: property <z-index> from neutral to [5] at (0) should be [-2]
Fail CSS Animations: property <z-index> from neutral to [5] at (0.3) should be [0]
Fail CSS Animations: property <z-index> from neutral to [5] at (0.6) should be [2]
Pass CSS Animations: property <z-index> from neutral to [5] at (1) should be [5]
Fail CSS Animations: property <z-index> from neutral to [5] at (1.5) should be [9]
Fail Web Animations: property <z-index> from neutral to [5] at (-0.3) should be [-4]
Fail Web Animations: property <z-index> from neutral to [5] at (0) should be [-2]
Fail Web Animations: property <z-index> from neutral to [5] at (0.3) should be [0]
Fail Web Animations: property <z-index> from neutral to [5] at (0.6) should be [2]
Pass Web Animations: property <z-index> from neutral to [5] at (1) should be [5]
Fail Web Animations: property <z-index> from neutral to [5] at (1.5) should be [9]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (-0.3) should be [initial]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (0) should be [initial]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (0.3) should be [initial]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (0.5) should be [5]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (0.6) should be [5]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (1) should be [5]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [initial] to [5] at (1.5) should be [5]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (-0.3) should be [initial]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (0) should be [initial]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (0.3) should be [initial]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (0.5) should be [5]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (0.6) should be [5]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (1) should be [5]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [initial] to [5] at (1.5) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (-0.3) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (0) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (0.3) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (0.5) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (0.6) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (1) should be [5]
Pass CSS Transitions: property <z-index> from [initial] to [5] at (1.5) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (-0.3) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (0) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (0.3) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (0.5) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (0.6) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (1) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [initial] to [5] at (1.5) should be [5]
Pass CSS Animations: property <z-index> from [initial] to [5] at (-0.3) should be [initial]
Pass CSS Animations: property <z-index> from [initial] to [5] at (0) should be [initial]
Pass CSS Animations: property <z-index> from [initial] to [5] at (0.3) should be [initial]
Pass CSS Animations: property <z-index> from [initial] to [5] at (0.5) should be [5]
Pass CSS Animations: property <z-index> from [initial] to [5] at (0.6) should be [5]
Pass CSS Animations: property <z-index> from [initial] to [5] at (1) should be [5]
Pass CSS Animations: property <z-index> from [initial] to [5] at (1.5) should be [5]
Pass Web Animations: property <z-index> from [initial] to [5] at (-0.3) should be [initial]
Pass Web Animations: property <z-index> from [initial] to [5] at (0) should be [initial]
Pass Web Animations: property <z-index> from [initial] to [5] at (0.3) should be [initial]
Pass Web Animations: property <z-index> from [initial] to [5] at (0.5) should be [5]
Pass Web Animations: property <z-index> from [initial] to [5] at (0.6) should be [5]
Pass Web Animations: property <z-index> from [initial] to [5] at (1) should be [5]
Pass Web Animations: property <z-index> from [initial] to [5] at (1.5) should be [5]
Fail CSS Transitions: property <z-index> from [inherit] to [5] at (-0.3) should be [18]
Fail CSS Transitions: property <z-index> from [inherit] to [5] at (0) should be [15]
Fail CSS Transitions: property <z-index> from [inherit] to [5] at (0.3) should be [12]
Fail CSS Transitions: property <z-index> from [inherit] to [5] at (0.6) should be [9]
Pass CSS Transitions: property <z-index> from [inherit] to [5] at (1) should be [5]
Fail CSS Transitions: property <z-index> from [inherit] to [5] at (1.5) should be [0]
Fail CSS Transitions with transition: all: property <z-index> from [inherit] to [5] at (-0.3) should be [18]
Fail CSS Transitions with transition: all: property <z-index> from [inherit] to [5] at (0) should be [15]
Fail CSS Transitions with transition: all: property <z-index> from [inherit] to [5] at (0.3) should be [12]
Fail CSS Transitions with transition: all: property <z-index> from [inherit] to [5] at (0.6) should be [9]
Pass CSS Transitions with transition: all: property <z-index> from [inherit] to [5] at (1) should be [5]
Fail CSS Transitions with transition: all: property <z-index> from [inherit] to [5] at (1.5) should be [0]
Pass CSS Animations: property <z-index> from [inherit] to [5] at (-0.3) should be [18]
Pass CSS Animations: property <z-index> from [inherit] to [5] at (0) should be [15]
Pass CSS Animations: property <z-index> from [inherit] to [5] at (0.3) should be [12]
Pass CSS Animations: property <z-index> from [inherit] to [5] at (0.6) should be [9]
Pass CSS Animations: property <z-index> from [inherit] to [5] at (1) should be [5]
Pass CSS Animations: property <z-index> from [inherit] to [5] at (1.5) should be [0]
Pass Web Animations: property <z-index> from [inherit] to [5] at (-0.3) should be [18]
Pass Web Animations: property <z-index> from [inherit] to [5] at (0) should be [15]
Pass Web Animations: property <z-index> from [inherit] to [5] at (0.3) should be [12]
Pass Web Animations: property <z-index> from [inherit] to [5] at (0.6) should be [9]
Pass Web Animations: property <z-index> from [inherit] to [5] at (1) should be [5]
Pass Web Animations: property <z-index> from [inherit] to [5] at (1.5) should be [0]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (-0.3) should be [unset]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (0) should be [unset]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (0.3) should be [unset]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (0.5) should be [5]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (0.6) should be [5]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (1) should be [5]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [unset] to [5] at (1.5) should be [5]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (-0.3) should be [unset]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (0) should be [unset]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (0.3) should be [unset]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (0.5) should be [5]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (0.6) should be [5]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (1) should be [5]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [unset] to [5] at (1.5) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (-0.3) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (0) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (0.3) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (0.5) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (0.6) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (1) should be [5]
Pass CSS Transitions: property <z-index> from [unset] to [5] at (1.5) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (-0.3) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (0) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (0.3) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (0.5) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (0.6) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (1) should be [5]
Pass CSS Transitions with transition: all: property <z-index> from [unset] to [5] at (1.5) should be [5]
Pass CSS Animations: property <z-index> from [unset] to [5] at (-0.3) should be [unset]
Pass CSS Animations: property <z-index> from [unset] to [5] at (0) should be [unset]
Pass CSS Animations: property <z-index> from [unset] to [5] at (0.3) should be [unset]
Pass CSS Animations: property <z-index> from [unset] to [5] at (0.5) should be [5]
Pass CSS Animations: property <z-index> from [unset] to [5] at (0.6) should be [5]
Pass CSS Animations: property <z-index> from [unset] to [5] at (1) should be [5]
Pass CSS Animations: property <z-index> from [unset] to [5] at (1.5) should be [5]
Pass Web Animations: property <z-index> from [unset] to [5] at (-0.3) should be [unset]
Pass Web Animations: property <z-index> from [unset] to [5] at (0) should be [unset]
Pass Web Animations: property <z-index> from [unset] to [5] at (0.3) should be [unset]
Pass Web Animations: property <z-index> from [unset] to [5] at (0.5) should be [5]
Pass Web Animations: property <z-index> from [unset] to [5] at (0.6) should be [5]
Pass Web Animations: property <z-index> from [unset] to [5] at (1) should be [5]
Pass Web Animations: property <z-index> from [unset] to [5] at (1.5) should be [5]
Fail CSS Transitions: property <z-index> from [-5] to [5] at (-0.3) should be [-8]
Fail CSS Transitions: property <z-index> from [-5] to [5] at (0) should be [-5]
Fail CSS Transitions: property <z-index> from [-5] to [5] at (0.3) should be [-2]
Fail CSS Transitions: property <z-index> from [-5] to [5] at (0.6) should be [1]
Pass CSS Transitions: property <z-index> from [-5] to [5] at (1) should be [5]
Fail CSS Transitions: property <z-index> from [-5] to [5] at (1.5) should be [10]
Fail CSS Transitions with transition: all: property <z-index> from [-5] to [5] at (-0.3) should be [-8]
Fail CSS Transitions with transition: all: property <z-index> from [-5] to [5] at (0) should be [-5]
Fail CSS Transitions with transition: all: property <z-index> from [-5] to [5] at (0.3) should be [-2]
Fail CSS Transitions with transition: all: property <z-index> from [-5] to [5] at (0.6) should be [1]
Pass CSS Transitions with transition: all: property <z-index> from [-5] to [5] at (1) should be [5]
Fail CSS Transitions with transition: all: property <z-index> from [-5] to [5] at (1.5) should be [10]
Pass CSS Animations: property <z-index> from [-5] to [5] at (-0.3) should be [-8]
Pass CSS Animations: property <z-index> from [-5] to [5] at (0) should be [-5]
Pass CSS Animations: property <z-index> from [-5] to [5] at (0.3) should be [-2]
Pass CSS Animations: property <z-index> from [-5] to [5] at (0.6) should be [1]
Pass CSS Animations: property <z-index> from [-5] to [5] at (1) should be [5]
Pass CSS Animations: property <z-index> from [-5] to [5] at (1.5) should be [10]
Pass Web Animations: property <z-index> from [-5] to [5] at (-0.3) should be [-8]
Pass Web Animations: property <z-index> from [-5] to [5] at (0) should be [-5]
Pass Web Animations: property <z-index> from [-5] to [5] at (0.3) should be [-2]
Pass Web Animations: property <z-index> from [-5] to [5] at (0.6) should be [1]
Pass Web Animations: property <z-index> from [-5] to [5] at (1) should be [5]
Pass Web Animations: property <z-index> from [-5] to [5] at (1.5) should be [10]
Fail CSS Transitions: property <z-index> from [2] to [4] at (-0.3) should be [1]
Fail CSS Transitions: property <z-index> from [2] to [4] at (0) should be [2]
Fail CSS Transitions: property <z-index> from [2] to [4] at (0.3) should be [3]
Fail CSS Transitions: property <z-index> from [2] to [4] at (0.6) should be [3]
Pass CSS Transitions: property <z-index> from [2] to [4] at (1) should be [4]
Fail CSS Transitions: property <z-index> from [2] to [4] at (1.5) should be [5]
Fail CSS Transitions with transition: all: property <z-index> from [2] to [4] at (-0.3) should be [1]
Fail CSS Transitions with transition: all: property <z-index> from [2] to [4] at (0) should be [2]
Fail CSS Transitions with transition: all: property <z-index> from [2] to [4] at (0.3) should be [3]
Fail CSS Transitions with transition: all: property <z-index> from [2] to [4] at (0.6) should be [3]
Pass CSS Transitions with transition: all: property <z-index> from [2] to [4] at (1) should be [4]
Fail CSS Transitions with transition: all: property <z-index> from [2] to [4] at (1.5) should be [5]
Pass CSS Animations: property <z-index> from [2] to [4] at (-0.3) should be [1]
Pass CSS Animations: property <z-index> from [2] to [4] at (0) should be [2]
Pass CSS Animations: property <z-index> from [2] to [4] at (0.3) should be [3]
Pass CSS Animations: property <z-index> from [2] to [4] at (0.6) should be [3]
Pass CSS Animations: property <z-index> from [2] to [4] at (1) should be [4]
Pass CSS Animations: property <z-index> from [2] to [4] at (1.5) should be [5]
Pass Web Animations: property <z-index> from [2] to [4] at (-0.3) should be [1]
Pass Web Animations: property <z-index> from [2] to [4] at (0) should be [2]
Pass Web Animations: property <z-index> from [2] to [4] at (0.3) should be [3]
Pass Web Animations: property <z-index> from [2] to [4] at (0.6) should be [3]
Pass Web Animations: property <z-index> from [2] to [4] at (1) should be [4]
Pass Web Animations: property <z-index> from [2] to [4] at (1.5) should be [5]
Fail CSS Transitions: property <z-index> from [-2] to [-4] at (-0.3) should be [-1]
Fail CSS Transitions: property <z-index> from [-2] to [-4] at (0) should be [-2]
Fail CSS Transitions: property <z-index> from [-2] to [-4] at (0.1) should be [-2]
Fail CSS Transitions: property <z-index> from [-2] to [-4] at (0.3) should be [-3]
Fail CSS Transitions: property <z-index> from [-2] to [-4] at (0.6) should be [-3]
Pass CSS Transitions: property <z-index> from [-2] to [-4] at (1) should be [-4]
Fail CSS Transitions: property <z-index> from [-2] to [-4] at (1.5) should be [-5]
Fail CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (-0.3) should be [-1]
Fail CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (0) should be [-2]
Fail CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (0.1) should be [-2]
Fail CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (0.3) should be [-3]
Fail CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (0.6) should be [-3]
Pass CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (1) should be [-4]
Fail CSS Transitions with transition: all: property <z-index> from [-2] to [-4] at (1.5) should be [-5]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (-0.3) should be [-1]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (0) should be [-2]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (0.1) should be [-2]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (0.3) should be [-3]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (0.6) should be [-3]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (1) should be [-4]
Pass CSS Animations: property <z-index> from [-2] to [-4] at (1.5) should be [-5]
Pass Web Animations: property <z-index> from [-2] to [-4] at (-0.3) should be [-1]
Pass Web Animations: property <z-index> from [-2] to [-4] at (0) should be [-2]
Pass Web Animations: property <z-index> from [-2] to [-4] at (0.1) should be [-2]
Pass Web Animations: property <z-index> from [-2] to [-4] at (0.3) should be [-3]
Pass Web Animations: property <z-index> from [-2] to [-4] at (0.6) should be [-3]
Pass Web Animations: property <z-index> from [-2] to [-4] at (1) should be [-4]
Pass Web Animations: property <z-index> from [-2] to [-4] at (1.5) should be [-5]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (-0.3) should be [auto]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (0) should be [auto]
Fail CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (0.3) should be [auto]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (0.5) should be [10]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (0.6) should be [10]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (1) should be [10]
Pass CSS Transitions with transition-behavior:allow-discrete: property <z-index> from [auto] to [10] at (1.5) should be [10]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (-0.3) should be [auto]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (0) should be [auto]
Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (0.3) should be [auto]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (0.5) should be [10]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (0.6) should be [10]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (1) should be [10]
Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <z-index> from [auto] to [10] at (1.5) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (-0.3) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (0) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (0.3) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (0.5) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (0.6) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (1) should be [10]
Pass CSS Transitions: property <z-index> from [auto] to [10] at (1.5) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (-0.3) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (0) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (0.3) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (0.5) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (0.6) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (1) should be [10]
Pass CSS Transitions with transition: all: property <z-index> from [auto] to [10] at (1.5) should be [10]
Pass CSS Animations: property <z-index> from [auto] to [10] at (-0.3) should be [auto]
Pass CSS Animations: property <z-index> from [auto] to [10] at (0) should be [auto]
Pass CSS Animations: property <z-index> from [auto] to [10] at (0.3) should be [auto]
Pass CSS Animations: property <z-index> from [auto] to [10] at (0.5) should be [10]
Pass CSS Animations: property <z-index> from [auto] to [10] at (0.6) should be [10]
Pass CSS Animations: property <z-index> from [auto] to [10] at (1) should be [10]
Pass CSS Animations: property <z-index> from [auto] to [10] at (1.5) should be [10]
Pass Web Animations: property <z-index> from [auto] to [10] at (-0.3) should be [auto]
Pass Web Animations: property <z-index> from [auto] to [10] at (0) should be [auto]
Pass Web Animations: property <z-index> from [auto] to [10] at (0.3) should be [auto]
Pass Web Animations: property <z-index> from [auto] to [10] at (0.5) should be [10]
Pass Web Animations: property <z-index> from [auto] to [10] at (0.6) should be [10]
Pass Web Animations: property <z-index> from [auto] to [10] at (1) should be [10]
Pass Web Animations: property <z-index> from [auto] to [10] at (1.5) should be [10]

View file

@ -0,0 +1,130 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>z-index interpolation</title>
<link rel="help" href="https://www.w3.org/TR/CSS2/visuren.html#z-index">
<meta name="assert" content="z-index supports animation">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/interpolation-testcommon.js"></script>
<style>
body {
margin-top: 20px;
}
.layer-reference {
position: fixed;
top: 0px;
height: 100vh;
width: 50px;
background-color: rgba(255, 255, 255, 0.75);
font-family: sans-serif;
text-align: center;
padding-top: 5px;
border: 1px solid;
}
.parent {
z-index: 15;
}
.target {
position: relative;
width: 350px;
height: 10px;
z-index: -2;
}
.actual {
background-color: black;
}
.expected {
background-color: green;
}
</style>
<body></body>
<script>
test_interpolation({
property: 'z-index',
from: neutralKeyframe,
to: '5',
}, [
{at: -0.3, expect: '-4'},
{at: 0, expect: '-2'},
{at: 0.3, expect: '0'},
{at: 0.6, expect: '2'},
{at: 1, expect: '5'},
{at: 1.5, expect: '9'},
]);
test_no_interpolation({
property: 'z-index',
from: 'initial',
to: '5',
});
// We fail to inherit correctly due to style overadjustment: crbug.com/375982
test_interpolation({
property: 'z-index',
from: 'inherit',
to: '5',
}, [
{at: -0.3, expect: '18'},
{at: 0, expect: '15'},
{at: 0.3, expect: '12'},
{at: 0.6, expect: '9'},
{at: 1, expect: '5'},
{at: 1.5, expect: '0'},
]);
test_no_interpolation({
property: 'z-index',
from: 'unset',
to: '5',
});
test_interpolation({
property: 'z-index',
from: '-5',
to: '5'
}, [
{at: -0.3, expect: '-8'},
{at: 0, expect: '-5'},
{at: 0.3, expect: '-2'},
{at: 0.6, expect: '1'},
{at: 1, expect: '5'},
{at: 1.5, expect: '10'},
]);
test_interpolation({
property: 'z-index',
from: '2',
to: '4'
}, [
{at: -0.3, expect: '1'},
{at: 0, expect: '2'},
{at: 0.3, expect: '3'},
{at: 0.6, expect: '3'},
{at: 1, expect: '4'},
{at: 1.5, expect: '5'},
]);
test_interpolation({
property: 'z-index',
from: '-2',
to: '-4'
}, [
{at: -0.3, expect: '-1'},
{at: 0, expect: '-2'},
{at: 0.1, expect: '-2'},
{at: 0.3, expect: '-3'},
{at: 0.6, expect: '-3'},
{at: 1, expect: '-4'},
{at: 1.5, expect: '-5'},
]);
test_no_interpolation({
property: 'z-index',
from: 'auto',
to: '10',
});
</script>