Title: [273656] trunk
Revision
273656
Author
[email protected]
Date
2021-03-01 10:47:02 -0800 (Mon, 01 Mar 2021)

Log Message

REGRESSION(r272004): transform transition with delay doesn't behave correctly
https://bugs.webkit.org/show_bug.cgi?id=222545
<rdar://problem/74865413>

Reviewed by Dean Jackson.

Source/WebCore:

To support accelerated animations of individual transform properties, we introduced the notion of
non-interpolating animations to apply the underlying value for a given property before applying
the actual animations for this property with additivity set to true.

These non-interpolating animations were meant to last between the time at which animations were
committed and the effective start of the first animation for that property, accounting for any
delay.

However, we neglected to handle the case where that first animation had a fill mode that would
make it fill backwards, such as CSS Transitions. In that situation, the animation would have
its first keyframe applied on top of the underlying value, effectively applying the underlying
value twice with additivity.

We now only add these non-interpolating animations if the first animation has a delay and does
not fill backwards.

Test: webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateAnimations):

LayoutTests:

Add a new test where an element with a non-identity transform starts a transform transition with a
long delay. Prior to this patch, this test failed because, while in the delay phase, the transition
would mean the underlying transform was applied twice: once by the non-interpolating animation
generated for the underlying "transform" value, and once by the first keyframe of the transition
since it fills backwards.

* webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html: Added.
* webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (273655 => 273656)


--- trunk/LayoutTests/ChangeLog	2021-03-01 18:21:45 UTC (rev 273655)
+++ trunk/LayoutTests/ChangeLog	2021-03-01 18:47:02 UTC (rev 273656)
@@ -1,3 +1,20 @@
+2021-03-01  Antoine Quint  <[email protected]>
+
+        REGRESSION(r272004): transform transition with delay doesn't behave correctly
+        https://bugs.webkit.org/show_bug.cgi?id=222545
+        <rdar://problem/74865413>
+
+        Reviewed by Dean Jackson.
+
+        Add a new test where an element with a non-identity transform starts a transform transition with a
+        long delay. Prior to this patch, this test failed because, while in the delay phase, the transition
+        would mean the underlying transform was applied twice: once by the non-interpolating animation
+        generated for the underlying "transform" value, and once by the first keyframe of the transition
+        since it fills backwards.
+
+        * webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html: Added.
+        * webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html: Added.
+
 2021-03-01  Chris Gambrell  <[email protected]>
 
         [LayoutTests] Convert http/tests/fetch convert PHP to Python

Added: trunk/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html (0 => 273656)


--- trunk/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html	2021-03-01 18:47:02 UTC (rev 273656)
@@ -0,0 +1,16 @@
+<body>
+<style>
+
+div {
+    position: absolute;
+    left: 150px;
+    top: 150px;
+    height: 100px;
+    width: 100px;
+    background-color: black;
+    transform: scale(2);
+}
+
+</style>
+<div></div>
+</body>

Added: trunk/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html (0 => 273656)


--- trunk/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html	2021-03-01 18:47:02 UTC (rev 273656)
@@ -0,0 +1,29 @@
+<body>
+<style>
+
+div {
+    position: absolute;
+    left: 150px;
+    top: 150px;
+    height: 100px;
+    width: 100px;
+    background-color: black;
+    transform: scale(2);
+    will-change: transform;
+}
+
+.scale-down {
+    transition-property: transform;
+    transition-duration: 1s;
+    transition-delay: calc(60 * 60s);
+    transform: scale(1);
+}
+
+</style>
+<div></div>
+<script>
+
+requestAnimationFrame(() => document.querySelector('div').className = "scale-down");
+
+</script>    
+</body>

Modified: trunk/Source/WebCore/ChangeLog (273655 => 273656)


--- trunk/Source/WebCore/ChangeLog	2021-03-01 18:21:45 UTC (rev 273655)
+++ trunk/Source/WebCore/ChangeLog	2021-03-01 18:47:02 UTC (rev 273656)
@@ -1,3 +1,32 @@
+2021-03-01  Antoine Quint  <[email protected]>
+
+        REGRESSION(r272004): transform transition with delay doesn't behave correctly
+        https://bugs.webkit.org/show_bug.cgi?id=222545
+        <rdar://problem/74865413>
+
+        Reviewed by Dean Jackson.
+
+        To support accelerated animations of individual transform properties, we introduced the notion of
+        non-interpolating animations to apply the underlying value for a given property before applying
+        the actual animations for this property with additivity set to true.
+
+        These non-interpolating animations were meant to last between the time at which animations were
+        committed and the effective start of the first animation for that property, accounting for any
+        delay.
+
+        However, we neglected to handle the case where that first animation had a fill mode that would
+        make it fill backwards, such as CSS Transitions. In that situation, the animation would have
+        its first keyframe applied on top of the underlying value, effectively applying the underlying
+        value twice with additivity.
+
+        We now only add these non-interpolating animations if the first animation has a delay and does
+        not fill backwards.
+
+        Test: webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateAnimations):
+
 2021-03-01  Chris Dumez  <[email protected]>
 
         Set ownership of IOSurfaces from the GPUProcess instead of the WebProcess

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


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-03-01 18:21:45 UTC (rev 273655)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-03-01 18:47:02 UTC (rev 273656)
@@ -3063,22 +3063,29 @@
                 return;
             }
 
-            Seconds earliestBeginTime = 0_s;
+            LayerPropertyAnimation* earliestAnimation = nullptr;
             for (auto* animation : animations) {
                 if (auto beginTime = animation->computedBeginTime()) {
-                    if (!earliestBeginTime || earliestBeginTime > *beginTime)
-                        earliestBeginTime = *beginTime;
+                    if (!earliestAnimation || *earliestAnimation->computedBeginTime() > *beginTime)
+                        earliestAnimation = animation;
                 }
             }
 
-            if (earliestBeginTime)
-                earliestBeginTime += animationGroupBeginTime;
+            Vector<RefPtr<PlatformCAAnimation>> caAnimations;
 
-            Vector<RefPtr<PlatformCAAnimation>> caAnimations;
-            if (earliestBeginTime > currentTime) {
-                if (auto* baseValueTransformAnimation = makeBaseValueTransformAnimation(property, TransformationMatrixSource::AskClient, earliestBeginTime)) {
-                    prepareAnimationForAddition(*baseValueTransformAnimation);
-                    caAnimations.append(baseValueTransformAnimation->m_animation);
+            // If we have an animation with an explicit begin time that does not fill backwards and starts with a delay,
+            // we must create a non-interpolating animation to set the current value for this transform-related property
+            // until that animation begins.
+            if (earliestAnimation) {
+                auto fillMode = earliestAnimation->m_animation->fillMode();
+                if (fillMode != PlatformCAAnimation::Backwards && fillMode != PlatformCAAnimation::Both) {
+                    Seconds earliestBeginTime = *earliestAnimation->computedBeginTime() + animationGroupBeginTime;
+                    if (earliestBeginTime > currentTime) {
+                        if (auto* baseValueTransformAnimation = makeBaseValueTransformAnimation(property, TransformationMatrixSource::AskClient, earliestBeginTime)) {
+                            prepareAnimationForAddition(*baseValueTransformAnimation);
+                            caAnimations.append(baseValueTransformAnimation->m_animation);
+                        }
+                    }
                 }
             }
 
@@ -3101,24 +3108,30 @@
                 return;
             }
 
-            Seconds earliestBeginTime = 0_s;
+            LayerPropertyAnimation* earliestAnimation = nullptr;
             Vector<RefPtr<PlatformCAAnimation>> caAnimations;
             for (auto* animation : WTF::makeReversedRange(animations)) {
                 if (auto beginTime = animation->computedBeginTime()) {
-                    if (!earliestBeginTime || earliestBeginTime > *beginTime)
-                        earliestBeginTime = *beginTime;
+                    if (!earliestAnimation || *earliestAnimation->computedBeginTime() > *beginTime)
+                        earliestAnimation = animation;
                 }
                 prepareAnimationForAddition(*animation);
                 caAnimations.append(animation->m_animation);
             }
 
-            if (earliestBeginTime)
-                earliestBeginTime += animationGroupBeginTime;
-
-            if (earliestBeginTime > currentTime) {
-                if (auto* baseValueTransformAnimation = makeBaseValueTransformAnimation(property, TransformationMatrixSource::AskClient, earliestBeginTime)) {
-                    prepareAnimationForAddition(*baseValueTransformAnimation);
-                    caAnimations.append(baseValueTransformAnimation->m_animation);
+            // If we have an animation with an explicit begin time that does not fill backwards and starts with a delay,
+            // we must create a non-interpolating animation to set the current value for this transform-related property
+            // until that animation begins.
+            if (earliestAnimation) {
+                auto fillMode = earliestAnimation->m_animation->fillMode();
+                if (fillMode != PlatformCAAnimation::Backwards && fillMode != PlatformCAAnimation::Both) {
+                    Seconds earliestBeginTime = *earliestAnimation->computedBeginTime() + animationGroupBeginTime;
+                    if (earliestBeginTime > currentTime) {
+                        if (auto* baseValueTransformAnimation = makeBaseValueTransformAnimation(property, TransformationMatrixSource::AskClient, earliestBeginTime)) {
+                            prepareAnimationForAddition(*baseValueTransformAnimation);
+                            caAnimations.append(baseValueTransformAnimation->m_animation);
+                        }
+                    }
                 }
             }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to