2008-12-19 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Dec 2008 22:44:10 +0000 (22:44 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Dec 2008 22:44:10 +0000 (22:44 +0000)
        Reviewed by Darin Adler

        https://bugs.webkit.org/show_bug.cgi?id=22938

        When the document element is transformed, we need to paint
        the view background to avoid unpainted areas.

        Test: fast/transforms/transformed-document-element.html

        * rendering/RenderView.cpp:
        (WebCore::RenderView::paintBoxDecorations):

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

LayoutTests/ChangeLog
LayoutTests/fast/transforms/transformed-document-element.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderView.cpp

index a87fd7d..52e1ac6 100644 (file)
@@ -1,3 +1,16 @@
+2008-12-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Darin Adler
+
+        https://bugs.webkit.org/show_bug.cgi?id=22938
+        
+        Test for painting with a transformed <html> element.
+
+        * fast/transforms/transformed-document-element.html: Added.
+        * platform/mac/fast/transforms/transformed-document-element-expected.checksum: Added.
+        * platform/mac/fast/transforms/transformed-document-element-expected.png: Added.
+        * platform/mac/fast/transforms/transformed-document-element-expected.txt: Added.
+
 2008-12-19  Pamela Greene  <pam@chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/transforms/transformed-document-element.html b/LayoutTests/fast/transforms/transformed-document-element.html
new file mode 100644 (file)
index 0000000..81a61f1
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Transform on Document</title>
+</head>
+<body style="background-color: gray">
+<p>The portions of the view exposed by the transformed document should be painted white</p>
+<script type="text/javascript" charset="utf-8">
+  // do this dynamically to avoid pixels from the previous test in potentially unpainted areas
+  document.documentElement.style.webkitTransform = 'translateY(200px) rotate(20deg)';
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.checksum b/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.checksum
new file mode 100644 (file)
index 0000000..7421c5e
--- /dev/null
@@ -0,0 +1 @@
+7dfcbb99df79538db860d7d922956af9
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.png b/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.png
new file mode 100644 (file)
index 0000000..ae3f35f
Binary files /dev/null and b/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.txt b/LayoutTests/platform/mac/fast/transforms/transformed-document-element-expected.txt
new file mode 100644 (file)
index 0000000..ea6b755
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x50
+  RenderBlock {HTML} at (0,0) size 800x50
+    RenderBody {BODY} at (8,16) size 784x18 [bgcolor=#808080]
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 553x18
+          text run at (0,0) width 553: "The portions of the view exposed by the transformed document should be painted white"
index 395b609..b37dcb4 100644 (file)
@@ -1,3 +1,17 @@
+2008-12-19  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Darin Adler
+
+        https://bugs.webkit.org/show_bug.cgi?id=22938
+        
+        When the document element is transformed, we need to paint
+        the view background to avoid unpainted areas.
+        
+        Test: fast/transforms/transformed-document-element.html
+
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::paintBoxDecorations):
+
 2008-12-19  Steve Falkenburg  <sfalken@apple.com>
 
         Fix build.
index 8262db6..03b38d4 100644 (file)
@@ -169,6 +169,12 @@ void RenderView::paint(PaintInfo& paintInfo, int tx, int ty)
     paintObject(paintInfo, tx, ty);
 }
 
+static inline bool rendererObscuresBackground(RenderObject* object)
+{
+    // FIXME: this should test opacity too.
+    return object && object->style()->visibility() == VISIBLE && !object->style()->hasTransform();
+}
+    
 void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
 {
     // Check to see if we are enclosed by a layer that requires complex painting rules.  If so, we cannot blit
@@ -185,10 +191,12 @@ void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
         }
     }
 
-    if (elt || (firstChild() && firstChild()->style()->visibility() == VISIBLE) || !view())
+    // If painting will entirely fill the view, no need to fill the background.
+    if (elt || rendererObscuresBackground(firstChild()) || !view())
         return;
 
-    // This code typically only executes if the root element's visibility has been set to hidden.
+    // This code typically only executes if the root element's visibility has been set to hidden,
+    // or there is a transform on the <html>.
     // Only fill with the base background color (typically white) if we're the root document, 
     // since iframes/frames with no background in the child document should show the parent's background.
     if (view()->isTransparent()) // FIXME: This needs to be dynamic.  We should be able to go back to blitting if we ever stop being transparent.