Title: [256623] trunk
Revision
256623
Author
commit-qu...@webkit.org
Date
2020-02-14 10:29:47 -0800 (Fri, 14 Feb 2020)

Log Message

Ensure animations that lose their effect don't schedule an animation update
https://bugs.webkit.org/show_bug.cgi?id=207713
rdar://59174840

Patch by Sunny He <sunny...@apple.com> on 2020-02-14
Reviewed by Antoine Quint.

Source/WebCore:
An active animation for which the effect is removed may be considered for
an upcoming animation resolution. However, WebAnimation::timeToNextTick()
expects a valid effect to be available to be able to determine timing.
We now check an animation is relevant before calling timeToNextTick() and
add an ASSERT() in that function to catch cases where an animation effect
might not be available.

Source/WebCore:

Test: webanimations/animation-null-effect.html

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::scheduleNextTick):
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::timeToNextTick const):

LayoutTests:

* webanimations/animation-null-effect-expected.txt: Added.
* webanimations/animation-null-effect.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (256622 => 256623)


--- trunk/LayoutTests/ChangeLog	2020-02-14 18:23:41 UTC (rev 256622)
+++ trunk/LayoutTests/ChangeLog	2020-02-14 18:29:47 UTC (rev 256623)
@@ -1,3 +1,22 @@
+2020-02-14  Sunny He  <sunny...@apple.com>
+
+        Ensure animations that lose their effect don't schedule an animation update
+        https://bugs.webkit.org/show_bug.cgi?id=207713
+        rdar://59174840
+
+        Reviewed by Antoine Quint.
+
+        Source/WebCore:
+        An active animation for which the effect is removed may be considered for
+        an upcoming animation resolution. However, WebAnimation::timeToNextTick()
+        expects a valid effect to be available to be able to determine timing.
+        We now check an animation is relevant before calling timeToNextTick() and
+        add an ASSERT() in that function to catch cases where an animation effect
+        might not be available.
+
+        * webanimations/animation-null-effect-expected.txt: Added.
+        * webanimations/animation-null-effect.html: Added.
+
 2020-02-14  Charles Turner  <ctur...@igalia.com>
 
         [EME][GStreamer] REGRESSION(r256429): Several encrypted-media tests are crashing or failing

Added: trunk/LayoutTests/webanimations/animation-null-effect-expected.txt (0 => 256623)


--- trunk/LayoutTests/webanimations/animation-null-effect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webanimations/animation-null-effect-expected.txt	2020-02-14 18:29:47 UTC (rev 256623)
@@ -0,0 +1,3 @@
+Ensure removing the effect from an active animation is handled correctly.
+
+PASS if test does not crash.

Added: trunk/LayoutTests/webanimations/animation-null-effect.html (0 => 256623)


--- trunk/LayoutTests/webanimations/animation-null-effect.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/animation-null-effect.html	2020-02-14 18:29:47 UTC (rev 256623)
@@ -0,0 +1,16 @@
+<script>
+    if (window.testRunner) {
+        window.testRunner.dumpAsText();
+    }
+    function eventhandler() {
+        var animation = element.animate({ "padding-left": [0, 1] }, 0.5);
+        animation.reverse();
+        animation.effect = null;
+    }
+    window.requestAnimationFrame(eventhandler);
+</script>
+<body>
+    <div id="element"></div>
+    <p>Ensure removing the effect from an active animation is handled correctly.</p>
+    <p>PASS if test does not crash.</p>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (256622 => 256623)


--- trunk/Source/WebCore/ChangeLog	2020-02-14 18:23:41 UTC (rev 256622)
+++ trunk/Source/WebCore/ChangeLog	2020-02-14 18:29:47 UTC (rev 256623)
@@ -1,3 +1,26 @@
+2020-02-14  Sunny He  <sunny...@apple.com>
+
+        Ensure animations that lose their effect don't schedule an animation update
+        https://bugs.webkit.org/show_bug.cgi?id=207713
+        rdar://59174840
+
+        Reviewed by Antoine Quint.
+
+        Source/WebCore:
+        An active animation for which the effect is removed may be considered for
+        an upcoming animation resolution. However, WebAnimation::timeToNextTick()
+        expects a valid effect to be available to be able to determine timing.
+        We now check an animation is relevant before calling timeToNextTick() and
+        add an ASSERT() in that function to catch cases where an animation effect
+        might not be available.
+
+        Test: webanimations/animation-null-effect.html
+
+        * animation/DocumentTimeline.cpp:
+        (WebCore::DocumentTimeline::scheduleNextTick):
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::timeToNextTick const):
+
 2020-02-14  Sihui Liu  <sihui_...@apple.com>
 
         IndexedDB: prefetch cursor records on client side

Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (256622 => 256623)


--- trunk/Source/WebCore/animation/DocumentTimeline.cpp	2020-02-14 18:23:41 UTC (rev 256622)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp	2020-02-14 18:29:47 UTC (rev 256623)
@@ -569,6 +569,8 @@
     Seconds scheduleDelay = Seconds::infinity();
 
     for (const auto& animation : m_animations) {
+        if (!animation->isRelevant())
+            continue;
         auto animationTimeToNextRequiredTick = animation->timeToNextTick();
         if (animationTimeToNextRequiredTick < animationInterval()) {
             scheduleAnimationResolution();

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (256622 => 256623)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2020-02-14 18:23:41 UTC (rev 256622)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2020-02-14 18:29:47 UTC (rev 256623)
@@ -1445,6 +1445,8 @@
 
 Seconds WebAnimation::timeToNextTick() const
 {
+    ASSERT(effect());
+
     if (pending())
         return 0_s;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to