Title: [285834] branches/safari-612.3.6.1-branch
Revision
285834
Author
[email protected]
Date
2021-11-15 14:16:34 -0800 (Mon, 15 Nov 2021)

Log Message

Cherry-pick r285728. rdar://problem/85236241

    [Web Animations] Accelerated animations with a single keyframe don't account for prior forward-filling animations
    https://bugs.webkit.org/show_bug.cgi?id=233041
    <rdar://problem/85236241>

    Reviewed by Dean Jackson.

    Source/WebCore:

    Test: webanimations/accelerated-animation-after-forward-filling-animation.html

    When starting an accelerated animation, we would fill any implicit keyframes based on the unanimated style.
    We now also apply all animations below this animation in the target's effect stack such that a previous
    forward-filling animation is accounted for.

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

    LayoutTests:

    Add a new test that runs a forward-filling animation for `transform`, waits for its completion,
    then runs another `transform` animation with an implicit initial keyframe, ensuring that the
    result of the first forward-filling animation is accounted for when computing the initial
    keyframe.

    This test would fail prior to this patch.

    * webanimations/accelerated-animation-after-forward-filling-animation-expected.html: Added.
    * webanimations/accelerated-animation-after-forward-filling-animation.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-612.3.6.1-branch/LayoutTests/ChangeLog (285833 => 285834)


--- branches/safari-612.3.6.1-branch/LayoutTests/ChangeLog	2021-11-15 22:16:30 UTC (rev 285833)
+++ branches/safari-612.3.6.1-branch/LayoutTests/ChangeLog	2021-11-15 22:16:34 UTC (rev 285834)
@@ -1,3 +1,56 @@
+2021-11-15  Alan Coon  <[email protected]>
+
+        Cherry-pick r285728. rdar://problem/85236241
+
+    [Web Animations] Accelerated animations with a single keyframe don't account for prior forward-filling animations
+    https://bugs.webkit.org/show_bug.cgi?id=233041
+    <rdar://problem/85236241>
+    
+    Reviewed by Dean Jackson.
+    
+    Source/WebCore:
+    
+    Test: webanimations/accelerated-animation-after-forward-filling-animation.html
+    
+    When starting an accelerated animation, we would fill any implicit keyframes based on the unanimated style.
+    We now also apply all animations below this animation in the target's effect stack such that a previous
+    forward-filling animation is accounted for.
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
+    
+    LayoutTests:
+    
+    Add a new test that runs a forward-filling animation for `transform`, waits for its completion,
+    then runs another `transform` animation with an implicit initial keyframe, ensuring that the
+    result of the first forward-filling animation is accounted for when computing the initial
+    keyframe.
+    
+    This test would fail prior to this patch.
+    
+    * webanimations/accelerated-animation-after-forward-filling-animation-expected.html: Added.
+    * webanimations/accelerated-animation-after-forward-filling-animation.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-12  Antoine Quint  <[email protected]>
+
+            [Web Animations] Accelerated animations with a single keyframe don't account for prior forward-filling animations
+            https://bugs.webkit.org/show_bug.cgi?id=233041
+            <rdar://problem/85236241>
+
+            Reviewed by Dean Jackson.
+
+            Add a new test that runs a forward-filling animation for `transform`, waits for its completion,
+            then runs another `transform` animation with an implicit initial keyframe, ensuring that the
+            result of the first forward-filling animation is accounted for when computing the initial
+            keyframe.
+
+            This test would fail prior to this patch.
+
+            * webanimations/accelerated-animation-after-forward-filling-animation-expected.html: Added.
+            * webanimations/accelerated-animation-after-forward-filling-animation.html: Added.
+
 2021-11-11  Alan Coon  <[email protected]>
 
         Cherry-pick r285565. rdar://problem/83159358

Added: branches/safari-612.3.6.1-branch/LayoutTests/webanimations/accelerated-animation-after-forward-filling-animation-expected.html (0 => 285834)


--- branches/safari-612.3.6.1-branch/LayoutTests/webanimations/accelerated-animation-after-forward-filling-animation-expected.html	                        (rev 0)
+++ branches/safari-612.3.6.1-branch/LayoutTests/webanimations/accelerated-animation-after-forward-filling-animation-expected.html	2021-11-15 22:16:34 UTC (rev 285834)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<body>
+<style>
+
+    #target {
+        position: absolute;
+        left: 0;
+        top: 0;
+        width: 100px;
+        height: 100px;
+        background-color: black;
+        transform: translateX(100px);
+    }
+
+</style>
+<div id="target"></div>
+</body>

Added: branches/safari-612.3.6.1-branch/LayoutTests/webanimations/accelerated-animation-after-forward-filling-animation.html (0 => 285834)


--- branches/safari-612.3.6.1-branch/LayoutTests/webanimations/accelerated-animation-after-forward-filling-animation.html	                        (rev 0)
+++ branches/safari-612.3.6.1-branch/LayoutTests/webanimations/accelerated-animation-after-forward-filling-animation.html	2021-11-15 22:16:34 UTC (rev 285834)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<body>
+<style>
+
+    #target {
+        position: absolute;
+        left: 0;
+        top: 0;
+        width: 100px;
+        height: 100px;
+        background-color: black;
+    }
+
+</style>
+<div id="target"></div>
+<script>
+
+(async () => {
+    if (window.testRunner)
+        window.testRunner.waitUntilDone();
+
+    const target = document.getElementById("target");
+
+    // Start a forward-filling accelerated animation.
+    const fillingAnimation = target.animate({ transform: "translateX(100px)" }, { duration: 1, fill: "forwards" });
+    await fillingAnimation.finished;
+
+    // Start another animation with an implicit from keyframe.
+    const animation = target.animate({ transform: "translateY(1px)" }, { duration: 1000 * 1000 });
+
+    // Wait two frames for the accelerated animation to be committed.
+    await animation.ready;
+    await new Promise(requestAnimationFrame);
+    await new Promise(requestAnimationFrame);
+
+    if (window.testRunner)
+        window.testRunner.notifyDone();
+})();
+
+</script>
+</body>

Modified: branches/safari-612.3.6.1-branch/Source/WebCore/ChangeLog (285833 => 285834)


--- branches/safari-612.3.6.1-branch/Source/WebCore/ChangeLog	2021-11-15 22:16:30 UTC (rev 285833)
+++ branches/safari-612.3.6.1-branch/Source/WebCore/ChangeLog	2021-11-15 22:16:34 UTC (rev 285834)
@@ -1,3 +1,55 @@
+2021-11-15  Alan Coon  <[email protected]>
+
+        Cherry-pick r285728. rdar://problem/85236241
+
+    [Web Animations] Accelerated animations with a single keyframe don't account for prior forward-filling animations
+    https://bugs.webkit.org/show_bug.cgi?id=233041
+    <rdar://problem/85236241>
+    
+    Reviewed by Dean Jackson.
+    
+    Source/WebCore:
+    
+    Test: webanimations/accelerated-animation-after-forward-filling-animation.html
+    
+    When starting an accelerated animation, we would fill any implicit keyframes based on the unanimated style.
+    We now also apply all animations below this animation in the target's effect stack such that a previous
+    forward-filling animation is accounted for.
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
+    
+    LayoutTests:
+    
+    Add a new test that runs a forward-filling animation for `transform`, waits for its completion,
+    then runs another `transform` animation with an implicit initial keyframe, ensuring that the
+    result of the first forward-filling animation is accounted for when computing the initial
+    keyframe.
+    
+    This test would fail prior to this patch.
+    
+    * webanimations/accelerated-animation-after-forward-filling-animation-expected.html: Added.
+    * webanimations/accelerated-animation-after-forward-filling-animation.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-12  Antoine Quint  <[email protected]>
+
+            [Web Animations] Accelerated animations with a single keyframe don't account for prior forward-filling animations
+            https://bugs.webkit.org/show_bug.cgi?id=233041
+            <rdar://problem/85236241>
+
+            Reviewed by Dean Jackson.
+
+            Test: webanimations/accelerated-animation-after-forward-filling-animation.html
+
+            When starting an accelerated animation, we would fill any implicit keyframes based on the unanimated style.
+            We now also apply all animations below this animation in the target's effect stack such that a previous
+            forward-filling animation is accounted for.
+
+            * animation/KeyframeEffect.cpp:
+            (WebCore::KeyframeEffect::applyPendingAcceleratedActions):
+
 2021-11-12  Russell Epstein  <[email protected]>
 
         Revert r285691. rdar://problem/83381842

Modified: branches/safari-612.3.6.1-branch/Source/WebCore/animation/KeyframeEffect.cpp (285833 => 285834)


--- branches/safari-612.3.6.1-branch/Source/WebCore/animation/KeyframeEffect.cpp	2021-11-15 22:16:30 UTC (rev 285833)
+++ branches/safari-612.3.6.1-branch/Source/WebCore/animation/KeyframeEffect.cpp	2021-11-15 22:16:34 UTC (rev 285834)
@@ -1745,9 +1745,22 @@
         auto* lastStyleChangeEventStyle = m_target->lastStyleChangeEventStyle(m_pseudoId);
         ASSERT(lastStyleChangeEventStyle);
 
+        // We need to resolve all animations up to this point to ensure any forward-filling
+        // effect is accounted for when computing the "from" value for the accelerated animation.
+        auto underlyingStyle = RenderStyle::clonePtr(*lastStyleChangeEventStyle);
+        auto* effectStack = m_target->keyframeEffectStack(m_pseudoId);
+        ASSERT(effectStack);
+
+        for (const auto& effect : effectStack->sortedEffects()) {
+            if (this == effect.get())
+                break;
+            if (auto progress = effect->getComputedTiming().progress)
+                effect->setAnimatedPropertiesInStyle(*underlyingStyle, *progress);
+        }
+
         KeyframeList explicitKeyframes(m_blendingKeyframes.animationName());
         explicitKeyframes.copyKeyframes(m_blendingKeyframes);
-        explicitKeyframes.fillImplicitKeyframes(*m_target, m_target->styleResolver(), lastStyleChangeEventStyle, nullptr);
+        explicitKeyframes.fillImplicitKeyframes(*m_target, m_target->styleResolver(), underlyingStyle.get(), nullptr);
         return renderer->startAnimation(timeOffset, backingAnimationForCompositedRenderer(), explicitKeyframes) ? RunningAccelerated::Yes : RunningAccelerated::No;
     };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to