[Compositor] Do not disable overlap testing for layers in front of 3D transformed...
authorachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 22:30:54 +0000 (22:30 +0000)
committerachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2013 22:30:54 +0000 (22:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106721

Reviewed by Simon Fraser.

Source/WebCore:

RenderLayerCompositor is checking for overlapping layers and tries to figure out all the layers that need
to be drawn using composited layers. It doesn't know anything about animations yet and it only works with "start"
and "end" states. However, it knows that animations might happen, so in that cases it will avoid to do any optimizations,
as layers might get moved.

The overlapping layers optimization was also disabled for 3D layers. However, 3D layers can be computed in WebKit and
can be checked for overlap using just the "start"/"stop" states. In this patch I enable that optimization for 3D layers, too.
The result is that more layers are drawn in software mode now, so I've updated a couple of test results.

Tests: compositing/layer-creation/overlap-transformed-3d.html
       compositing/layer-creation/overlap-transformed-preserved-3d.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):

LayoutTests:

Added two more tests for the case when 3D layers covered by a 2D layer in front. One is using flat style and the
other is using the preserve-3d mode.

Also, updated a couple of existing test results as some of the composited layers are not needed anymore.

* compositing/geometry/ancestor-overflow-change-expected.txt:
* compositing/geometry/clip-expected.txt:
* compositing/geometry/clip-inside-expected.txt:
* compositing/geometry/foreground-layer-expected.txt:
* compositing/layer-creation/overlap-animation-clipping-expected.txt:
* compositing/layer-creation/overlap-animation-container-expected.txt:
* compositing/layer-creation/overlap-transformed-3d-expected.txt: Added.
* compositing/layer-creation/overlap-transformed-3d.html: Added.
* compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt: Added.
* compositing/layer-creation/overlap-transformed-preserved-3d.html: Added.
* compositing/layer-creation/overlap-transforms-expected.txt:
* compositing/overflow/clip-descendents-expected.txt:
* css3/filters/filtered-compositing-descendant-expected.txt:
* platform/chromium-win/compositing/geometry/ancestor-overflow-change-expected.txt: Removed. There should be no difference now.
* platform/chromium-win/css3/filters/filtered-compositing-descendant-expected.txt: Removed. There should be no difference now.
* platform/chromium/compositing/geometry/ancestor-overflow-change-expected.txt:
* platform/chromium/compositing/geometry/clip-expected.txt:
* platform/chromium/compositing/geometry/clip-inside-expected.txt:
* platform/chromium/compositing/geometry/foreground-layer-expected.txt:
* platform/chromium/compositing/layer-creation/overlap-animation-clipping-expected.txt:
* platform/chromium/compositing/layer-creation/overlap-animation-container-expected.txt:
* platform/chromium/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt: Added.
* platform/chromium/compositing/layer-creation/overlap-transforms-expected.txt:
* platform/chromium/compositing/overflow/clip-descendents-expected.txt:
* platform/chromium/css3/filters/filtered-compositing-descendant-expected.txt:

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

28 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/geometry/ancestor-overflow-change-expected.txt
LayoutTests/compositing/geometry/clip-expected.txt
LayoutTests/compositing/geometry/clip-inside-expected.txt
LayoutTests/compositing/geometry/foreground-layer-expected.txt
LayoutTests/compositing/layer-creation/overlap-animation-clipping-expected.txt
LayoutTests/compositing/layer-creation/overlap-animation-container-expected.txt
LayoutTests/compositing/layer-creation/overlap-transformed-3d-expected.txt [new file with mode: 0644]
LayoutTests/compositing/layer-creation/overlap-transformed-3d.html [new file with mode: 0644]
LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt [new file with mode: 0644]
LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d.html [new file with mode: 0644]
LayoutTests/compositing/layer-creation/overlap-transforms-expected.txt
LayoutTests/compositing/overflow/clip-descendents-expected.txt
LayoutTests/css3/filters/filtered-compositing-descendant-expected.txt
LayoutTests/platform/chromium-win/compositing/geometry/ancestor-overflow-change-expected.txt [deleted file]
LayoutTests/platform/chromium-win/css3/filters/filtered-compositing-descendant-expected.txt [deleted file]
LayoutTests/platform/chromium/compositing/geometry/ancestor-overflow-change-expected.txt
LayoutTests/platform/chromium/compositing/geometry/clip-expected.txt
LayoutTests/platform/chromium/compositing/geometry/clip-inside-expected.txt
LayoutTests/platform/chromium/compositing/geometry/foreground-layer-expected.txt
LayoutTests/platform/chromium/compositing/layer-creation/overlap-animation-clipping-expected.txt
LayoutTests/platform/chromium/compositing/layer-creation/overlap-animation-container-expected.txt
LayoutTests/platform/chromium/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/compositing/layer-creation/overlap-transforms-expected.txt
LayoutTests/platform/chromium/compositing/overflow/clip-descendents-expected.txt
LayoutTests/platform/chromium/css3/filters/filtered-compositing-descendant-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerCompositor.cpp

index bdf747e..d256ad4 100644 (file)
@@ -1,3 +1,41 @@
+2013-01-15  Alexandru Chiculita  <achicu@adobe.com>
+
+        [Compositor] Do not disable overlap testing for layers in front of 3D transformed layers
+        https://bugs.webkit.org/show_bug.cgi?id=106721
+
+        Reviewed by Simon Fraser.
+
+        Added two more tests for the case when 3D layers covered by a 2D layer in front. One is using flat style and the
+        other is using the preserve-3d mode.
+
+        Also, updated a couple of existing test results as some of the composited layers are not needed anymore.
+
+        * compositing/geometry/ancestor-overflow-change-expected.txt:
+        * compositing/geometry/clip-expected.txt:
+        * compositing/geometry/clip-inside-expected.txt:
+        * compositing/geometry/foreground-layer-expected.txt:
+        * compositing/layer-creation/overlap-animation-clipping-expected.txt:
+        * compositing/layer-creation/overlap-animation-container-expected.txt:
+        * compositing/layer-creation/overlap-transformed-3d-expected.txt: Added.
+        * compositing/layer-creation/overlap-transformed-3d.html: Added.
+        * compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt: Added.
+        * compositing/layer-creation/overlap-transformed-preserved-3d.html: Added.
+        * compositing/layer-creation/overlap-transforms-expected.txt:
+        * compositing/overflow/clip-descendents-expected.txt:
+        * css3/filters/filtered-compositing-descendant-expected.txt:
+        * platform/chromium-win/compositing/geometry/ancestor-overflow-change-expected.txt: Removed. There should be no difference now.
+        * platform/chromium-win/css3/filters/filtered-compositing-descendant-expected.txt: Removed. There should be no difference now.
+        * platform/chromium/compositing/geometry/ancestor-overflow-change-expected.txt:
+        * platform/chromium/compositing/geometry/clip-expected.txt:
+        * platform/chromium/compositing/geometry/clip-inside-expected.txt:
+        * platform/chromium/compositing/geometry/foreground-layer-expected.txt:
+        * platform/chromium/compositing/layer-creation/overlap-animation-clipping-expected.txt:
+        * platform/chromium/compositing/layer-creation/overlap-animation-container-expected.txt:
+        * platform/chromium/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt: Added.
+        * platform/chromium/compositing/layer-creation/overlap-transforms-expected.txt:
+        * platform/chromium/compositing/overflow/clip-descendents-expected.txt:
+        * platform/chromium/css3/filters/filtered-compositing-descendant-expected.txt:
+
 2013-01-15  Joshua Bell  <jsbell@chromium.org>
 
         IndexedDB: Fix tests which depend upon V8 event listener behavior
index ca7d683..37499d3 100644 (file)
@@ -3,18 +3,12 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 2
+      (children 1
         (GraphicsLayer
           (position 6.00 6.00)
           (bounds 104.00 104.00)
           (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
         )
-        (GraphicsLayer
-          (position 6.00 119.00)
-          (bounds 788.00 19.00)
-          (opacity 0.00)
-          (drawsContent 1)
-        )
       )
     )
   )
index 0f3fcb6..96ed050 100644 (file)
@@ -5,7 +5,7 @@ Test CSS clip with composited layers. Left and right sides should look the same.
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 3
+      (children 2
         (GraphicsLayer
           (position 20.00 20.00)
           (bounds 100.00 100.00)
@@ -13,11 +13,6 @@ Test CSS clip with composited layers. Left and right sides should look the same.
           (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
         )
         (GraphicsLayer
-          (position 220.00 20.00)
-          (bounds 100.00 100.00)
-          (drawsContent 1)
-        )
-        (GraphicsLayer
           (position 215.00 15.00)
           (bounds 110.00 110.00)
           (children 1
index f0c8a7c..4aacfbd 100644 (file)
@@ -5,7 +5,7 @@ Test CSS clip with composited layers. Left and right sides should look the same.
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 3
+      (children 2
         (GraphicsLayer
           (position 25.00 35.00)
           (anchor 0.50 0.44)
@@ -16,11 +16,6 @@ Test CSS clip with composited layers. Left and right sides should look the same.
         (GraphicsLayer
           (position 225.00 35.00)
           (bounds 90.00 80.00)
-          (drawsContent 1)
-        )
-        (GraphicsLayer
-          (position 225.00 35.00)
-          (bounds 90.00 80.00)
           (children 1
             (GraphicsLayer
               (position -15.00 -25.00)
index 1a44182..3bf769d 100644 (file)
@@ -4,7 +4,7 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 3
+      (children 2
         (GraphicsLayer
           (position 18.00 18.00)
           (bounds 320.00 320.00)
             )
           )
         )
-        (GraphicsLayer
-          (position 8.00 361.00)
-          (bounds 784.00 10.00)
-          (opacity 0.00)
-        )
       )
     )
   )
index 331309e..6e996d0 100644 (file)
             (GraphicsLayer
               (position 1.00 1.00)
               (bounds 120.00 460.00)
-              (children 4
+              (children 3
                 (GraphicsLayer
                   (position 10.00 10.00)
                   (bounds 100.00 100.00)
                   (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
                 )
                 (GraphicsLayer
-                  (position 10.00 120.00)
-                  (bounds 100.00 100.00)
-                )
-                (GraphicsLayer
                   (position 10.00 230.00)
                   (bounds 100.00 100.00)
                   (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -220.00 0.00 1.00])
index bf50bbe..c909807 100644 (file)
@@ -11,31 +11,15 @@ Before:
           (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -110.00 0.00 1.00])
         )
         (GraphicsLayer
-          (position 57.00 229.00)
-          (bounds 124.00 454.00)
+          (position 47.00 229.00)
+          (bounds 144.00 454.00)
           (drawsContent 1)
-          (children 4
+          (children 1
             (GraphicsLayer
-              (position 11.00 11.00)
+              (position 21.00 11.00)
               (bounds 102.00 102.00)
               (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 -1.00 1.00])
             )
-            (GraphicsLayer
-              (position 11.00 121.00)
-              (bounds 102.00 102.00)
-              (drawsContent 1)
-            )
-            (GraphicsLayer
-              (position 11.00 231.00)
-              (bounds 102.00 102.00)
-              (drawsContent 1)
-              (transform [0.71 0.71 0.00 0.00] [-0.71 0.71 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
-            )
-            (GraphicsLayer
-              (position 11.00 341.00)
-              (bounds 102.00 102.00)
-              (drawsContent 1)
-            )
           )
         )
         (GraphicsLayer
diff --git a/LayoutTests/compositing/layer-creation/overlap-transformed-3d-expected.txt b/LayoutTests/compositing/layer-creation/overlap-transformed-3d-expected.txt
new file mode 100644 (file)
index 0000000..9128259
--- /dev/null
@@ -0,0 +1,50 @@
+Before:
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 108.00 108.00)
+          (bounds 100.00 100.00)
+          (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 -1.00 1.00])
+        )
+      )
+    )
+  )
+)
+
+After:
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 5
+        (GraphicsLayer
+          (position 108.00 108.00)
+          (bounds 100.00 100.00)
+          (transform [0.71 0.71 0.00 0.00] [-0.71 0.71 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 -1.00 1.00])
+        )
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 100.00 150.00)
+        )
+        (GraphicsLayer
+          (position 208.00 8.00)
+          (bounds 100.00 150.00)
+        )
+        (GraphicsLayer
+          (position 8.00 158.00)
+          (bounds 100.00 150.00)
+        )
+        (GraphicsLayer
+          (position 208.00 158.00)
+          (bounds 100.00 150.00)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/layer-creation/overlap-transformed-3d.html b/LayoutTests/compositing/layer-creation/overlap-transformed-3d.html
new file mode 100644 (file)
index 0000000..94ab5dc
--- /dev/null
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    .container {
+      position: relative;
+    }
+    .box {
+      position: absolute;
+      height: 150px;
+      width: 100px;
+      background-color: gray;
+    }
+    .green {
+      height: 100px;
+      background-color: green;
+    }
+    .composited {
+      -webkit-transform: translateZ(-1px);
+    }
+    .rotated-3d {
+      -webkit-transform: translateZ(-1px) rotate(45deg);
+    }
+    .top {
+      top: 0px;
+    }
+    .bottom {
+      top: 150px;
+    }
+    .left {
+      left: 0px;
+    }
+    .right {
+      left: 200px;
+    }
+    .center {
+      left: 100px;
+      top: 100px;
+    }
+    #layers {
+      position: absolute;
+      top: 350px;
+    }
+  </style>
+  <script>
+    if (window.testRunner)
+      testRunner.dumpAsText();
+
+    function runTest()
+    {
+      var layerTrees = "";
+
+      if (window.testRunner)
+        layerTrees = "Before:\n" + window.internals.layerTreeAsText(document);
+
+      // Rotate the first green box, so that it overlaps the first gray box in the container.
+      // That should force the creation of composited layers for all the other green boxes.
+      document.getElementById("green-box").classList.add("rotated-3d");
+
+      if (window.testRunner) {
+        layerTrees += "\nAfter:\n" + window.internals.layerTreeAsText(document);
+        document.getElementById('layers').innerText = layerTrees;
+        testRunner.notifyDone();
+      }
+    }
+    window.addEventListener('load', runTest, false);
+  </script>
+</head>
+<body>
+  <!--  
+    Testing that 3D transforms are not forcing layers to become composited without checking for overlapping areas first.
+    In the first state, the green box is not rotated, so it doesn't overlap the gray ones, meaning that only the gray box
+    will become composited.
+    In the second state, the green box is rotated and will overlap the following layers, meaning that they are all forced to
+    get composited.
+    In the end there should be one rotated green box in the middle and two gray bars on the margins. Gray boxes
+    should display in front.
+  -->
+  <div class="container">
+    <div id="green-box" class="box green center composited"></div>
+    <div class="box top left"></div>
+    <div class="box top right"></div>
+    <div class="box bottom left"></div>
+    <div class="box bottom right"></div>
+  </div>
+  <pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt b/LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt
new file mode 100644 (file)
index 0000000..85f808b
--- /dev/null
@@ -0,0 +1,128 @@
+123456Before:
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 108.00 108.00)
+          (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
+          (children 1
+            (GraphicsLayer
+              (anchor 50.00 50.00)
+              (bounds 1.00 1.00)
+              (preserves3D 1)
+              (transform [0.35 0.25 -0.50 0.00] [0.00 0.35 0.71 0.00] [0.35 -0.25 0.50 0.00] [0.00 0.00 0.00 1.00])
+              (children 6
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [1.00 0.00 0.00 0.00] [50.00 0.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-1.00 0.00 -0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 0.00 -50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-0.00 0.00 1.00 0.00] [0.00 1.00 0.00 0.00] [-1.00 0.00 -0.00 0.00] [-50.00 0.00 -0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 -50.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [0.00 50.00 0.00 1.00])
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
+After:
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 5
+        (GraphicsLayer
+          (position 108.00 108.00)
+          (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
+          (children 1
+            (GraphicsLayer
+              (anchor 50.00 50.00)
+              (bounds 1.00 1.00)
+              (preserves3D 1)
+              (transform [0.71 0.50 -0.50 0.00] [0.00 0.71 0.71 0.00] [0.71 -0.50 0.50 0.00] [0.00 0.00 0.00 1.00])
+              (children 6
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [1.00 0.00 0.00 0.00] [50.00 0.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-1.00 0.00 -0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 0.00 -50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-0.00 0.00 1.00 0.00] [0.00 1.00 0.00 0.00] [-1.00 0.00 -0.00 0.00] [-50.00 0.00 -0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 -50.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [0.00 50.00 0.00 1.00])
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 100.00 150.00)
+        )
+        (GraphicsLayer
+          (position 208.00 8.00)
+          (bounds 100.00 150.00)
+        )
+        (GraphicsLayer
+          (position 8.00 158.00)
+          (bounds 100.00 150.00)
+        )
+        (GraphicsLayer
+          (position 208.00 158.00)
+          (bounds 100.00 150.00)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d.html b/LayoutTests/compositing/layer-creation/overlap-transformed-preserved-3d.html
new file mode 100644 (file)
index 0000000..0445f1b
--- /dev/null
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    .container {
+      position: relative;
+    }
+    .box {
+      position: absolute;
+      height: 150px;
+      width: 100px;
+      background-color: gray;
+    }
+    .green {
+      height: 100px;
+      background-color: green;
+    }
+    .box-container {
+      position: absolute;
+      -webkit-perspective: 200;
+      -webkit-perspective-origin: 50px 50px;
+     }
+     .rotate-3d-start {
+        -webkit-transform: scale(0.5) rotateX(45deg) rotateY(45deg);
+        -webkit-transform-origin: 50px 50px;
+        -webkit-transform-style: preserve-3d;
+     }
+     .rotate-3d-end {
+        -webkit-transform: scale(1.0) rotateX(45deg) rotateY(45deg);
+      }
+    .top {
+      top: 0px;
+    }
+    .bottom {
+      top: 150px;
+    }
+    .left {
+      left: 0px;
+    }
+    .right {
+      left: 200px;
+    }
+    .center {
+      left: 100px;
+      top: 100px;
+    }
+    #layers {
+      position: absolute;
+      top: 350px;
+    }
+    .side {
+      position: absolute;
+      width: 98px;
+      height: 88px;
+      text-align: center;
+      padding-top: 10px;
+      background: rgba(0, 255, 0, 0.8);
+      font-weight: bold;
+      border: 1px solid green;
+      -webkit-transform-origin: 50% 50%;
+    }
+    .side-1 {
+      -webkit-transform: translateZ(50px);
+    }
+    .side-2 {
+      -webkit-transform: rotateY(90deg) translateZ(50px);
+    }
+    .side-3 {
+      -webkit-transform: rotateY(180deg) translateZ(50px);
+    }
+    .side-4 {
+      -webkit-transform: rotateY(270deg) translateZ(50px);
+    }
+    .side-5 {
+      -webkit-transform: rotateX(90deg) translateZ(50px);
+    }
+    .side-6 {
+      -webkit-transform: rotateX(-90deg) translateZ(50px);
+    }
+  </style>
+  <script>
+    if (window.testRunner)
+      testRunner.dumpAsText();
+
+    function runTest()
+    {
+      var layerTrees = "";
+
+      if (window.testRunner)
+        layerTrees = "Before:\n" + window.internals.layerTreeAsText(document);
+
+      // Rotate the first green box, so that it overlaps the first gray box in the container.
+      // That should force the creation of composited layers for all the other green boxes.
+      document.getElementById("camera").classList.add("rotate-3d-end");
+
+      if (window.testRunner) {
+        layerTrees += "\nAfter:\n" + window.internals.layerTreeAsText(document);
+        document.getElementById('layers').innerText = layerTrees;
+        testRunner.notifyDone();
+      }
+    }
+    window.addEventListener('load', runTest, false);
+  </script>
+</head>
+<body>
+  <!--  
+    Testing that 3D transforms are not forcing layers to become composited without checking for overlapping areas first.
+    In the first state, the green box is not rotated, so it doesn't overlap the gray ones, meaning that only the gray box
+    will become composited.
+    In the second state, the green box is rotated and will overlap the following layers, meaning that they are all forced to
+    get composited.
+    In the end there should be one rotated green box in the middle and two gray bars on the margins. Gray boxes
+    should display in front.
+  -->
+  <div class="container">
+    <div id="green-box" class="center box-container">
+      <div id="camera" class="rotate-3d-start">
+        <div class="side side-1">1</div>
+        <div class="side side-2">2</div>
+        <div class="side side-3">3</div>
+        <div class="side side-4">4</div>
+        <div class="side side-5">5</div>
+        <div class="side side-6">6</div>
+      </div>
+    </div>
+      <div class="box top left"></div>
+      <div class="box top right"></div>
+      <div class="box bottom left"></div>
+      <div class="box bottom right"></div>
+    </div>
+  <pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
\ No newline at end of file
index 8dfeb97..dba4726 100644 (file)
             (GraphicsLayer
               (position 1.00 1.00)
               (bounds 120.00 240.00)
-              (children 2
+              (children 1
                 (GraphicsLayer
                   (position 10.00 10.00)
                   (bounds 100.00 100.00)
                   (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
                 )
-                (GraphicsLayer
-                  (position 10.00 120.00)
-                  (bounds 100.00 100.00)
-                )
               )
             )
           )
index b3eb7a7..1bda4a0 100644 (file)
@@ -3,7 +3,7 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 6
+      (children 4
         (GraphicsLayer
           (position 48.00 38.00)
           (bounds 60.00 70.00)
         (GraphicsLayer
           (position 240.00 38.00)
           (bounds 60.00 70.00)
-          (drawsContent 1)
-        )
-        (GraphicsLayer
-          (position 240.00 38.00)
-          (bounds 60.00 70.00)
-          (children 1
-            (GraphicsLayer
-              (position 0.00 1.00)
-              (bounds 60.00 69.00)
-              (drawsContent 1)
-            )
-          )
-        )
-        (GraphicsLayer
-          (position 240.00 38.00)
-          (bounds 60.00 70.00)
           (children 1
             (GraphicsLayer
               (position 2.00 12.00)
@@ -45,7 +29,6 @@
         (GraphicsLayer
           (position 48.00 230.00)
           (bounds 60.00 70.00)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (bounds 60.00 70.00)
@@ -62,7 +45,6 @@
         (GraphicsLayer
           (position 240.00 230.00)
           (bounds 60.00 70.00)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (bounds 60.00 70.00)
index 0652f0b..a9696e0 100644 (file)
@@ -3,7 +3,7 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 2
+      (children 1
         (GraphicsLayer
           (position 8.00 8.00)
           (bounds 144.00 144.00)
             )
           )
         )
-        (GraphicsLayer
-          (position 8.00 165.00)
-          (bounds 784.00 15.00)
-          (opacity 0.00)
-          (drawsContent 1)
-        )
       )
     )
   )
diff --git a/LayoutTests/platform/chromium-win/compositing/geometry/ancestor-overflow-change-expected.txt b/LayoutTests/platform/chromium-win/compositing/geometry/ancestor-overflow-change-expected.txt
deleted file mode 100644 (file)
index adccf7e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-(GraphicsLayer
-  (bounds 800.00 600.00)
-  (children 1
-    (GraphicsLayer
-      (bounds 800.00 600.00)
-      (children 2
-        (GraphicsLayer
-          (position 6.00 6.00)
-          (bounds 104.00 104.00)
-          (drawsContent 1)
-          (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
-        )
-        (GraphicsLayer
-          (position 6.00 119.00)
-          (bounds 788.00 20.00)
-          (opacity 0.00)
-          (drawsContent 1)
-        )
-      )
-    )
-  )
-)
-
diff --git a/LayoutTests/platform/chromium-win/css3/filters/filtered-compositing-descendant-expected.txt b/LayoutTests/platform/chromium-win/css3/filters/filtered-compositing-descendant-expected.txt
deleted file mode 100644 (file)
index ee57437..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-(GraphicsLayer
-  (bounds 800.00 600.00)
-  (children 1
-    (GraphicsLayer
-      (bounds 800.00 600.00)
-      (children 2
-        (GraphicsLayer
-          (position 8.00 8.00)
-          (bounds 144.00 144.00)
-          (drawsContent 1)
-          (children 1
-            (GraphicsLayer
-              (position 22.00 22.00)
-              (bounds 100.00 100.00)
-              (drawsContent 1)
-              (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
-            )
-          )
-        )
-        (GraphicsLayer
-          (position 8.00 165.00)
-          (bounds 784.00 16.00)
-          (opacity 0.00)
-          (drawsContent 1)
-        )
-      )
-    )
-  )
-)
-
index e36d2c7..b67c0de 100644 (file)
@@ -3,19 +3,13 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 2
+      (children 1
         (GraphicsLayer
           (position 6.00 6.00)
           (bounds 104.00 104.00)
           (drawsContent 1)
           (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
         )
-        (GraphicsLayer
-          (position 6.00 119.00)
-          (bounds 788.00 19.00)
-          (opacity 0.00)
-          (drawsContent 1)
-        )
       )
     )
   )
index 3255b7c..5504083 100644 (file)
@@ -5,7 +5,7 @@ Test CSS clip with composited layers. Left and right sides should look the same.
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 3
+      (children 2
         (GraphicsLayer
           (position 20.00 20.00)
           (bounds 100.00 100.00)
@@ -13,11 +13,6 @@ Test CSS clip with composited layers. Left and right sides should look the same.
           (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
         )
         (GraphicsLayer
-          (position 220.00 20.00)
-          (bounds 100.00 100.00)
-          (drawsContent 1)
-        )
-        (GraphicsLayer
           (position 215.00 15.00)
           (bounds 110.00 110.00)
           (children 1
index dd1f32c..634ec42 100644 (file)
@@ -5,7 +5,7 @@ Test CSS clip with composited layers. Left and right sides should look the same.
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 3
+      (children 2
         (GraphicsLayer
           (position 25.00 35.00)
           (anchor 0.50 0.44)
@@ -16,11 +16,6 @@ Test CSS clip with composited layers. Left and right sides should look the same.
         (GraphicsLayer
           (position 225.00 35.00)
           (bounds 90.00 80.00)
-          (drawsContent 1)
-        )
-        (GraphicsLayer
-          (position 225.00 35.00)
-          (bounds 90.00 80.00)
           (children 1
             (GraphicsLayer
               (position -15.00 -25.00)
index 1a44182..3bf769d 100644 (file)
@@ -4,7 +4,7 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 3
+      (children 2
         (GraphicsLayer
           (position 18.00 18.00)
           (bounds 320.00 320.00)
             )
           )
         )
-        (GraphicsLayer
-          (position 8.00 361.00)
-          (bounds 784.00 10.00)
-          (opacity 0.00)
-        )
       )
     )
   )
index 6856334..6218301 100644 (file)
@@ -18,7 +18,7 @@
             (GraphicsLayer
               (position 1.00 1.00)
               (bounds 120.00 460.00)
-              (children 4
+              (children 3
                 (GraphicsLayer
                   (position 10.00 10.00)
                   (bounds 100.00 100.00)
                   (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
                 )
                 (GraphicsLayer
-                  (position 10.00 120.00)
-                  (bounds 100.00 100.00)
-                  (drawsContent 1)
-                )
-                (GraphicsLayer
                   (position 10.00 230.00)
                   (bounds 100.00 100.00)
                   (drawsContent 1)
index 2eb1078..b48c994 100644 (file)
@@ -12,32 +12,16 @@ Before:
           (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -110.00 0.00 1.00])
         )
         (GraphicsLayer
-          (position 57.00 229.00)
-          (bounds 124.00 454.00)
+          (position 47.00 229.00)
+          (bounds 144.00 454.00)
           (drawsContent 1)
-          (children 4
+          (children 1
             (GraphicsLayer
-              (position 11.00 11.00)
+              (position 21.00 11.00)
               (bounds 102.00 102.00)
               (drawsContent 1)
               (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 -1.00 1.00])
             )
-            (GraphicsLayer
-              (position 11.00 121.00)
-              (bounds 102.00 102.00)
-              (drawsContent 1)
-            )
-            (GraphicsLayer
-              (position 11.00 231.00)
-              (bounds 102.00 102.00)
-              (drawsContent 1)
-              (transform [0.71 0.71 0.00 0.00] [-0.71 0.71 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
-            )
-            (GraphicsLayer
-              (position 11.00 341.00)
-              (bounds 102.00 102.00)
-              (drawsContent 1)
-            )
           )
         )
         (GraphicsLayer
diff --git a/LayoutTests/platform/chromium/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt b/LayoutTests/platform/chromium/compositing/layer-creation/overlap-transformed-preserved-3d-expected.txt
new file mode 100644 (file)
index 0000000..d826296
--- /dev/null
@@ -0,0 +1,132 @@
+123456Before:
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 108.00 108.00)
+          (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
+          (children 1
+            (GraphicsLayer
+              (anchor 50.00 50.00)
+              (bounds 1.00 1.00)
+              (preserves3D 1)
+              (transform [0.35 0.25 -0.50 0.00] [0.00 0.35 0.71 0.00] [0.35 -0.25 0.50 0.00] [0.00 0.00 0.00 1.00])
+              (children 6
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [1.00 0.00 0.00 0.00] [50.00 0.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-1.00 0.00 -0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 0.00 -50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-0.00 0.00 1.00 0.00] [0.00 1.00 0.00 0.00] [-1.00 0.00 -0.00 0.00] [-50.00 0.00 -0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 -50.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [0.00 50.00 0.00 1.00])
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
+After:
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 5
+        (GraphicsLayer
+          (position 108.00 108.00)
+          (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
+          (children 1
+            (GraphicsLayer
+              (anchor 50.00 50.00)
+              (bounds 1.00 1.00)
+              (preserves3D 1)
+              (transform [0.71 0.50 -0.50 0.00] [0.00 0.71 0.71 0.00] [0.71 -0.50 0.50 0.00] [0.00 0.00 0.00 1.00])
+              (children 6
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [1.00 0.00 0.00 0.00] [50.00 0.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-1.00 0.00 -0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 0.00 -50.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [-0.00 0.00 1.00 0.00] [0.00 1.00 0.00 0.00] [-1.00 0.00 -0.00 0.00] [-50.00 0.00 -0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 -50.00 0.00 1.00])
+                )
+                (GraphicsLayer
+                  (bounds 100.00 100.00)
+                  (drawsContent 1)
+                  (transform [1.00 0.00 0.00 0.00] [0.00 0.00 -1.00 0.00] [0.00 1.00 0.00 0.00] [0.00 50.00 0.00 1.00])
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 100.00 150.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 208.00 8.00)
+          (bounds 100.00 150.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 8.00 158.00)
+          (bounds 100.00 150.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 208.00 158.00)
+          (bounds 100.00 150.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
index 90f7440..d6733bd 100644 (file)
             (GraphicsLayer
               (position 1.00 1.00)
               (bounds 120.00 240.00)
-              (children 2
+              (children 1
                 (GraphicsLayer
                   (position 10.00 10.00)
                   (bounds 100.00 100.00)
                   (drawsContent 1)
                   (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 1.00 1.00])
                 )
-                (GraphicsLayer
-                  (position 10.00 120.00)
-                  (bounds 100.00 100.00)
-                  (drawsContent 1)
-                )
               )
             )
           )
index 2c4dff2..d040cdb 100644 (file)
@@ -3,7 +3,7 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 6
+      (children 4
         (GraphicsLayer
           (position 48.00 38.00)
           (bounds 60.00 70.00)
         (GraphicsLayer
           (position 240.00 38.00)
           (bounds 60.00 70.00)
-          (drawsContent 1)
-        )
-        (GraphicsLayer
-          (position 240.00 38.00)
-          (bounds 60.00 70.00)
-          (children 1
-            (GraphicsLayer
-              (position 0.00 1.00)
-              (bounds 60.00 69.00)
-              (drawsContent 1)
-            )
-          )
-        )
-        (GraphicsLayer
-          (position 240.00 38.00)
-          (bounds 60.00 70.00)
           (children 1
             (GraphicsLayer
               (position 2.00 12.00)
@@ -47,7 +31,6 @@
         (GraphicsLayer
           (position 48.00 230.00)
           (bounds 60.00 70.00)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (bounds 60.00 70.00)
@@ -65,7 +48,6 @@
         (GraphicsLayer
           (position 240.00 230.00)
           (bounds 60.00 70.00)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (bounds 60.00 70.00)
index 66d755b..0311e39 100644 (file)
@@ -3,7 +3,7 @@
   (children 1
     (GraphicsLayer
       (bounds 800.00 600.00)
-      (children 2
+      (children 1
         (GraphicsLayer
           (position 8.00 8.00)
           (bounds 144.00 144.00)
             )
           )
         )
-        (GraphicsLayer
-          (position 8.00 165.00)
-          (bounds 784.00 15.00)
-          (opacity 0.00)
-          (drawsContent 1)
-        )
       )
     )
   )
index 4f971b7..7e53895 100644 (file)
@@ -1,3 +1,25 @@
+2013-01-15  Alexandru Chiculita  <achicu@adobe.com>
+
+        [Compositor] Do not disable overlap testing for layers in front of 3D transformed layers
+        https://bugs.webkit.org/show_bug.cgi?id=106721
+
+        Reviewed by Simon Fraser.
+
+        RenderLayerCompositor is checking for overlapping layers and tries to figure out all the layers that need
+        to be drawn using composited layers. It doesn't know anything about animations yet and it only works with "start"
+        and "end" states. However, it knows that animations might happen, so in that cases it will avoid to do any optimizations,
+        as layers might get moved.
+
+        The overlapping layers optimization was also disabled for 3D layers. However, 3D layers can be computed in WebKit and 
+        can be checked for overlap using just the "start"/"stop" states. In this patch I enable that optimization for 3D layers, too.
+        The result is that more layers are drawn in software mode now, so I've updated a couple of test results.
+
+        Tests: compositing/layer-creation/overlap-transformed-3d.html
+               compositing/layer-creation/overlap-transformed-preserved-3d.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+
 2013-01-15  Elliott Sprehn  <esprehn@gmail.com>
 
         HTML parser should queue MutationRecords for its operations
index 008e478..1de3f88 100644 (file)
@@ -965,10 +965,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
     // so test that again.
     bool isCompositedClippingLayer = canBeComposited(layer) && clipsCompositingDescendants(layer);
 
-    // Turn overlap testing off for later layers if it's already off, or if we have a 3D transform or an animating transform.
+    // Turn overlap testing off for later layers if it's already off, or if we have an animating transform.
     // Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because
     // we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map.
-    if ((!childState.m_testingOverlap && !isCompositedClippingLayer) || layer->has3DTransform() || isRunningAcceleratedTransformAnimation(layer->renderer()))
+    if ((!childState.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer()))
         compositingState.m_testingOverlap = false;
     
     if (isCompositedClippingLayer) {