Title: [256339] branches/safari-609.1.17.0-branch
Revision
256339
Author
repst...@apple.com
Date
2020-02-11 12:48:52 -0800 (Tue, 11 Feb 2020)

Log Message

Cherry-pick r255810. rdar://problem/59349189

    [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing
    https://bugs.webkit.org/show_bug.cgi?id=207253
    <rdar://problem/59143624>

    Reviewed by Antti Koivisto.

    Source/WebCore:

    Test: webanimations/accelerated-animation-canceled-before-commit.html

    Merely checking whether an accelerated animation is running prior to enqueuing an action to cancel it is not sufficient
    since there could be an uncommitted change to start it upon the next animation frame. The same logic would need to apply
    in other situations where the playback state changes for a potentially in-flight animation.

    * animation/KeyframeEffect.cpp:
    (WebCore::KeyframeEffect::animationDidSeek):
    (WebCore::KeyframeEffect::animationWasCanceled):
    (WebCore::KeyframeEffect::willChangeRenderer):
    (WebCore::KeyframeEffect::animationSuspensionStateDidChange):

    LayoutTests:

    Add a new test that checks that an accelerated animation that has been enqueued to start but has
    not yet been committed is correctly canceled when the cancel() method is called. This test fails
    prior to this source change.

    * webanimations/accelerated-animation-canceled-before-commit-expected.html: Added.
    * webanimations/accelerated-animation-canceled-before-commit.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255810 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-609.1.17.0-branch/LayoutTests/ChangeLog (256338 => 256339)


--- branches/safari-609.1.17.0-branch/LayoutTests/ChangeLog	2020-02-11 20:48:49 UTC (rev 256338)
+++ branches/safari-609.1.17.0-branch/LayoutTests/ChangeLog	2020-02-11 20:48:52 UTC (rev 256339)
@@ -1,5 +1,55 @@
 2020-02-11  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r255810. rdar://problem/59349189
+
+    [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing
+    https://bugs.webkit.org/show_bug.cgi?id=207253
+    <rdar://problem/59143624>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    Test: webanimations/accelerated-animation-canceled-before-commit.html
+    
+    Merely checking whether an accelerated animation is running prior to enqueuing an action to cancel it is not sufficient
+    since there could be an uncommitted change to start it upon the next animation frame. The same logic would need to apply
+    in other situations where the playback state changes for a potentially in-flight animation.
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::animationDidSeek):
+    (WebCore::KeyframeEffect::animationWasCanceled):
+    (WebCore::KeyframeEffect::willChangeRenderer):
+    (WebCore::KeyframeEffect::animationSuspensionStateDidChange):
+    
+    LayoutTests:
+    
+    Add a new test that checks that an accelerated animation that has been enqueued to start but has
+    not yet been committed is correctly canceled when the cancel() method is called. This test fails
+    prior to this source change.
+    
+    * webanimations/accelerated-animation-canceled-before-commit-expected.html: Added.
+    * webanimations/accelerated-animation-canceled-before-commit.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-05  Antoine Quint  <grao...@apple.com>
+
+            [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing
+            https://bugs.webkit.org/show_bug.cgi?id=207253
+            <rdar://problem/59143624>
+
+            Reviewed by Antti Koivisto.
+
+            Add a new test that checks that an accelerated animation that has been enqueued to start but has
+            not yet been committed is correctly canceled when the cancel() method is called. This test fails
+            prior to this source change.
+
+            * webanimations/accelerated-animation-canceled-before-commit-expected.html: Added.
+            * webanimations/accelerated-animation-canceled-before-commit.html: Added.
+
+2020-02-11  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r255663. rdar://problem/59349185
 
     Accelerated animations freeze on render tree rebuild

Added: branches/safari-609.1.17.0-branch/LayoutTests/webanimations/accelerated-animation-canceled-before-commit-expected.html (0 => 256339)


--- branches/safari-609.1.17.0-branch/LayoutTests/webanimations/accelerated-animation-canceled-before-commit-expected.html	                        (rev 0)
+++ branches/safari-609.1.17.0-branch/LayoutTests/webanimations/accelerated-animation-canceled-before-commit-expected.html	2020-02-11 20:48:52 UTC (rev 256339)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+#target {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100px;
+    height: 100px;
+    background-color: black;
+}
+
+</style>
+</head>
+<body>
+<div id="target"></div>
+</body>
+</html>

Added: branches/safari-609.1.17.0-branch/LayoutTests/webanimations/accelerated-animation-canceled-before-commit.html (0 => 256339)


--- branches/safari-609.1.17.0-branch/LayoutTests/webanimations/accelerated-animation-canceled-before-commit.html	                        (rev 0)
+++ branches/safari-609.1.17.0-branch/LayoutTests/webanimations/accelerated-animation-canceled-before-commit.html	2020-02-11 20:48:52 UTC (rev 256339)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+#target {
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100px;
+    height: 100px;
+    background-color: black;
+    will-change: transform;
+}
+
+</style>
+</head>
+<body>
+<div id="target"></div>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+const animation = document.getElementById("target").animate({ transform: ["translateX(50px)", "translateX(100px)"] }, 1000);
+
+// Wait until the animation is ready which means the action to play an accelerated animation has been enqueued by now, but not commmitted.
+animation.ready.then(() => {
+    // Cancel the animation, this should cancel the uncommitted accelerated animation.
+    animation.cancel();
+    if (window.testRunner)
+        testRunner.notifyDone();
+});
+
+</script>
+</body>
+</html>

Modified: branches/safari-609.1.17.0-branch/Source/WebCore/ChangeLog (256338 => 256339)


--- branches/safari-609.1.17.0-branch/Source/WebCore/ChangeLog	2020-02-11 20:48:49 UTC (rev 256338)
+++ branches/safari-609.1.17.0-branch/Source/WebCore/ChangeLog	2020-02-11 20:48:52 UTC (rev 256339)
@@ -1,5 +1,60 @@
 2020-02-11  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r255810. rdar://problem/59349189
+
+    [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing
+    https://bugs.webkit.org/show_bug.cgi?id=207253
+    <rdar://problem/59143624>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    Test: webanimations/accelerated-animation-canceled-before-commit.html
+    
+    Merely checking whether an accelerated animation is running prior to enqueuing an action to cancel it is not sufficient
+    since there could be an uncommitted change to start it upon the next animation frame. The same logic would need to apply
+    in other situations where the playback state changes for a potentially in-flight animation.
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::animationDidSeek):
+    (WebCore::KeyframeEffect::animationWasCanceled):
+    (WebCore::KeyframeEffect::willChangeRenderer):
+    (WebCore::KeyframeEffect::animationSuspensionStateDidChange):
+    
+    LayoutTests:
+    
+    Add a new test that checks that an accelerated animation that has been enqueued to start but has
+    not yet been committed is correctly canceled when the cancel() method is called. This test fails
+    prior to this source change.
+    
+    * webanimations/accelerated-animation-canceled-before-commit-expected.html: Added.
+    * webanimations/accelerated-animation-canceled-before-commit.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-05  Antoine Quint  <grao...@apple.com>
+
+            [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing
+            https://bugs.webkit.org/show_bug.cgi?id=207253
+            <rdar://problem/59143624>
+
+            Reviewed by Antti Koivisto.
+
+            Test: webanimations/accelerated-animation-canceled-before-commit.html
+
+            Merely checking whether an accelerated animation is running prior to enqueuing an action to cancel it is not sufficient
+            since there could be an uncommitted change to start it upon the next animation frame. The same logic would need to apply
+            in other situations where the playback state changes for a potentially in-flight animation.
+
+            * animation/KeyframeEffect.cpp:
+            (WebCore::KeyframeEffect::animationDidSeek):
+            (WebCore::KeyframeEffect::animationWasCanceled):
+            (WebCore::KeyframeEffect::willChangeRenderer):
+            (WebCore::KeyframeEffect::animationSuspensionStateDidChange):
+
+2020-02-11  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r255663. rdar://problem/59349185
 
     Accelerated animations freeze on render tree rebuild

Modified: branches/safari-609.1.17.0-branch/Source/WebCore/animation/KeyframeEffect.cpp (256338 => 256339)


--- branches/safari-609.1.17.0-branch/Source/WebCore/animation/KeyframeEffect.cpp	2020-02-11 20:48:49 UTC (rev 256338)
+++ branches/safari-609.1.17.0-branch/Source/WebCore/animation/KeyframeEffect.cpp	2020-02-11 20:48:52 UTC (rev 256339)
@@ -1382,25 +1382,25 @@
 {
     // There is no need to seek if we're not playing an animation already. If seeking
     // means we're moving into an active lexicalGlobalObject, we'll pick this up in apply().
-    if (m_isRunningAccelerated)
+    if (m_isRunningAccelerated || isAboutToRunAccelerated())
         addPendingAcceleratedAction(AcceleratedAction::Seek);
 }
 
 void KeyframeEffect::animationWasCanceled()
 {
-    if (m_isRunningAccelerated)
+    if (m_isRunningAccelerated || isAboutToRunAccelerated())
         addPendingAcceleratedAction(AcceleratedAction::Stop);
 }
 
 void KeyframeEffect::willChangeRenderer()
 {
-    if (m_isRunningAccelerated)
+    if (m_isRunningAccelerated || isAboutToRunAccelerated())
         addPendingAcceleratedAction(AcceleratedAction::Stop);
 }
 
 void KeyframeEffect::animationSuspensionStateDidChange(bool animationIsSuspended)
 {
-    if (m_isRunningAccelerated)
+    if (m_isRunningAccelerated || isAboutToRunAccelerated())
         addPendingAcceleratedAction(animationIsSuspended ? AcceleratedAction::Pause : AcceleratedAction::Play);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to