diff --git a/Libraries/LibWeb/CSS/Interpolation.cpp b/Libraries/LibWeb/CSS/Interpolation.cpp index de84c8345d8..282c2795c6f 100644 --- a/Libraries/LibWeb/CSS/Interpolation.cpp +++ b/Libraries/LibWeb/CSS/Interpolation.cpp @@ -586,8 +586,13 @@ NonnullRefPtr 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 is defined as Vresult = round((1 - p) × VA + p × VB); + // that is, interpolation happens in the real number space as for s, and the result is converted to an 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(interpolated_value)); + } case CSSStyleValue::Type::Length: { // FIXME: Absolutize values auto const& from_length = from.as_length().length(); diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt new file mode 100644 index 00000000000..c434b34d0ce --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt @@ -0,0 +1,256 @@ +Harness status: OK + +Found 250 tests + +170 Pass +80 Fail +Fail CSS Transitions: property from neutral to [5] at (-0.3) should be [-4] +Fail CSS Transitions: property from neutral to [5] at (0) should be [-2] +Fail CSS Transitions: property from neutral to [5] at (0.3) should be [0] +Fail CSS Transitions: property from neutral to [5] at (0.6) should be [2] +Pass CSS Transitions: property from neutral to [5] at (1) should be [5] +Fail CSS Transitions: property from neutral to [5] at (1.5) should be [9] +Fail CSS Transitions with transition: all: property from neutral to [5] at (-0.3) should be [-4] +Fail CSS Transitions with transition: all: property from neutral to [5] at (0) should be [-2] +Fail CSS Transitions with transition: all: property from neutral to [5] at (0.3) should be [0] +Fail CSS Transitions with transition: all: property from neutral to [5] at (0.6) should be [2] +Pass CSS Transitions with transition: all: property from neutral to [5] at (1) should be [5] +Fail CSS Transitions with transition: all: property from neutral to [5] at (1.5) should be [9] +Fail CSS Animations: property from neutral to [5] at (-0.3) should be [-4] +Fail CSS Animations: property from neutral to [5] at (0) should be [-2] +Fail CSS Animations: property from neutral to [5] at (0.3) should be [0] +Fail CSS Animations: property from neutral to [5] at (0.6) should be [2] +Pass CSS Animations: property from neutral to [5] at (1) should be [5] +Fail CSS Animations: property from neutral to [5] at (1.5) should be [9] +Fail Web Animations: property from neutral to [5] at (-0.3) should be [-4] +Fail Web Animations: property from neutral to [5] at (0) should be [-2] +Fail Web Animations: property from neutral to [5] at (0.3) should be [0] +Fail Web Animations: property from neutral to [5] at (0.6) should be [2] +Pass Web Animations: property from neutral to [5] at (1) should be [5] +Fail Web Animations: property from neutral to [5] at (1.5) should be [9] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (-0.3) should be [initial] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (0) should be [initial] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (0.3) should be [initial] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (0.5) should be [5] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (0.6) should be [5] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (1) should be [5] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (1.5) should be [5] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (-0.3) should be [initial] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (0) should be [initial] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (0.3) should be [initial] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (0.5) should be [5] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (0.6) should be [5] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (1) should be [5] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [initial] to [5] at (1.5) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (-0.3) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (0) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (0.3) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (0.5) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (0.6) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (1) should be [5] +Pass CSS Transitions: property from [initial] to [5] at (1.5) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (-0.3) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (0) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (0.3) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (0.5) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (0.6) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (1) should be [5] +Pass CSS Transitions with transition: all: property from [initial] to [5] at (1.5) should be [5] +Pass CSS Animations: property from [initial] to [5] at (-0.3) should be [initial] +Pass CSS Animations: property from [initial] to [5] at (0) should be [initial] +Pass CSS Animations: property from [initial] to [5] at (0.3) should be [initial] +Pass CSS Animations: property from [initial] to [5] at (0.5) should be [5] +Pass CSS Animations: property from [initial] to [5] at (0.6) should be [5] +Pass CSS Animations: property from [initial] to [5] at (1) should be [5] +Pass CSS Animations: property from [initial] to [5] at (1.5) should be [5] +Pass Web Animations: property from [initial] to [5] at (-0.3) should be [initial] +Pass Web Animations: property from [initial] to [5] at (0) should be [initial] +Pass Web Animations: property from [initial] to [5] at (0.3) should be [initial] +Pass Web Animations: property from [initial] to [5] at (0.5) should be [5] +Pass Web Animations: property from [initial] to [5] at (0.6) should be [5] +Pass Web Animations: property from [initial] to [5] at (1) should be [5] +Pass Web Animations: property from [initial] to [5] at (1.5) should be [5] +Fail CSS Transitions: property from [inherit] to [5] at (-0.3) should be [18] +Fail CSS Transitions: property from [inherit] to [5] at (0) should be [15] +Fail CSS Transitions: property from [inherit] to [5] at (0.3) should be [12] +Fail CSS Transitions: property from [inherit] to [5] at (0.6) should be [9] +Pass CSS Transitions: property from [inherit] to [5] at (1) should be [5] +Fail CSS Transitions: property from [inherit] to [5] at (1.5) should be [0] +Fail CSS Transitions with transition: all: property from [inherit] to [5] at (-0.3) should be [18] +Fail CSS Transitions with transition: all: property from [inherit] to [5] at (0) should be [15] +Fail CSS Transitions with transition: all: property from [inherit] to [5] at (0.3) should be [12] +Fail CSS Transitions with transition: all: property from [inherit] to [5] at (0.6) should be [9] +Pass CSS Transitions with transition: all: property from [inherit] to [5] at (1) should be [5] +Fail CSS Transitions with transition: all: property from [inherit] to [5] at (1.5) should be [0] +Pass CSS Animations: property from [inherit] to [5] at (-0.3) should be [18] +Pass CSS Animations: property from [inherit] to [5] at (0) should be [15] +Pass CSS Animations: property from [inherit] to [5] at (0.3) should be [12] +Pass CSS Animations: property from [inherit] to [5] at (0.6) should be [9] +Pass CSS Animations: property from [inherit] to [5] at (1) should be [5] +Pass CSS Animations: property from [inherit] to [5] at (1.5) should be [0] +Pass Web Animations: property from [inherit] to [5] at (-0.3) should be [18] +Pass Web Animations: property from [inherit] to [5] at (0) should be [15] +Pass Web Animations: property from [inherit] to [5] at (0.3) should be [12] +Pass Web Animations: property from [inherit] to [5] at (0.6) should be [9] +Pass Web Animations: property from [inherit] to [5] at (1) should be [5] +Pass Web Animations: property from [inherit] to [5] at (1.5) should be [0] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (-0.3) should be [unset] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (0) should be [unset] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (0.3) should be [unset] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (0.5) should be [5] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (0.6) should be [5] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (1) should be [5] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [unset] to [5] at (1.5) should be [5] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (-0.3) should be [unset] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (0) should be [unset] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (0.3) should be [unset] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (0.5) should be [5] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (0.6) should be [5] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (1) should be [5] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [unset] to [5] at (1.5) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (-0.3) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (0) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (0.3) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (0.5) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (0.6) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (1) should be [5] +Pass CSS Transitions: property from [unset] to [5] at (1.5) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (-0.3) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (0) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (0.3) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (0.5) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (0.6) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (1) should be [5] +Pass CSS Transitions with transition: all: property from [unset] to [5] at (1.5) should be [5] +Pass CSS Animations: property from [unset] to [5] at (-0.3) should be [unset] +Pass CSS Animations: property from [unset] to [5] at (0) should be [unset] +Pass CSS Animations: property from [unset] to [5] at (0.3) should be [unset] +Pass CSS Animations: property from [unset] to [5] at (0.5) should be [5] +Pass CSS Animations: property from [unset] to [5] at (0.6) should be [5] +Pass CSS Animations: property from [unset] to [5] at (1) should be [5] +Pass CSS Animations: property from [unset] to [5] at (1.5) should be [5] +Pass Web Animations: property from [unset] to [5] at (-0.3) should be [unset] +Pass Web Animations: property from [unset] to [5] at (0) should be [unset] +Pass Web Animations: property from [unset] to [5] at (0.3) should be [unset] +Pass Web Animations: property from [unset] to [5] at (0.5) should be [5] +Pass Web Animations: property from [unset] to [5] at (0.6) should be [5] +Pass Web Animations: property from [unset] to [5] at (1) should be [5] +Pass Web Animations: property from [unset] to [5] at (1.5) should be [5] +Fail CSS Transitions: property from [-5] to [5] at (-0.3) should be [-8] +Fail CSS Transitions: property from [-5] to [5] at (0) should be [-5] +Fail CSS Transitions: property from [-5] to [5] at (0.3) should be [-2] +Fail CSS Transitions: property from [-5] to [5] at (0.6) should be [1] +Pass CSS Transitions: property from [-5] to [5] at (1) should be [5] +Fail CSS Transitions: property from [-5] to [5] at (1.5) should be [10] +Fail CSS Transitions with transition: all: property from [-5] to [5] at (-0.3) should be [-8] +Fail CSS Transitions with transition: all: property from [-5] to [5] at (0) should be [-5] +Fail CSS Transitions with transition: all: property from [-5] to [5] at (0.3) should be [-2] +Fail CSS Transitions with transition: all: property from [-5] to [5] at (0.6) should be [1] +Pass CSS Transitions with transition: all: property from [-5] to [5] at (1) should be [5] +Fail CSS Transitions with transition: all: property from [-5] to [5] at (1.5) should be [10] +Pass CSS Animations: property from [-5] to [5] at (-0.3) should be [-8] +Pass CSS Animations: property from [-5] to [5] at (0) should be [-5] +Pass CSS Animations: property from [-5] to [5] at (0.3) should be [-2] +Pass CSS Animations: property from [-5] to [5] at (0.6) should be [1] +Pass CSS Animations: property from [-5] to [5] at (1) should be [5] +Pass CSS Animations: property from [-5] to [5] at (1.5) should be [10] +Pass Web Animations: property from [-5] to [5] at (-0.3) should be [-8] +Pass Web Animations: property from [-5] to [5] at (0) should be [-5] +Pass Web Animations: property from [-5] to [5] at (0.3) should be [-2] +Pass Web Animations: property from [-5] to [5] at (0.6) should be [1] +Pass Web Animations: property from [-5] to [5] at (1) should be [5] +Pass Web Animations: property from [-5] to [5] at (1.5) should be [10] +Fail CSS Transitions: property from [2] to [4] at (-0.3) should be [1] +Fail CSS Transitions: property from [2] to [4] at (0) should be [2] +Fail CSS Transitions: property from [2] to [4] at (0.3) should be [3] +Fail CSS Transitions: property from [2] to [4] at (0.6) should be [3] +Pass CSS Transitions: property from [2] to [4] at (1) should be [4] +Fail CSS Transitions: property from [2] to [4] at (1.5) should be [5] +Fail CSS Transitions with transition: all: property from [2] to [4] at (-0.3) should be [1] +Fail CSS Transitions with transition: all: property from [2] to [4] at (0) should be [2] +Fail CSS Transitions with transition: all: property from [2] to [4] at (0.3) should be [3] +Fail CSS Transitions with transition: all: property from [2] to [4] at (0.6) should be [3] +Pass CSS Transitions with transition: all: property from [2] to [4] at (1) should be [4] +Fail CSS Transitions with transition: all: property from [2] to [4] at (1.5) should be [5] +Pass CSS Animations: property from [2] to [4] at (-0.3) should be [1] +Pass CSS Animations: property from [2] to [4] at (0) should be [2] +Pass CSS Animations: property from [2] to [4] at (0.3) should be [3] +Pass CSS Animations: property from [2] to [4] at (0.6) should be [3] +Pass CSS Animations: property from [2] to [4] at (1) should be [4] +Pass CSS Animations: property from [2] to [4] at (1.5) should be [5] +Pass Web Animations: property from [2] to [4] at (-0.3) should be [1] +Pass Web Animations: property from [2] to [4] at (0) should be [2] +Pass Web Animations: property from [2] to [4] at (0.3) should be [3] +Pass Web Animations: property from [2] to [4] at (0.6) should be [3] +Pass Web Animations: property from [2] to [4] at (1) should be [4] +Pass Web Animations: property from [2] to [4] at (1.5) should be [5] +Fail CSS Transitions: property from [-2] to [-4] at (-0.3) should be [-1] +Fail CSS Transitions: property from [-2] to [-4] at (0) should be [-2] +Fail CSS Transitions: property from [-2] to [-4] at (0.1) should be [-2] +Fail CSS Transitions: property from [-2] to [-4] at (0.3) should be [-3] +Fail CSS Transitions: property from [-2] to [-4] at (0.6) should be [-3] +Pass CSS Transitions: property from [-2] to [-4] at (1) should be [-4] +Fail CSS Transitions: property from [-2] to [-4] at (1.5) should be [-5] +Fail CSS Transitions with transition: all: property from [-2] to [-4] at (-0.3) should be [-1] +Fail CSS Transitions with transition: all: property from [-2] to [-4] at (0) should be [-2] +Fail CSS Transitions with transition: all: property from [-2] to [-4] at (0.1) should be [-2] +Fail CSS Transitions with transition: all: property from [-2] to [-4] at (0.3) should be [-3] +Fail CSS Transitions with transition: all: property from [-2] to [-4] at (0.6) should be [-3] +Pass CSS Transitions with transition: all: property from [-2] to [-4] at (1) should be [-4] +Fail CSS Transitions with transition: all: property from [-2] to [-4] at (1.5) should be [-5] +Pass CSS Animations: property from [-2] to [-4] at (-0.3) should be [-1] +Pass CSS Animations: property from [-2] to [-4] at (0) should be [-2] +Pass CSS Animations: property from [-2] to [-4] at (0.1) should be [-2] +Pass CSS Animations: property from [-2] to [-4] at (0.3) should be [-3] +Pass CSS Animations: property from [-2] to [-4] at (0.6) should be [-3] +Pass CSS Animations: property from [-2] to [-4] at (1) should be [-4] +Pass CSS Animations: property from [-2] to [-4] at (1.5) should be [-5] +Pass Web Animations: property from [-2] to [-4] at (-0.3) should be [-1] +Pass Web Animations: property from [-2] to [-4] at (0) should be [-2] +Pass Web Animations: property from [-2] to [-4] at (0.1) should be [-2] +Pass Web Animations: property from [-2] to [-4] at (0.3) should be [-3] +Pass Web Animations: property from [-2] to [-4] at (0.6) should be [-3] +Pass Web Animations: property from [-2] to [-4] at (1) should be [-4] +Pass Web Animations: property from [-2] to [-4] at (1.5) should be [-5] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (-0.3) should be [auto] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (0) should be [auto] +Fail CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (0.3) should be [auto] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (0.5) should be [10] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (0.6) should be [10] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (1) should be [10] +Pass CSS Transitions with transition-behavior:allow-discrete: property from [auto] to [10] at (1.5) should be [10] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (-0.3) should be [auto] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (0) should be [auto] +Fail CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (0.3) should be [auto] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (0.5) should be [10] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (0.6) should be [10] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (1) should be [10] +Pass CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property from [auto] to [10] at (1.5) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (-0.3) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (0) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (0.3) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (0.5) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (0.6) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (1) should be [10] +Pass CSS Transitions: property from [auto] to [10] at (1.5) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (-0.3) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (0) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (0.3) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (0.5) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (0.6) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (1) should be [10] +Pass CSS Transitions with transition: all: property from [auto] to [10] at (1.5) should be [10] +Pass CSS Animations: property from [auto] to [10] at (-0.3) should be [auto] +Pass CSS Animations: property from [auto] to [10] at (0) should be [auto] +Pass CSS Animations: property from [auto] to [10] at (0.3) should be [auto] +Pass CSS Animations: property from [auto] to [10] at (0.5) should be [10] +Pass CSS Animations: property from [auto] to [10] at (0.6) should be [10] +Pass CSS Animations: property from [auto] to [10] at (1) should be [10] +Pass CSS Animations: property from [auto] to [10] at (1.5) should be [10] +Pass Web Animations: property from [auto] to [10] at (-0.3) should be [auto] +Pass Web Animations: property from [auto] to [10] at (0) should be [auto] +Pass Web Animations: property from [auto] to [10] at (0.3) should be [auto] +Pass Web Animations: property from [auto] to [10] at (0.5) should be [10] +Pass Web Animations: property from [auto] to [10] at (0.6) should be [10] +Pass Web Animations: property from [auto] to [10] at (1) should be [10] +Pass Web Animations: property from [auto] to [10] at (1.5) should be [10] \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-transitions/animations/z-index-interpolation.html b/Tests/LibWeb/Text/input/wpt-import/css/css-transitions/animations/z-index-interpolation.html new file mode 100644 index 00000000000..c7614536950 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-transitions/animations/z-index-interpolation.html @@ -0,0 +1,130 @@ + + +z-index interpolation + + + + + + + + + + + +