Title: [235854] trunk
Revision
235854
Author
[email protected]
Date
2018-09-10 12:05:31 -0700 (Mon, 10 Sep 2018)

Log Message

[Web Animations] Positive delays of accelerated animations are not respected
https://bugs.webkit.org/show_bug.cgi?id=189411
<rdar://problem/44151416>

Reviewed by Dean Jackson.

Source/WebCore:

Test: webanimations/accelerated-animation-with-delay-and-seek.html

We were only accounting for negative delays for accelerated actions. We also were misbehaving
when seeking an animation with a delay (positive or negative) since we wouldn't reset the animation
begin time to be the current time when adjusting its time offset, while the begin time set when
first creating the animation would be set accounting for the time offset.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::seekCAAnimationOnLayer):

LayoutTests:

Add a test that checks that positive delays are accounted for during accelerated actions, including a seek.

* webanimations/accelerated-animation-with-delay-and-seek-expected.html: Added.
* webanimations/accelerated-animation-with-delay-and-seek.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235853 => 235854)


--- trunk/LayoutTests/ChangeLog	2018-09-10 18:30:28 UTC (rev 235853)
+++ trunk/LayoutTests/ChangeLog	2018-09-10 19:05:31 UTC (rev 235854)
@@ -1,3 +1,16 @@
+2018-09-10  Antoine Quint  <[email protected]>
+
+        [Web Animations] Positive delays of accelerated animations are not respected
+        https://bugs.webkit.org/show_bug.cgi?id=189411
+        <rdar://problem/44151416>
+
+        Reviewed by Dean Jackson.
+
+        Add a test that checks that positive delays are accounted for during accelerated actions, including a seek.
+
+        * webanimations/accelerated-animation-with-delay-and-seek-expected.html: Added.
+        * webanimations/accelerated-animation-with-delay-and-seek.html: Added.
+
 2018-09-10  Per Arne Vollan  <[email protected]>
 
         [Windows] Layout Test webanimations/accelerated-transition-interrupted-on-composited-element.html is failing

Added: trunk/LayoutTests/webanimations/accelerated-animation-with-delay-and-seek-expected.html (0 => 235854)


--- trunk/LayoutTests/webanimations/accelerated-animation-with-delay-and-seek-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-animation-with-delay-and-seek-expected.html	2018-09-10 19:05:31 UTC (rev 235854)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+    position: absolute;
+    width: 100px;
+    height: 100px;
+    transform: translateX(50px);
+    background-color: black;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>

Added: trunk/LayoutTests/webanimations/accelerated-animation-with-delay-and-seek.html (0 => 235854)


--- trunk/LayoutTests/webanimations/accelerated-animation-with-delay-and-seek.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-animation-with-delay-and-seek.html	2018-09-10 19:05:31 UTC (rev 235854)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+
+div {
+    position: absolute;
+    width: 100px;
+    height: 100px;
+    background-color: black;
+}
+
+</style>
+</head>
+<body>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+const animation = document.body.appendChild(document.createElement("div")).animate({
+    transform: ["translateX(100px)", "none"]
+}, { duration: 10000, delay: 1000 });
+
+requestAnimationFrame(() => {
+    animation.pause();
+    animation.currentTime = 6000;
+    if (window.testRunner)
+        requestAnimationFrame(() => testRunner.notifyDone());
+});
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (235853 => 235854)


--- trunk/Source/WebCore/ChangeLog	2018-09-10 18:30:28 UTC (rev 235853)
+++ trunk/Source/WebCore/ChangeLog	2018-09-10 19:05:31 UTC (rev 235854)
@@ -1,3 +1,23 @@
+2018-09-10  Antoine Quint  <[email protected]>
+
+        [Web Animations] Positive delays of accelerated animations are not respected
+        https://bugs.webkit.org/show_bug.cgi?id=189411
+        <rdar://problem/44151416>
+
+        Reviewed by Dean Jackson.
+
+        Test: webanimations/accelerated-animation-with-delay-and-seek.html
+
+        We were only accounting for negative delays for accelerated actions. We also were misbehaving
+        when seeking an animation with a delay (positive or negative) since we wouldn't reset the animation
+        begin time to be the current time when adjusting its time offset, while the begin time set when
+        first creating the animation would be set accounting for the time offset.
+
+        * animation/KeyframeEffectReadOnly.cpp:
+        (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer):
+
 2018-09-10  Yusuke Suzuki  <[email protected]>
 
         [WTF] Add Markable<T, Traits>

Modified: trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp (235853 => 235854)


--- trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp	2018-09-10 18:30:28 UTC (rev 235853)
+++ trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp	2018-09-10 19:05:31 UTC (rev 235854)
@@ -1279,9 +1279,7 @@
     auto* compositedRenderer = downcast<RenderBoxModelObject>(renderer);
 
     // To simplify the code we use a default of 0s for an unresolved current time since for a Stop action that is acceptable.
-    auto timeOffset = animation()->currentTime().value_or(0_s).seconds();
-    if (timing()->delay() < 0_s)
-        timeOffset = -timing()->delay().seconds();
+    auto timeOffset = animation()->currentTime().value_or(0_s).seconds() - timing()->delay().seconds();
 
     for (const auto& action : pendingAcceleratedActions) {
         switch (action) {

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (235853 => 235854)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2018-09-10 18:30:28 UTC (rev 235853)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2018-09-10 19:05:31 UTC (rev 235854)
@@ -2972,6 +2972,7 @@
     // Animations on the layer are immutable, so we have to clone and modify.
     RefPtr<PlatformCAAnimation> newAnim = currentAnimation->copy();
 
+    newAnim->setBeginTime(CACurrentMediaTime());
     newAnim->setTimeOffset(timeOffset.seconds());
 
     layer->addAnimationForKey(animationID, *newAnim); // This will replace the running animation.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to