2009-12-04 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 23:18:53 +0000 (23:18 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 23:18:53 +0000 (23:18 +0000)
        Reviewed by Dan Bernstein.

        <rdar://problem/7441571> Hardware-backed layers are skipped when printing

        When printing, set the PaintBehaviorFlattenCompositingLayers flag so that compositing layers
        paint. This also causes 3D transforms to be flattened to 2D.

        Test: printing/compositing-layer-printing.html

        * page/FrameView.cpp:
        (WebCore::FrameView::paintContents):

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

LayoutTests/ChangeLog
LayoutTests/printing/compositing-layer-printing-expected.pdf [new file with mode: 0644]
LayoutTests/printing/compositing-layer-printing.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/FrameView.cpp

index 5d682663c5ac6622d1823dff84f322bd5eb2425d..6f2c99fab876d9a98819579396d5ec9b6f8013da 100644 (file)
@@ -1,3 +1,14 @@
+2009-12-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/7441571> Hardware-backed layers are skipped when printing
+        
+        Testcase for printing with a compositing layer.
+
+        * printing/compositing-layer-printing-expected.pdf: Added.
+        * printing/compositing-layer-printing.html: Added.
+
 2009-12-04  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
 
         Skip test that is failing because of new behaviour enforced by
diff --git a/LayoutTests/printing/compositing-layer-printing-expected.pdf b/LayoutTests/printing/compositing-layer-printing-expected.pdf
new file mode 100644 (file)
index 0000000..ad30f28
Binary files /dev/null and b/LayoutTests/printing/compositing-layer-printing-expected.pdf differ
diff --git a/LayoutTests/printing/compositing-layer-printing.html b/LayoutTests/printing/compositing-layer-printing.html
new file mode 100644 (file)
index 0000000..ca7efa2
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Printing compositing layers</title>
+  <style type="text/css">
+    .box {
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      background-color: green;
+    }
+  </style>
+  <script>
+    if (window.layoutTestController)
+      layoutTestController.printToPDF();
+  </script>
+</head>
+<body>
+  <p>You should see two green squares below on screen, and when printed.</p>
+  <div class="box"></div>
+  <div class="box" style="-webkit-transform: translateZ(0)"></div>
+</body>
+</html>
index c17ffbd9a9865d43f4c62322a073dc68568b6156..3ad456facbbbd9c33a943b40266fa5e2e4fb1bf6 100644 (file)
@@ -1,3 +1,17 @@
+2009-12-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/7441571> Hardware-backed layers are skipped when printing
+        
+        When printing, set the PaintBehaviorFlattenCompositingLayers flag so that compositing layers
+        paint. This also causes 3D transforms to be flattened to 2D.
+
+        Test: printing/compositing-layer-printing.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintContents):
+
 2009-12-04  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Beth Dakin.
index 49f741ee6d52c582793783f8f696a7c17569a8ff..0b264f770898676e0acfe0ad49a1ec96a1fc0a3b 100644 (file)
@@ -1699,9 +1699,15 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
         
     // m_nodeToDraw is used to draw only one element (and its descendants)
     RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
-    if (m_paintBehavior == PaintBehaviorNormal)
+
+    PaintBehavior paintBehavior = m_paintBehavior;
+    if (paintBehavior == PaintBehaviorNormal)
         document->invalidateRenderedRectsForMarkersInRect(rect);
-    contentRenderer->layer()->paint(p, rect, m_paintBehavior, eltRenderer);
+
+    if (document->printing())
+        paintBehavior |= PaintBehaviorFlattenCompositingLayers;
+
+    contentRenderer->layer()->paint(p, rect, paintBehavior, eltRenderer);
     
     m_isPainting = false;
     m_lastPaintTime = currentTime();