Skip to content

Truly independent web browser

LibWeb: Space keyframes without offsets evenly between their neighbors

Tim Ledbetter11d93c38fff6
diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cpp
index d3eb107ed3e..391a1b0aa4d 100644
--- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp
+++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp
@@ -310,7 +310,7 @@ void compute_missing_keyframe_offsets(Vector<BaseKeyframe>& keyframes)
auto index = static_cast<double>(keyframe_index - index_a);
// 4. Set the computed keyframe offset of keyframe to offsetA + (offsetB − offsetA) × index / n.
- keyframes[keyframe_index].computed_offset = (offset_a + (offset_b - offset_a)) * index / n;
+ keyframes[keyframe_index].computed_offset = offset_a + (offset_b - offset_a) * index / n;
}
index_a = index_b;
diff --git a/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/Animatable/animate.txt b/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/Animatable/animate.txt
index dc0d0010a44..758c1b3b3b6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/Animatable/animate.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/Animatable/animate.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 153 tests
-141 Pass
-12 Fail
+144 Pass
+9 Fail
Pass Element.animate() creates an Animation object
Pass Element.animate() creates an Animation object in the relevant realm of the target element
Pass Element.animate() creates an Animation object with a KeyframeEffect
@@ -26,7 +26,7 @@ Pass Element.animate() accepts a one property one non-array value property-index
Pass Element.animate() accepts a one property two value property-indexed keyframes specification where the first value is invalid
Pass Element.animate() accepts a one property two value property-indexed keyframes specification where the second value is invalid
Pass Element.animate() accepts a property-indexed keyframes specification with a CSS variable as the property
-Fail Element.animate() accepts a property-indexed keyframe with a single offset
+Pass Element.animate() accepts a property-indexed keyframe with a single offset
Pass Element.animate() accepts a property-indexed keyframe with an array of offsets
Pass Element.animate() accepts a property-indexed keyframe with an array of offsets that is too short
Pass Element.animate() accepts a property-indexed keyframe with an array of offsets that is too long
@@ -68,9 +68,9 @@ Pass Element.animate() accepts a single keyframe sequence with omitted offset
Fail Element.animate() accepts a single keyframe sequence with null offset
Pass Element.animate() accepts a single keyframe sequence with string offset
Fail Element.animate() accepts a single keyframe sequence with a single calc() offset
-Fail Element.animate() accepts a one property keyframe sequence with some omitted offsets
+Pass Element.animate() accepts a one property keyframe sequence with some omitted offsets
Fail Element.animate() accepts a one property keyframe sequence with some null offsets
-Fail Element.animate() accepts a two property keyframe sequence with some omitted offsets
+Pass Element.animate() accepts a two property keyframe sequence with some omitted offsets
Pass Element.animate() accepts a one property keyframe sequence with all omitted offsets
Pass Element.animate() accepts a keyframe sequence with different easing values, but the same easing value for a given offset
Pass Element.animate() accepts a keyframe sequence with different composite values, but the same composite value for a given offset
diff --git a/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/constructor.txt b/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/constructor.txt
index 8d029a36dd1..724794903fe 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/constructor.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/constructor.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 175 tests
-121 Pass
-54 Fail
+124 Pass
+51 Fail
Pass A KeyframeEffect can be constructed with no frames
Pass easing values are parsed correctly when passed to the KeyframeEffect constructor in KeyframeEffectOptions
Pass Invalid easing values are correctly rejected when passed to the KeyframeEffect constructor in KeyframeEffectOptions
@@ -40,7 +40,7 @@ Pass A KeyframeEffect can be constructed with a one property two value property-
Fail A KeyframeEffect constructed with a one property two value property-indexed keyframes specification where the second value is invalid roundtrips
Pass A KeyframeEffect can be constructed with a property-indexed keyframes specification with a CSS variable as the property
Fail A KeyframeEffect constructed with a property-indexed keyframes specification with a CSS variable as the property roundtrips
-Fail A KeyframeEffect can be constructed with a property-indexed keyframe with a single offset
+Pass A KeyframeEffect can be constructed with a property-indexed keyframe with a single offset
Fail A KeyframeEffect constructed with a property-indexed keyframe with a single offset roundtrips
Pass A KeyframeEffect can be constructed with a property-indexed keyframe with an array of offsets
Pass A KeyframeEffect constructed with a property-indexed keyframe with an array of offsets roundtrips
@@ -124,11 +124,11 @@ Pass A KeyframeEffect can be constructed with a single keyframe sequence with st
Pass A KeyframeEffect constructed with a single keyframe sequence with string offset roundtrips
Fail A KeyframeEffect can be constructed with a single keyframe sequence with a single calc() offset
Fail A KeyframeEffect constructed with a single keyframe sequence with a single calc() offset roundtrips
-Fail A KeyframeEffect can be constructed with a one property keyframe sequence with some omitted offsets
+Pass A KeyframeEffect can be constructed with a one property keyframe sequence with some omitted offsets
Fail A KeyframeEffect constructed with a one property keyframe sequence with some omitted offsets roundtrips
Fail A KeyframeEffect can be constructed with a one property keyframe sequence with some null offsets
Fail A KeyframeEffect constructed with a one property keyframe sequence with some null offsets roundtrips
-Fail A KeyframeEffect can be constructed with a two property keyframe sequence with some omitted offsets
+Pass A KeyframeEffect can be constructed with a two property keyframe sequence with some omitted offsets
Fail A KeyframeEffect constructed with a two property keyframe sequence with some omitted offsets roundtrips
Pass A KeyframeEffect can be constructed with a one property keyframe sequence with all omitted offsets
Fail A KeyframeEffect constructed with a one property keyframe sequence with all omitted offsets roundtrips
diff --git a/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/setKeyframes.txt b/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/setKeyframes.txt
index d9b4713defa..f7ee624cc3e 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/setKeyframes.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/web-animations/interfaces/KeyframeEffect/setKeyframes.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 80 tests
-69 Pass
-11 Fail
+72 Pass
+8 Fail
Pass Keyframes can be replaced with an empty keyframe
Pass Keyframes can be replaced with a one property two value property-indexed keyframes specification
Pass Keyframes can be replaced with a one shorthand property two value property-indexed keyframes specification
@@ -20,7 +20,7 @@ Pass Keyframes can be replaced with a one property one non-array value property-
Pass Keyframes can be replaced with a one property two value property-indexed keyframes specification where the first value is invalid
Pass Keyframes can be replaced with a one property two value property-indexed keyframes specification where the second value is invalid
Pass Keyframes can be replaced with a property-indexed keyframes specification with a CSS variable as the property
-Fail Keyframes can be replaced with a property-indexed keyframe with a single offset
+Pass Keyframes can be replaced with a property-indexed keyframe with a single offset
Pass Keyframes can be replaced with a property-indexed keyframe with an array of offsets
Pass Keyframes can be replaced with a property-indexed keyframe with an array of offsets that is too short
Pass Keyframes can be replaced with a property-indexed keyframe with an array of offsets that is too long
@@ -62,9 +62,9 @@ Pass Keyframes can be replaced with a single keyframe sequence with omitted offs
Fail Keyframes can be replaced with a single keyframe sequence with null offset
Pass Keyframes can be replaced with a single keyframe sequence with string offset
Fail Keyframes can be replaced with a single keyframe sequence with a single calc() offset
-Fail Keyframes can be replaced with a one property keyframe sequence with some omitted offsets
+Pass Keyframes can be replaced with a one property keyframe sequence with some omitted offsets
Fail Keyframes can be replaced with a one property keyframe sequence with some null offsets
-Fail Keyframes can be replaced with a two property keyframe sequence with some omitted offsets
+Pass Keyframes can be replaced with a two property keyframe sequence with some omitted offsets
Pass Keyframes can be replaced with a one property keyframe sequence with all omitted offsets
Pass Keyframes can be replaced with a keyframe sequence with different easing values, but the same easing value for a given offset
Pass Keyframes can be replaced with a keyframe sequence with different composite values, but the same composite value for a given offset