Fix compositing layers in columns when in paginated mode
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 22:17:10 +0000 (22:17 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 22:17:10 +0000 (22:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91425

Reviewed by Dave Hyatt.

Source/WebCore:

Enhance a hack that was added to allow composited layers to
display in columns to work for paginated mode, where the
RenderView is renderer with columns.

Test: compositing/columns/composited-in-paginated.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition):

LayoutTests:

Testcase with a composited layer in a paginated document,
that dumps layers.

* compositing/columns/composited-in-paginated-expected.txt: Added.
* compositing/columns/composited-in-paginated.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/columns/composited-in-paginated-expected.txt [new file with mode: 0644]
LayoutTests/compositing/columns/composited-in-paginated.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index ea14ee6..fde8bdb 100644 (file)
@@ -1,3 +1,16 @@
+2012-07-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Fix compositing layers in columns when in paginated mode
+        https://bugs.webkit.org/show_bug.cgi?id=91425
+
+        Reviewed by Dave Hyatt.
+
+        Testcase with a composited layer in a paginated document,
+        that dumps layers.
+
+        * compositing/columns/composited-in-paginated-expected.txt: Added.
+        * compositing/columns/composited-in-paginated.html: Added.
+
 2012-07-16  Emil A Eklund  <eae@chromium.org>
 
         Inconsistent rounding in table layout causes background color to bleed through
diff --git a/LayoutTests/compositing/columns/composited-in-paginated-expected.txt b/LayoutTests/compositing/columns/composited-in-paginated-expected.txt
new file mode 100644 (file)
index 0000000..cf71907
--- /dev/null
@@ -0,0 +1,16 @@
+(GraphicsLayer
+  (bounds 1600.00 585.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 1600.00 585.00)
+      (children 1
+        (GraphicsLayer
+          (position 818.00 145.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/columns/composited-in-paginated.html b/LayoutTests/compositing/columns/composited-in-paginated.html
new file mode 100644 (file)
index 0000000..f7ba8f5
--- /dev/null
@@ -0,0 +1,44 @@
+<html>
+<head>
+    <script>
+        if (window.testRunner)
+          testRunner.dumpAsText();
+
+        if (window.internals)
+            internals.setPagination(document, "LeftToRightPaginated", 0);
+            
+        function dumpLayers()
+        {
+            if (window.testRunner)
+                document.getElementById('layers').innerText = testRunner.layerTreeAsText();
+        }
+        window.addEventListener('load', dumpLayers, false);
+    </script>
+    <style>
+    .spacer {
+      height: 350px;
+      width: 100%;
+      margin: 10px;
+      background-color: silver;
+    }
+    
+    .box {
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      background-color: blue;
+    }
+    .composited {
+      -webkit-transform: translateZ(0);
+    }
+    </style>
+</head>
+<body>
+
+  <div class="spacer"></div>
+  <div class="spacer"></div>
+  <div class="composited box"></div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+
+</body>
+</html>
index a080376..c437bf2 100644 (file)
@@ -1,3 +1,19 @@
+2012-07-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Fix compositing layers in columns when in paginated mode
+        https://bugs.webkit.org/show_bug.cgi?id=91425
+
+        Reviewed by Dave Hyatt.
+
+        Enhance a hack that was added to allow composited layers to
+        display in columns to work for paginated mode, where the
+        RenderView is renderer with columns.
+
+        Test: compositing/columns/composited-in-paginated.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPosition):
+
 2012-07-16  Emil A Eklund  <eae@chromium.org>
 
         Inconsistent rounding in table layout causes background color to bleed through
index 31be2e8..a59a1b3 100644 (file)
@@ -842,7 +842,11 @@ void RenderLayer::updateLayerPosition()
             // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
             // They won't split across columns properly.
             LayoutSize columnOffset;
-            parent()->renderer()->adjustForColumns(columnOffset, localPoint);
+            if (!parent()->renderer()->hasColumns() && parent()->renderer()->isRoot() && renderer()->view()->hasColumns())
+                renderer()->view()->adjustForColumns(columnOffset, localPoint);
+            else
+                parent()->renderer()->adjustForColumns(columnOffset, localPoint);
+
             localPoint += columnOffset;
         }