Title: [289332] branches/safari-613-branch
Revision
289332
Author
[email protected]
Date
2022-02-07 18:57:02 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288881. rdar://problem/80246192

    Animation from scale(0) has missing backing store
    https://bugs.webkit.org/show_bug.cgi?id=227733
    <rdar://problem/80246192>

    Reviewed by Simon Fraser.

    Source/WebCore:

    Use the style recorded before we applied animations to this element the last
    time we resolved style for keyframes that don't set a value for the "transform"
    property.

    * animation/KeyframeEffect.cpp:
    (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):

    LayoutTests:

    Add a new test which animates two squares, one on top of each other. The bottom square uses an animation
    that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top
    square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus
    animating to scale(1) as well, and is white, matching the background color.

    The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation
    since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0
    value.

    This test assumes that both animations run at the same time and thus the white square will always cover
    the black square (which is smaller to ensure no issues at the edges) and yield a completely white page.

    * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added.
    * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (289331 => 289332)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:56:57 UTC (rev 289331)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:57:02 UTC (rev 289332)
@@ -1,5 +1,67 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288881. rdar://problem/80246192
+
+    Animation from scale(0) has missing backing store
+    https://bugs.webkit.org/show_bug.cgi?id=227733
+    <rdar://problem/80246192>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Use the style recorded before we applied animations to this element the last
+    time we resolved style for keyframes that don't set a value for the "transform"
+    property.
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+    
+    LayoutTests:
+    
+    Add a new test which animates two squares, one on top of each other. The bottom square uses an animation
+    that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top
+    square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus
+    animating to scale(1) as well, and is white, matching the background color.
+    
+    The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation
+    since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0
+    value.
+    
+    This test assumes that both animations run at the same time and thus the white square will always cover
+    the black square (which is smaller to ensure no issues at the edges) and yield a completely white page.
+    
+    * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added.
+    * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-01  Antoine Quint  <[email protected]>
+
+            Animation from scale(0) has missing backing store
+            https://bugs.webkit.org/show_bug.cgi?id=227733
+            <rdar://problem/80246192>
+
+            Reviewed by Simon Fraser.
+
+            Add a new test which animates two squares, one on top of each other. The bottom square uses an animation
+            that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top
+            square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus
+            animating to scale(1) as well, and is white, matching the background color.
+
+            The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation
+            since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0
+            value.
+
+            This test assumes that both animations run at the same time and thus the white square will always cover
+            the black square (which is smaller to ensure no issues at the edges) and yield a completely white page.
+
+            * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added.
+            * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added.
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288827. rdar://problem/87815745
 
     Source/WebCore:

Added: branches/safari-613-branch/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html (0 => 289332)


--- branches/safari-613-branch/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html	2022-02-08 02:57:02 UTC (rev 289332)
@@ -0,0 +1,14 @@
+<style>
+
+div {
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100px;
+    height: 100px;
+    background: white;
+    will-change: transform;
+}
+
+</style>
+<div></div>
\ No newline at end of file

Added: branches/safari-613-branch/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html (0 => 289332)


--- branches/safari-613-branch/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html	2022-02-08 02:57:02 UTC (rev 289332)
@@ -0,0 +1,52 @@
+<!doctype html>
+<html lang="en">
+<meta charset="utf-8">
+<style>
+
+@keyframes explicit {
+    from { transform: scale(0) }
+    to   { transform: scale(1) }
+}
+
+@keyframes implicit {
+    from { transform: scale(0) }
+}
+
+div {
+    position: absolute;
+    top: 0;
+    left: 0;
+    transform-origin: top left;
+    animation-duration: 1s;
+    animation-timing-function: cubic-bezier(0, 1, 0, 1);
+}
+
+div.explicit {
+    width: 50px;
+    height: 50px;
+    background: black;
+    animation-name: explicit;
+}
+
+div.implicit {
+    width: 100px;
+    height: 100px;
+    background: linear-gradient(white, white);
+    animation-name: implicit;
+}
+
+</style>
+<div class="explicit"></div>
+<div class="implicit"></div>
+
+<script>
+
+(async function () {
+    window.testRunner?.waitUntilDone();
+    await new Promise(requestAnimationFrame);
+    await new Promise(requestAnimationFrame);
+    await new Promise(requestAnimationFrame);
+    window.testRunner?.notifyDone();
+})();
+
+</script>
\ No newline at end of file

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289331 => 289332)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:56:57 UTC (rev 289331)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:57:02 UTC (rev 289332)
@@ -1,5 +1,59 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288881. rdar://problem/80246192
+
+    Animation from scale(0) has missing backing store
+    https://bugs.webkit.org/show_bug.cgi?id=227733
+    <rdar://problem/80246192>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Use the style recorded before we applied animations to this element the last
+    time we resolved style for keyframes that don't set a value for the "transform"
+    property.
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+    
+    LayoutTests:
+    
+    Add a new test which animates two squares, one on top of each other. The bottom square uses an animation
+    that has an explicit "from" value of scale(0) and an explicit "to" value of scale(1) and is black. The top
+    square uses an animation that has an explicit "from" value of scale(0) but no explicit "to" value, thus
+    animating to scale(1) as well, and is white, matching the background color.
+    
+    The bug we are fixing is that the square with an implicit "to" value would not yield a visible animation
+    since we wouldn't account for the scale(1) target value and assuming we're never animating to a non-0
+    value.
+    
+    This test assumes that both animations run at the same time and thus the white square will always cover
+    the black square (which is smaller to ensure no issues at the edges) and yield a completely white page.
+    
+    * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame-expected.html: Added.
+    * webanimations/accelerated-transform-animation-from-scale-zero-and-implicit-to-kefyrame.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-01  Antoine Quint  <[email protected]>
+
+            Animation from scale(0) has missing backing store
+            https://bugs.webkit.org/show_bug.cgi?id=227733
+            <rdar://problem/80246192>
+
+            Reviewed by Simon Fraser.
+
+            Use the style recorded before we applied animations to this element the last
+            time we resolved style for keyframes that don't set a value for the "transform"
+            property.
+
+            * animation/KeyframeEffect.cpp:
+            (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288879. rdar://problem/88322836
 
     [css-cascade] Fix removal of not yet loaded CSS @import

Modified: branches/safari-613-branch/Source/WebCore/animation/KeyframeEffect.cpp (289331 => 289332)


--- branches/safari-613-branch/Source/WebCore/animation/KeyframeEffect.cpp	2022-02-08 02:56:57 UTC (rev 289331)
+++ branches/safari-613-branch/Source/WebCore/animation/KeyframeEffect.cpp	2022-02-08 02:57:02 UTC (rev 289332)
@@ -2049,6 +2049,14 @@
 
     LayoutRect cumulativeBounds;
 
+    auto* implicitStyle = [&]() {
+        if (auto target = targetStyleable()) {
+            if (auto* lastStyleChangeEventStyle = target->lastStyleChangeEventStyle())
+                return lastStyleChangeEventStyle;
+        }
+        return &box.style();
+    }();
+
     auto addStyleToCumulativeBounds = [&](const RenderStyle* style) -> bool {
         auto keyframeBounds = bounds;
 
@@ -2072,7 +2080,7 @@
         if (!keyframe.containsProperty(CSSPropertyTransform)) {
             // If the first keyframe is missing transform style, use the current style.
             if (!keyframe.key())
-                keyframeStyle = &box.style();
+                keyframeStyle = implicitStyle;
             else
                 continue;
         }
@@ -2082,7 +2090,7 @@
     }
 
     if (m_blendingKeyframes.hasImplicitKeyframes()) {
-        if (!addStyleToCumulativeBounds(&box.style()))
+        if (!addStyleToCumulativeBounds(implicitStyle))
             return false;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to