Title: [256095] trunk
Revision
256095
Author
[email protected]
Date
2020-02-08 17:11:36 -0800 (Sat, 08 Feb 2020)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (256094 => 256095)


--- trunk/LayoutTests/ChangeLog	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/LayoutTests/ChangeLog	2020-02-09 01:11:36 UTC (rev 256095)
@@ -1,3 +1,26 @@
+2020-02-08  Simon Fraser  <[email protected]>
+
+        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-08  Doug Kelly  <[email protected]>
 
         Crash in RenderTreeBuilder::Table::findOrCreateParentForChild with multicol spanner

Added: trunk/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256095)


--- trunk/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport.html (0 => 256095)


--- trunk/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/backing/backing-store-attachment-animating-outside-viewport.html	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/compositing/layer-creation/translate-animation-overlap-expected.txt (256094 => 256095)


--- trunk/LayoutTests/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/LayoutTests/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/compositing/layer-creation/translate-scale-animation-overlap-expected.txt (256094 => 256095)


--- trunk/LayoutTests/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/LayoutTests/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256095)


--- trunk/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html (0 => 256095)


--- trunk/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html	                        (rev 0)
+++ trunk/LayoutTests/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport.html	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt (256094 => 256095)


--- trunk/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-animation-overlap-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt (256094 => 256095)


--- trunk/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/LayoutTests/legacy-animation-engine/compositing/layer-creation/translate-scale-animation-overlap-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256095)


--- trunk/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/LayoutTests/platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt (0 => 256095)


--- trunk/LayoutTests/platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/legacy-animation-engine/compositing/backing/backing-store-attachment-animating-outside-viewport-expected.txt	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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: trunk/Source/WebCore/ChangeLog (256094 => 256095)


--- trunk/Source/WebCore/ChangeLog	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/Source/WebCore/ChangeLog	2020-02-09 01:11:36 UTC (rev 256095)
@@ -1,3 +1,31 @@
+2020-02-08  Simon Fraser  <[email protected]>
+
+        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-08  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC] Box::isFloatAvoider should not check for isFloatingPositioned()

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (256094 => 256095)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2020-02-09 01:11:36 UTC (rev 256095)
@@ -1529,7 +1529,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: trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp (256094 => 256095)


--- trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp	2020-02-08 21:54:58 UTC (rev 256094)
+++ trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp	2020-02-09 01:11:36 UTC (rev 256095)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to