Title: [235843] trunk
Revision
235843
Author
[email protected]
Date
2018-09-10 00:13:19 -0700 (Mon, 10 Sep 2018)

Log Message

[Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
https://bugs.webkit.org/show_bug.cgi?id=189405
<rdar://problem/43342639>

Reviewed by Simon Fraser.

Source/WebCore:

Test: webanimations/accelerated-transition-interrupted-on-composited-element.html

If we interrupt an animation on an element that is composited also outside of the duration of the animation,
the "stop" accelerated action would fail to be performed because we no longer had a resolved current time and
the accelerated animation applied to the layer would never be removed.

However, having a resolved current time is not necessary to stop an animation, only for the other types of
actions (play, pause and seek). So we now simply default to a 0s time for an unresolved current time for a
simple fix to this issue.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):

LayoutTests:

Add a new test that checks that interrupting a CSS transition targeting an accelerated property for an element
that is composited outside the duration of the transition correctly interrupts the animation and jumps straight
to the target value.

* platform/win/TestExpectations:
* webanimations/accelerated-transition-interrupted-on-composited-element-expected.html: Added.
* webanimations/accelerated-transition-interrupted-on-composited-element.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235842 => 235843)


--- trunk/LayoutTests/ChangeLog	2018-09-10 05:37:06 UTC (rev 235842)
+++ trunk/LayoutTests/ChangeLog	2018-09-10 07:13:19 UTC (rev 235843)
@@ -1,3 +1,19 @@
+2018-09-10  Antoine Quint  <[email protected]>
+
+        [Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
+        https://bugs.webkit.org/show_bug.cgi?id=189405
+        <rdar://problem/43342639>
+
+        Reviewed by Simon Fraser.
+
+        Add a new test that checks that interrupting a CSS transition targeting an accelerated property for an element
+        that is composited outside the duration of the transition correctly interrupts the animation and jumps straight
+        to the target value.
+
+        * platform/win/TestExpectations:
+        * webanimations/accelerated-transition-interrupted-on-composited-element-expected.html: Added.
+        * webanimations/accelerated-transition-interrupted-on-composited-element.html: Added.
+
 2018-09-08  Wenson Hsieh  <[email protected]>
 
         REGRESSION (r235153): [iOS] Can't move selection start grabber when selecting text in a subframe

Modified: trunk/LayoutTests/platform/win/TestExpectations (235842 => 235843)


--- trunk/LayoutTests/platform/win/TestExpectations	2018-09-10 05:37:06 UTC (rev 235842)
+++ trunk/LayoutTests/platform/win/TestExpectations	2018-09-10 07:13:19 UTC (rev 235843)
@@ -4143,6 +4143,8 @@
 webkit.org/b/188166 webanimations/setting-css-animation-none-after-clearing-effect.html [ Failure ]
 webkit.org/b/188166 webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html [ Failure ]
 
+webkit.org/b/189468 webanimations/accelerated-transition-interrupted-on-composited-element.html [ Failure ]
+
 webkit.org/b/188167 fast/repaint/canvas-object-fit.html [ Failure ]
 
 webkit.org/b/188168 fast/text/complex-first-glyph-with-initial-advance.html [ ImageOnlyFailure ]

Added: trunk/LayoutTests/webanimations/accelerated-transition-interrupted-on-composited-element-expected.html (0 => 235843)


--- trunk/LayoutTests/webanimations/accelerated-transition-interrupted-on-composited-element-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-transition-interrupted-on-composited-element-expected.html	2018-09-10 07:13:19 UTC (rev 235843)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<body>
+<style>
+div {
+    width: 100px;
+    height: 100px;
+    background-color: black;
+    will-change: transform;
+    transform: translateX(100px);
+}
+</style>
+<div></div>
+</body>

Added: trunk/LayoutTests/webanimations/accelerated-transition-interrupted-on-composited-element.html (0 => 235843)


--- trunk/LayoutTests/webanimations/accelerated-transition-interrupted-on-composited-element.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/accelerated-transition-interrupted-on-composited-element.html	2018-09-10 07:13:19 UTC (rev 235843)
@@ -0,0 +1,32 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableWebAnimationsCSSIntegration=true ] -->
+<body>
+<style>
+div {
+    width: 100px;
+    height: 100px;
+    background-color: black;
+    will-change: transform;
+}
+</style>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+const div = document.body.appendChild(document.createElement("div"));
+
+// Wait for a transition to start and abort it.
+div.addEventListener("transitionstart", event => {
+    div.style.transition = "none";
+    if (window.testRunner)
+        requestAnimationFrame(() => testRunner.notifyDone());
+});
+
+// Initiate a transform transition.
+setTimeout(() => {
+    div.style.transition = "transform 2s";
+    div.style.transform = "translateX(100px)";
+});
+
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (235842 => 235843)


--- trunk/Source/WebCore/ChangeLog	2018-09-10 05:37:06 UTC (rev 235842)
+++ trunk/Source/WebCore/ChangeLog	2018-09-10 07:13:19 UTC (rev 235843)
@@ -1,3 +1,24 @@
+2018-09-10  Antoine Quint  <[email protected]>
+
+        [Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
+        https://bugs.webkit.org/show_bug.cgi?id=189405
+        <rdar://problem/43342639>
+
+        Reviewed by Simon Fraser.
+
+        Test: webanimations/accelerated-transition-interrupted-on-composited-element.html
+
+        If we interrupt an animation on an element that is composited also outside of the duration of the animation,
+        the "stop" accelerated action would fail to be performed because we no longer had a resolved current time and
+        the accelerated animation applied to the layer would never be removed.
+
+        However, having a resolved current time is not necessary to stop an animation, only for the other types of
+        actions (play, pause and seek). So we now simply default to a 0s time for an unresolved current time for a
+        simple fix to this issue.
+
+        * animation/KeyframeEffectReadOnly.cpp:
+        (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
+
 2018-09-09  Fujii Hironori  <[email protected]>
 
         Add specialized template declarations of HashTraits and DefaultHash to detect misuse

Modified: trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp (235842 => 235843)


--- trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp	2018-09-10 05:37:06 UTC (rev 235842)
+++ trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp	2018-09-10 07:13:19 UTC (rev 235843)
@@ -1278,11 +1278,8 @@
 
     auto* compositedRenderer = downcast<RenderBoxModelObject>(renderer);
 
-    auto currentTime = animation()->currentTime();
-    if (!currentTime)
-        return;
-
-    auto timeOffset = currentTime->seconds();
+    // 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();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to