Title: [273802] branches/safari-612.1.5-branch
Revision
273802
Author
[email protected]
Date
2021-03-02 19:09:20 -0800 (Tue, 02 Mar 2021)

Log Message

Cherry-pick r273656. rdar://problem/74952887

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273656 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-612.1.5-branch/LayoutTests/ChangeLog (273801 => 273802)


--- branches/safari-612.1.5-branch/LayoutTests/ChangeLog	2021-03-03 03:09:17 UTC (rev 273801)
+++ branches/safari-612.1.5-branch/LayoutTests/ChangeLog	2021-03-03 03:09:20 UTC (rev 273802)
@@ -1,5 +1,68 @@
 2021-03-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r273656. rdar://problem/74952887
+
+    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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-02  Alan Coon  <[email protected]>
+
         Cherry-pick r273513. rdar://problem/74953307
 
     [Cocoa] Appending a partial segment of a WebM audio file results in no additional samples

Added: branches/safari-612.1.5-branch/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html (0 => 273802)


--- branches/safari-612.1.5-branch/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html	                        (rev 0)
+++ branches/safari-612.1.5-branch/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform-expected.html	2021-03-03 03:09:20 UTC (rev 273802)
@@ -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: branches/safari-612.1.5-branch/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html (0 => 273802)


--- branches/safari-612.1.5-branch/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html	                        (rev 0)
+++ branches/safari-612.1.5-branch/LayoutTests/webanimations/transform-transition-with-delay-on-forced-layer-with-transform.html	2021-03-03 03:09:20 UTC (rev 273802)
@@ -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: branches/safari-612.1.5-branch/Source/WebCore/ChangeLog (273801 => 273802)


--- branches/safari-612.1.5-branch/Source/WebCore/ChangeLog	2021-03-03 03:09:17 UTC (rev 273801)
+++ branches/safari-612.1.5-branch/Source/WebCore/ChangeLog	2021-03-03 03:09:20 UTC (rev 273802)
@@ -1,5 +1,80 @@
 2021-03-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r273656. rdar://problem/74952887
+
+    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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-02  Alan Coon  <[email protected]>
+
         Cherry-pick r273583. rdar://problem/74953376
 
     Add AXTextMarkerRangeForNSRange attribute so that Mac clients can access this functionality.

Modified: branches/safari-612.1.5-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (273801 => 273802)


--- branches/safari-612.1.5-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-03-03 03:09:17 UTC (rev 273801)
+++ branches/safari-612.1.5-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-03-03 03:09:20 UTC (rev 273802)
@@ -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