Title: [256367] branches/safari-609.1.17.1-branch
Revision
256367
Author
alanc...@apple.com
Date
2020-02-11 14:03:25 -0800 (Tue, 11 Feb 2020)

Log Message

Cherry-pick r256095. rdar://problem/59349202

    Extent of a composited animation should not include the untransformed position
    https://bugs.webkit.org/show_bug.cgi?id=207434

    Reviewed by Sam Weinig.
    Source/WebCore:

    To determine whether to create ("attach") backing store for layers with transform animations,
    we compute the union of all the states of the animation as an "extent", and ask whether it intersects
    the coverage rect in GraphicsLayerCA.

    The non-Web Animations transition code did this correctly, just unioning the bounds transformed by
    the start and end state.

    The non-Web Animations keyframe code, and the Web Animations KeyframeEffect code (used for both CSS transitions
    and animations) also unioned with the unanimated bounds, which could create overly large extents in some
    cases, contributing to jetsams on iOS (rdar://problem/59020443).

    Fix KeyframeAnimation and KeyframeEffect to not union with the untransformed bounds.

    Tests: compositing/backing/backing-store-attachment-animating-outside-viewport.html
           legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html

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

    LayoutTests:

    New test that checks backing store attachment and overlap for an element which is positioned in-view,
    but is move offscreen by the animation.

    New baselines for overlap tests, since overlap no longer considers the unanimated position.

    * compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
    * compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
    * compositing/layer-creation/translate-animation-overlap-expected.txt:
    * compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
    * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
    * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
    * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt:
    * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
    * platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
    * platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-609.1.17.1-branch/LayoutTests/ChangeLog (256366 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/ChangeLog	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/LayoutTests/ChangeLog	2020-02-11 22:03:25 UTC (rev 256367)
@@ -1,5 +1,80 @@
 2020-02-11  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r256095. rdar://problem/59349202
+
+    Extent of a composited animation should not include the untransformed position
+    https://bugs.webkit.org/show_bug.cgi?id=207434
+    
+    Reviewed by Sam Weinig.
+    Source/WebCore:
+    
+    To determine whether to create ("attach") backing store for layers with transform animations,
+    we compute the union of all the states of the animation as an "extent", and ask whether it intersects
+    the coverage rect in GraphicsLayerCA.
+    
+    The non-Web Animations transition code did this correctly, just unioning the bounds transformed by
+    the start and end state.
+    
+    The non-Web Animations keyframe code, and the Web Animations KeyframeEffect code (used for both CSS transitions
+    and animations) also unioned with the unanimated bounds, which could create overly large extents in some
+    cases, contributing to jetsams on iOS (rdar://problem/59020443).
+    
+    Fix KeyframeAnimation and KeyframeEffect to not union with the untransformed bounds.
+    
+    Tests: compositing/backing/backing-store-attachment-animating-outside-viewport.html
+           legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+    * page/animation/KeyframeAnimation.cpp:
+    (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
+    
+    LayoutTests:
+    
+    New test that checks backing store attachment and overlap for an element which is positioned in-view,
+    but is move offscreen by the animation.
+    
+    New baselines for overlap tests, since overlap no longer considers the unanimated position.
+    
+    * compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    * compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
+    * compositing/layer-creation/translate-animation-overlap-expected.txt:
+    * compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
+    * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
+    * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt:
+    * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
+    * platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    * platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-08  Simon Fraser  <simon.fra...@apple.com>
+
+            Extent of a composited animation should not include the untransformed position
+            https://bugs.webkit.org/show_bug.cgi?id=207434
+
+            Reviewed by Sam Weinig.
+
+            New test that checks backing store attachment and overlap for an element which is positioned in-view,
+            but is move offscreen by the animation.
+
+            New baselines for overlap tests, since overlap no longer considers the unanimated position.
+
+            * compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+            * compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
+            * compositing/layer-creation/translate-animation-overlap-expected.txt:
+            * compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
+            * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+            * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
+            * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt:
+            * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
+            * platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+            * platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r255810. rdar://problem/59349189
 
     [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing

Added: branches/safari-609.1.17.1-branch/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ branches/safari-609.1.17.1-branch/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -0,0 +1,24 @@
+An in-view element animating off-screen should not have backing store.
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2200.00)
+  (backingStoreAttached 1)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2200.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (children 1
+        (GraphicsLayer
+          (position 100.00 100.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (backingStoreAttached 0)
+        )
+      )
+    )
+  )
+)
+Some text here to force backing store.

Added: branches/safari-609.1.17.1-branch/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport.html (0 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport.html	                        (rev 0)
+++ branches/safari-609.1.17.1-branch/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport.html	2020-02-11 22:03:25 UTC (rev 256367)
@@ -0,0 +1,78 @@
+<!doctype html>
+<html>
+<head>
+<style>
+    #box {
+        position: absolute;
+        top: 100px;
+        left: 100px;
+        width: 100px;
+        height: 100px;
+        background-color: silver;
+    }
+
+    .dot {
+        position: absolute;
+        top: 0;
+        left: 0;
+        height: 4px;
+        width: 4px;
+        background-color: silver;
+    }
+    
+    #box.animating {
+        animation: move 1s linear;
+    }
+
+    @keyframes move {
+        from { transform: translate3d(100px, 2000px, 0); }
+        to   { transform: translate3d(100px, 2100px, 0); }
+    }
+
+</style>
+<script src=""
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function dumpLayerTree()
+{
+    if (!window.internals)
+        return;
+
+    var out = document.getElementById('out');
+    out.innerText = layerTreeWithoutTransforms(internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+}
+
+function dumpLayersSoon()
+{
+    setTimeout(function() {
+        dumpLayerTree();
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }, 0);
+}
+
+function runTest()
+{
+    makeDots(5, 5, 60);
+    let box = document.getElementById('box');
+    box.addEventListener('animationstart', dumpLayersSoon, false);
+    box.classList.add('animating');
+}
+
+window.addEventListener('load', runTest, false);
+
+</script>
+</head>
+<body>
+<p>An in-view element animating off-screen should not have backing store.</p>
+<pre id="out"></pre>
+<div id="box">
+    Some text here to force backing store.
+</div>
+
+</body>
+</html>

Modified: branches/safari-609.1.17.1-branch/LayoutTests/compositing/layer-creation/translate-animation-overlap-expected.txt (256366 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/LayoutTests/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -5,7 +5,7 @@
     (GraphicsLayer
       (bounds 800.00 600.00)
       (contentsOpaque 1)
-      (children 430
+      (children 417
         (GraphicsLayer
           (offsetFromRenderer width=-14 height=-14)
           (position 24.00 38.00)
@@ -13,11 +13,6 @@
           (drawsContent 1)
         )
         (GraphicsLayer
-          (position 30.00 40.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 40.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -178,11 +173,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 50.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 50.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -343,11 +333,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 60.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 60.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -508,11 +493,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 70.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 70.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -673,11 +653,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 80.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 80.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -838,11 +813,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 90.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 90.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1003,11 +973,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 100.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 100.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1168,11 +1133,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 110.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 110.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1333,11 +1293,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 120.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 120.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1498,11 +1453,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 130.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 130.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1663,11 +1613,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 140.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 140.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1828,11 +1773,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 150.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 150.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1993,11 +1933,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 160.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 160.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)

Modified: branches/safari-609.1.17.1-branch/LayoutTests/compositing/layer-creation/translate-scale-animation-overlap-expected.txt (256366 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/LayoutTests/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -5,7 +5,7 @@
     (GraphicsLayer
       (bounds 800.00 600.00)
       (contentsOpaque 1)
-      (children 703
+      (children 685
         (GraphicsLayer
           (offsetFromRenderer width=-14 height=-14)
           (position 24.00 68.00)
@@ -14,11 +14,6 @@
           (drawsContent 1)
         )
         (GraphicsLayer
-          (position 30.00 30.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 30.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -209,11 +204,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 40.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 40.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -404,11 +394,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 50.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 50.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -599,11 +584,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 60.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 60.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -794,11 +774,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 70.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 70.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -989,11 +964,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 80.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 80.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1184,11 +1154,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 90.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 90.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1379,11 +1344,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 100.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 100.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1574,11 +1534,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 110.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 110.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1769,11 +1724,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 120.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 120.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1964,11 +1914,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 130.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 130.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2159,11 +2104,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 140.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 140.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2354,11 +2294,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 150.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 150.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2549,11 +2484,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 160.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 160.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2744,11 +2674,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 170.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 170.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2939,11 +2864,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 180.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 180.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -3134,11 +3054,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 190.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 190.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -3329,11 +3244,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 200.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 200.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)

Added: branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -0,0 +1,24 @@
+An in-view element animating off-screen should not have backing store.
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2200.00)
+  (backingStoreAttached 1)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2200.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (children 1
+        (GraphicsLayer
+          (position 100.00 100.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (backingStoreAttached 0)
+        )
+      )
+    )
+  )
+)
+Some text here to force backing store.

Added: branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html (0 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html	                        (rev 0)
+++ branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html	2020-02-11 22:03:25 UTC (rev 256367)
@@ -0,0 +1,78 @@
+<!doctype html>
+<html>
+<head>
+<style>
+    #box {
+        position: absolute;
+        top: 100px;
+        left: 100px;
+        width: 100px;
+        height: 100px;
+        background-color: silver;
+    }
+
+    .dot {
+        position: absolute;
+        top: 0;
+        left: 0;
+        height: 4px;
+        width: 4px;
+        background-color: silver;
+    }
+    
+    #box.animating {
+        animation: move 1s linear;
+    }
+
+    @keyframes move {
+        from { transform: translate3d(100px, 2000px, 0); }
+        to   { transform: translate3d(100px, 2100px, 0); }
+    }
+
+</style>
+<script src=""
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function dumpLayerTree()
+{
+    if (!window.internals)
+        return;
+
+    var out = document.getElementById('out');
+    out.innerText = layerTreeWithoutTransforms(internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+}
+
+function dumpLayersSoon()
+{
+    setTimeout(function() {
+        dumpLayerTree();
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }, 0);
+}
+
+function runTest()
+{
+    makeDots(5, 5, 60);
+    let box = document.getElementById('box');
+    box.addEventListener('animationstart', dumpLayersSoon, false);
+    box.classList.add('animating');
+}
+
+window.addEventListener('load', runTest, false);
+
+</script>
+</head>
+<body>
+<p>An in-view element animating off-screen should not have backing store.</p>
+<pre id="out"></pre>
+<div id="box">
+    Some text here to force backing store.
+</div>
+
+</body>
+</html>

Modified: branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt (256366 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -5,7 +5,7 @@
     (GraphicsLayer
       (bounds 800.00 600.00)
       (contentsOpaque 1)
-      (children 430
+      (children 417
         (GraphicsLayer
           (offsetFromRenderer width=-14 height=-14)
           (position 24.00 38.00)
@@ -13,11 +13,6 @@
           (drawsContent 1)
         )
         (GraphicsLayer
-          (position 30.00 40.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 40.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -178,11 +173,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 50.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 50.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -343,11 +333,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 60.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 60.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -508,11 +493,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 70.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 70.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -673,11 +653,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 80.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 80.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -838,11 +813,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 90.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 90.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1003,11 +973,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 100.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 100.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1168,11 +1133,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 110.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 110.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1333,11 +1293,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 120.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 120.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1498,11 +1453,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 130.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 130.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1663,11 +1613,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 140.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 140.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1828,11 +1773,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 150.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 150.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1993,11 +1933,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 160.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 160.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)

Modified: branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt (256366 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -5,7 +5,7 @@
     (GraphicsLayer
       (bounds 800.00 600.00)
       (contentsOpaque 1)
-      (children 703
+      (children 685
         (GraphicsLayer
           (offsetFromRenderer width=-14 height=-14)
           (position 24.00 68.00)
@@ -14,11 +14,6 @@
           (drawsContent 1)
         )
         (GraphicsLayer
-          (position 30.00 30.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 30.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -209,11 +204,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 40.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 40.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -404,11 +394,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 50.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 50.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -599,11 +584,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 60.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 60.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -794,11 +774,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 70.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 70.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -989,11 +964,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 80.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 80.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1184,11 +1154,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 90.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 90.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1379,11 +1344,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 100.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 100.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1574,11 +1534,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 110.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 110.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1769,11 +1724,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 120.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 120.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -1964,11 +1914,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 130.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 130.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2159,11 +2104,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 140.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 140.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2354,11 +2294,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 150.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 150.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2549,11 +2484,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 160.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 160.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2744,11 +2674,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 170.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 170.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -2939,11 +2864,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 180.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 180.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -3134,11 +3054,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 190.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 190.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)
@@ -3329,11 +3244,6 @@
           (contentsOpaque 1)
         )
         (GraphicsLayer
-          (position 30.00 200.00)
-          (bounds 4.00 4.00)
-          (contentsOpaque 1)
-        )
-        (GraphicsLayer
           (position 40.00 200.00)
           (bounds 4.00 4.00)
           (contentsOpaque 1)

Added: branches/safari-609.1.17.1-branch/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ branches/safari-609.1.17.1-branch/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -0,0 +1,24 @@
+An in-view element animating off-screen should not have backing store.
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 2200.00)
+  (backingStoreAttached 1)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 2200.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (children 1
+        (GraphicsLayer
+          (position 100.00 100.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (backingStoreAttached 0)
+        )
+      )
+    )
+  )
+)
+Some text here to force backing store.

Added: branches/safari-609.1.17.1-branch/LayoutTests/platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256367)


--- branches/safari-609.1.17.1-branch/LayoutTests/platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ branches/safari-609.1.17.1-branch/LayoutTests/platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-11 22:03:25 UTC (rev 256367)
@@ -0,0 +1,24 @@
+An in-view element animating off-screen should not have backing store.
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 2200.00)
+  (backingStoreAttached 1)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 2200.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (children 1
+        (GraphicsLayer
+          (position 100.00 100.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+          (drawsContent 1)
+          (backingStoreAttached 0)
+        )
+      )
+    )
+  )
+)
+Some text here to force backing store.

Modified: branches/safari-609.1.17.1-branch/Source/WebCore/ChangeLog (256366 => 256367)


--- branches/safari-609.1.17.1-branch/Source/WebCore/ChangeLog	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/Source/WebCore/ChangeLog	2020-02-11 22:03:25 UTC (rev 256367)
@@ -1,5 +1,85 @@
 2020-02-11  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r256095. rdar://problem/59349202
+
+    Extent of a composited animation should not include the untransformed position
+    https://bugs.webkit.org/show_bug.cgi?id=207434
+    
+    Reviewed by Sam Weinig.
+    Source/WebCore:
+    
+    To determine whether to create ("attach") backing store for layers with transform animations,
+    we compute the union of all the states of the animation as an "extent", and ask whether it intersects
+    the coverage rect in GraphicsLayerCA.
+    
+    The non-Web Animations transition code did this correctly, just unioning the bounds transformed by
+    the start and end state.
+    
+    The non-Web Animations keyframe code, and the Web Animations KeyframeEffect code (used for both CSS transitions
+    and animations) also unioned with the unanimated bounds, which could create overly large extents in some
+    cases, contributing to jetsams on iOS (rdar://problem/59020443).
+    
+    Fix KeyframeAnimation and KeyframeEffect to not union with the untransformed bounds.
+    
+    Tests: compositing/backing/backing-store-attachment-animating-outside-viewport.html
+           legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html
+    
+    * animation/KeyframeEffect.cpp:
+    (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+    * page/animation/KeyframeAnimation.cpp:
+    (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
+    
+    LayoutTests:
+    
+    New test that checks backing store attachment and overlap for an element which is positioned in-view,
+    but is move offscreen by the animation.
+    
+    New baselines for overlap tests, since overlap no longer considers the unanimated position.
+    
+    * compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    * compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
+    * compositing/layer-creation/translate-animation-overlap-expected.txt:
+    * compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
+    * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    * legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html: Added.
+    * legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt:
+    * legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt:
+    * platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    * platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-08  Simon Fraser  <simon.fra...@apple.com>
+
+            Extent of a composited animation should not include the untransformed position
+            https://bugs.webkit.org/show_bug.cgi?id=207434
+
+            Reviewed by Sam Weinig.
+
+            To determine whether to create ("attach") backing store for layers with transform animations,
+            we compute the union of all the states of the animation as an "extent", and ask whether it intersects
+            the coverage rect in GraphicsLayerCA.
+
+            The non-Web Animations transition code did this correctly, just unioning the bounds transformed by
+            the start and end state.
+
+            The non-Web Animations keyframe code, and the Web Animations KeyframeEffect code (used for both CSS transitions
+            and animations) also unioned with the unanimated bounds, which could create overly large extents in some
+            cases, contributing to jetsams on iOS (rdar://problem/59020443).
+
+            Fix KeyframeAnimation and KeyframeEffect to not union with the untransformed bounds.
+
+            Tests: compositing/backing/backing-store-attachment-animating-outside-viewport.html
+                   legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html
+
+            * animation/KeyframeEffect.cpp:
+            (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
+            * page/animation/KeyframeAnimation.cpp:
+            (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
+
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r255810. rdar://problem/59349189
 
     [Web Animations] Canceling an accelerated animation before it was committed does not prevent it from playing

Modified: branches/safari-609.1.17.1-branch/Source/WebCore/animation/KeyframeEffect.cpp (256366 => 256367)


--- branches/safari-609.1.17.1-branch/Source/WebCore/animation/KeyframeEffect.cpp	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/Source/WebCore/animation/KeyframeEffect.cpp	2020-02-11 22:03:25 UTC (rev 256367)
@@ -1526,7 +1526,7 @@
     auto& box = downcast<RenderBox>(*renderer());
     auto rendererBox = snapRectToDevicePixels(box.borderBoxRect(), box.document().deviceScaleFactor());
 
-    auto cumulativeBounds = bounds;
+    LayoutRect cumulativeBounds;
 
     for (const auto& keyframe : m_blendingKeyframes.keyframes()) {
         const auto* keyframeStyle = keyframe.style();

Modified: branches/safari-609.1.17.1-branch/Source/WebCore/page/animation/KeyframeAnimation.cpp (256366 => 256367)


--- branches/safari-609.1.17.1-branch/Source/WebCore/page/animation/KeyframeAnimation.cpp	2020-02-11 22:03:18 UTC (rev 256366)
+++ branches/safari-609.1.17.1-branch/Source/WebCore/page/animation/KeyframeAnimation.cpp	2020-02-11 22:03:25 UTC (rev 256367)
@@ -253,7 +253,7 @@
     auto& box = downcast<RenderBox>(*renderer());
     auto rendererBox = snapRectToDevicePixels(box.borderBoxRect(), box.document().deviceScaleFactor());
 
-    auto cumulativeBounds = bounds;
+    LayoutRect cumulativeBounds;
 
     for (auto& keyframe : m_keyframes.keyframes()) {
         const RenderStyle* keyframeStyle = keyframe.style();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to