Title: [255504] trunk
Revision
255504
Author
grao...@webkit.org
Date
2020-01-31 09:58:19 -0800 (Fri, 31 Jan 2020)

Log Message

[Web Animations] [WK1] REGRESSION: opacity doesn't animate
https://bugs.webkit.org/show_bug.cgi?id=207044
<rdar://problem/59061225>

Reviewed by Simon Fraser.

Source/WebCore:

Test: webanimations/opacity-animation.html

We failed to animate opacity in WK1 because we made the assumption that just because an animation targets only accelerated properties it would be accelerated
and wouldn't need to be updated as it runs in WebAnimation::timeToNextTick(). This is incorrect, an animation may fail to start or may fail to get a composited
layer, the latter being the case on WK1 because usesCompositing() is false in RenderLayerCompositor::requiresCompositingForAnimation().

We now check that an animation is both only animating accelerated properties and running accelerated to determine that an animation won't need to be updated
until it completes.

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

LayoutTests:

* webanimations/opacity-animation-expected.html: Added.
* webanimations/opacity-animation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (255503 => 255504)


--- trunk/LayoutTests/ChangeLog	2020-01-31 17:54:21 UTC (rev 255503)
+++ trunk/LayoutTests/ChangeLog	2020-01-31 17:58:19 UTC (rev 255504)
@@ -1,3 +1,14 @@
+2020-01-31  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] [WK1] REGRESSION: opacity doesn't animate
+        https://bugs.webkit.org/show_bug.cgi?id=207044
+        <rdar://problem/59061225>
+
+        Reviewed by Simon Fraser.
+
+        * webanimations/opacity-animation-expected.html: Added.
+        * webanimations/opacity-animation.html: Added.
+
 2020-01-31  Matt Lewis  <jlew...@apple.com>
 
         Layout Test imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html is a Flaky Failure on mac

Added: trunk/LayoutTests/webanimations/opacity-animation-expected.html (0 => 255504)


--- trunk/LayoutTests/webanimations/opacity-animation-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/opacity-animation-expected.html	2020-01-31 17:58:19 UTC (rev 255504)
@@ -0,0 +1 @@
+<div style="position: absolute; top: 0; left: 0; width: 100px; height: 100px; background-color: black; opacity: 0.5;"></div>

Added: trunk/LayoutTests/webanimations/opacity-animation.html (0 => 255504)


--- trunk/LayoutTests/webanimations/opacity-animation.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/opacity-animation.html	2020-01-31 17:58:19 UTC (rev 255504)
@@ -0,0 +1,19 @@
+<div style="position: absolute; top: 0; left: 0; width: 100px; height: 100px; background-color: black;"></div>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+const animation = document.querySelector("div").animate([
+    { opacity: 0 },
+    { opacity: 0.5, offset: 0.001 },
+    { opacity: 0.5 }
+], 1000);
+
+if (window.testRunner) {
+    animation.ready.then(() => {
+        setTimeout(() => testRunner.notifyDone(), 100);
+    });
+}
+
+</script>

Modified: trunk/Source/WebCore/ChangeLog (255503 => 255504)


--- trunk/Source/WebCore/ChangeLog	2020-01-31 17:54:21 UTC (rev 255503)
+++ trunk/Source/WebCore/ChangeLog	2020-01-31 17:58:19 UTC (rev 255504)
@@ -1,3 +1,23 @@
+2020-01-31  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] [WK1] REGRESSION: opacity doesn't animate
+        https://bugs.webkit.org/show_bug.cgi?id=207044
+        <rdar://problem/59061225>
+
+        Reviewed by Simon Fraser.
+
+        Test: webanimations/opacity-animation.html
+
+        We failed to animate opacity in WK1 because we made the assumption that just because an animation targets only accelerated properties it would be accelerated
+        and wouldn't need to be updated as it runs in WebAnimation::timeToNextTick(). This is incorrect, an animation may fail to start or may fail to get a composited
+        layer, the latter being the case on WK1 because usesCompositing() is false in RenderLayerCompositor::requiresCompositingForAnimation().
+
+        We now check that an animation is both only animating accelerated properties and running accelerated to determine that an animation won't need to be updated
+        until it completes.
+
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::timeToNextTick const):
+
 2020-01-31  Cathie Chen  <cathiec...@igalia.com>
 
         Asynchronous scrolling of overflow element can enter a recursive loop

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (255503 => 255504)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2020-01-31 17:54:21 UTC (rev 255503)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2020-01-31 17:58:19 UTC (rev 255504)
@@ -1444,16 +1444,17 @@
         // The animation is in its "before" phase, in this case we can wait until it enters its "active" phase.
         return (effect.delay() - timing.localTime.value()) / playbackRate;
     case AnimationEffectPhase::Active:
-        // Non-accelerated animations in the "active" phase will need to update their animated value at the immediate next opportunity.
-        if (!isCompletelyAccelerated())
-            return 0_s;
-        // Accelerated CSS Animations need to trigger "animationiteration" events, in this case we can wait until the next iteration.
-        if (isCSSAnimation()) {
-            if (auto iterationProgress = effect.getComputedTiming().simpleIterationProgress)
-                return effect.iterationDuration() * (1 - *iterationProgress);
+        if (isCompletelyAccelerated() && isRunningAccelerated()) {
+            // Fully-accelerated running CSS Animations need to trigger "animationiteration" events, in this case we must wait until the next iteration.
+            if (isCSSAnimation()) {
+                if (auto iterationProgress = effect.getComputedTiming().simpleIterationProgress)
+                    return effect.iterationDuration() * (1 - *iterationProgress);
+            }
+            // Fully-accelerated running animations in the "active" phase can wait until they ended.
+            return (effect.endTime() - timing.localTime.value()) / playbackRate;
         }
-        // Accelerated animations in the "active" phase can wait until they ended.
-        return (effect.endTime() - timing.localTime.value()) / playbackRate;
+        // Other animations in the "active" phase will need to update their animated value at the immediate next opportunity.
+        return 0_s;
     case AnimationEffectPhase::After:
         // The animation is in its after phase, which means it will no longer update its value, so it doens't need a tick.
         return Seconds::infinity();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to