Title: [260360] trunk
Revision
260360
Author
grao...@webkit.org
Date
2020-04-20 04:56:55 -0700 (Mon, 20 Apr 2020)

Log Message

WebAnimations API doesn't properly apply keyframe easings to transforms
https://bugs.webkit.org/show_bug.cgi?id=210526
<rdar://problem/61800424>

Reviewed by Antti Koivisto.

Source/WebCore:

GraphicsLayerCA has code that determines whether an animation can be accelerated looking at the timing function of its keyframes and excluding
animations that use a steps timing function as one of its values. However, we we would fail to set the timing function on the KeyframeValue for
each keyframe in the KeyframeList we create for a JS-originated animation. We now do this correctly.

Test: webanimations/transform-animation-with-steps-timing-function-not-accelerated.html

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::updateBlendingKeyframes):

LayoutTests:

Add a new test that checks that an animation targeting an accelerted property does not yield an accelerated animation if one of its keyframes contains a steps timing function.

* webanimations/transform-animation-with-steps-timing-function-not-accelerated-expected.txt: Added.
* webanimations/transform-animation-with-steps-timing-function-not-accelerated.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260359 => 260360)


--- trunk/LayoutTests/ChangeLog	2020-04-20 10:22:53 UTC (rev 260359)
+++ trunk/LayoutTests/ChangeLog	2020-04-20 11:56:55 UTC (rev 260360)
@@ -1,3 +1,16 @@
+2020-04-20  Antoine Quint  <grao...@apple.com>
+
+        WebAnimations API doesn't properly apply keyframe easings to transforms
+        https://bugs.webkit.org/show_bug.cgi?id=210526
+        <rdar://problem/61800424>
+
+        Reviewed by Antti Koivisto.
+
+        Add a new test that checks that an animation targeting an accelerted property does not yield an accelerated animation if one of its keyframes contains a steps timing function.
+
+        * webanimations/transform-animation-with-steps-timing-function-not-accelerated-expected.txt: Added.
+        * webanimations/transform-animation-with-steps-timing-function-not-accelerated.html: Added.
+
 2020-04-20  Yusuke Suzuki  <ysuz...@apple.com>
 
         StructuredClone algorithm should be aware of BigInt

Added: trunk/LayoutTests/webanimations/transform-animation-with-steps-timing-function-not-accelerated-expected.txt (0 => 260360)


--- trunk/LayoutTests/webanimations/transform-animation-with-steps-timing-function-not-accelerated-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webanimations/transform-animation-with-steps-timing-function-not-accelerated-expected.txt	2020-04-20 11:56:55 UTC (rev 260360)
@@ -0,0 +1,3 @@
+
+PASS An animation targeting an accelerated property should not be accelerated if it uses a steps timing function in one of its keyframes. 
+

Added: trunk/LayoutTests/webanimations/transform-animation-with-steps-timing-function-not-accelerated.html (0 => 260360)


--- trunk/LayoutTests/webanimations/transform-animation-with-steps-timing-function-not-accelerated.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/transform-animation-with-steps-timing-function-not-accelerated.html	2020-04-20 11:56:55 UTC (rev 260360)
@@ -0,0 +1,27 @@
+<script src=""
+<script src=""
+<div style="position: absolute; top: 0; left: 0; width: 100px; height: 100px; background-color: black;"></div>
+<script>
+
+async_test(t => {
+
+    const target = document.querySelector("div");
+    const animation = target.animate([
+        { transform: "translateY(0px)", easing: "step-start" },
+        { transform: "translateY(100px)", easing: "step-start" },
+        { transform: "translateY(0px)" }
+    ], 60 * 1000);
+
+    animation.ready.then(() => {
+        // We wait for two frames to ensure an accelerated animation would have been committed.
+        requestAnimationFrame(() => {
+            requestAnimationFrame(() => {
+                assert_equals(internals.acceleratedAnimationsForElement(target).length, 0, "The animation's target has no accelerated animation.");
+                t.done();
+            });
+        });
+    });
+
+}, "An animation targeting an accelerated property should not be accelerated if it uses a steps timing function in one of its keyframes.");
+
+</script>

Modified: trunk/Source/WebCore/ChangeLog (260359 => 260360)


--- trunk/Source/WebCore/ChangeLog	2020-04-20 10:22:53 UTC (rev 260359)
+++ trunk/Source/WebCore/ChangeLog	2020-04-20 11:56:55 UTC (rev 260360)
@@ -1,3 +1,20 @@
+2020-04-20  Antoine Quint  <grao...@apple.com>
+
+        WebAnimations API doesn't properly apply keyframe easings to transforms
+        https://bugs.webkit.org/show_bug.cgi?id=210526
+        <rdar://problem/61800424>
+
+        Reviewed by Antti Koivisto.
+
+        GraphicsLayerCA has code that determines whether an animation can be accelerated looking at the timing function of its keyframes and excluding
+        animations that use a steps timing function as one of its values. However, we we would fail to set the timing function on the KeyframeValue for
+        each keyframe in the KeyframeList we create for a JS-originated animation. We now do this correctly.
+
+        Test: webanimations/transform-animation-with-steps-timing-function-not-accelerated.html
+
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::updateBlendingKeyframes):
+
 2020-04-20  Yusuke Suzuki  <ysuz...@apple.com>
 
         StructuredClone algorithm should be aware of BigInt

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (260359 => 260360)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2020-04-20 10:22:53 UTC (rev 260359)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2020-04-20 11:56:55 UTC (rev 260360)
@@ -770,6 +770,7 @@
 
     for (auto& keyframe : m_parsedKeyframes) {
         KeyframeValue keyframeValue(keyframe.computedOffset, nullptr);
+        keyframeValue.setTimingFunction(keyframe.timingFunction->clone());
 
         auto styleProperties = keyframe.style->immutableCopyIfNeeded();
         for (unsigned i = 0; i < styleProperties->propertyCount(); ++i)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to