2008-12-23 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Dec 2008 05:23:36 +0000 (05:23 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Dec 2008 05:23:36 +0000 (05:23 +0000)
        Reviewed by Dan Bernstein

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

        If the document element has opacity, we need to erase the view background to
        white before painting.

        Test: fast/backgrounds/opacity-on-document-element.html

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

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

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

index cfa879a..74475a8 100644 (file)
@@ -2,6 +2,23 @@
 
         Reviewed by Dan Bernstein
 
+        https://bugs.webkit.org/show_bug.cgi?id=22941
+        
+        Add test for opacity on the document element.
+
+        * fast/backgrounds/opacity-on-document-element.html: Added.
+        * platform/mac/fast/backgrounds/opacity-on-document-element-expected.checksum: Added.
+        * platform/mac/fast/backgrounds/opacity-on-document-element-expected.png: Added.
+        * platform/mac/fast/backgrounds/opacity-on-document-element-expected.txt: Added.
+        
+        * fast/transforms/identity-matrix.html:
+        * platform/mac/fast/transforms/identity-matrix-expected.txt:
+        Fix typo
+
+2008-12-23  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dan Bernstein
+
         https://bugs.webkit.org/show_bug.cgi?id=21910
         
         Re-create expected images after fixing painting issue with SVGImage.
diff --git a/LayoutTests/fast/backgrounds/opacity-on-document-element.html b/LayoutTests/fast/backgrounds/opacity-on-document-element.html
new file mode 100644 (file)
index 0000000..fb2607e
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Opacity on Document</title>
+  <style type="text/css" media="screen">
+    html {
+      background-color: blue;
+    }
+    body {
+      margin: 50px;
+      background-color: gray;
+    }
+  </style>
+</head>
+<body>
+<p>The document background should be red, and the body gray. The rest of the viewport should be white. The document and body should have opacity of 0.3.</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.backgroundColor = 'green';
+  document.documentElement.style.opacity = 0.3;
+</script>
+</body>
+</html>
index cefbe73..67c3e81 100644 (file)
@@ -12,7 +12,7 @@
 </style>
 </head>
 <body>
-The following divs should be idential:
+The following divs should be identical:
     <br>
 
     <div></div>
diff --git a/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.checksum b/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.checksum
new file mode 100644 (file)
index 0000000..424e9d7
--- /dev/null
@@ -0,0 +1 @@
+ee6700349c38450ed8ec4116e6126d07
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png b/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png
new file mode 100644 (file)
index 0000000..13d204e
Binary files /dev/null and b/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.txt b/LayoutTests/platform/mac/fast/backgrounds/opacity-on-document-element-expected.txt
new file mode 100644 (file)
index 0000000..5d953ef
--- /dev/null
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x136
+  RenderBlock {HTML} at (0,0) size 800x136 [bgcolor=#008000]
+    RenderBody {BODY} at (50,50) size 700x36 [bgcolor=#808080]
+      RenderBlock {P} at (0,0) size 700x36
+        RenderText {#text} at (0,0) size 677x36
+          text run at (0,0) width 677: "The document background should be red, and the body gray. The rest of the viewport should be white. The"
+          text run at (0,18) width 300: "document and body should have opacity of 0.3."
index 0025291..6e7509d 100644 (file)
@@ -3,8 +3,8 @@ layer at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderText {#text} at (0,0) size 243x18
-        text run at (0,0) width 243: "The following divs should be idential: "
+      RenderText {#text} at (0,0) size 250x18
+        text run at (0,0) width 250: "The following divs should be identical: "
       RenderBR {BR} at (0,0) size 0x0
       RenderBlock (floating) {DIV} at (5,23) size 110x110 [bgcolor=#87CEEB] [border: (5px solid #000000)]
       RenderText {#text} at (0,0) size 0x0
index c280af2..991e9ba 100644 (file)
@@ -2,6 +2,20 @@
 
         Reviewed by Dan Bernstein
 
+        https://bugs.webkit.org/show_bug.cgi?id=22941
+        
+        If the document element has opacity, we need to erase the view background to
+        white before painting.
+        
+        Test: fast/backgrounds/opacity-on-document-element.html
+
+        * rendering/RenderView.cpp:
+        (WebCore::rendererObscuresBackground):
+
+2008-12-23  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dan Bernstein
+
         https://bugs.webkit.org/show_bug.cgi?id=21910
         
         Fix SVGImage painting by ensuring that the SVGImage resizes its FrameView correctly.
index 03b38d4..ac626ae 100644 (file)
@@ -171,8 +171,7 @@ void RenderView::paint(PaintInfo& paintInfo, int tx, int ty)
 
 static inline bool rendererObscuresBackground(RenderObject* object)
 {
-    // FIXME: this should test opacity too.
-    return object && object->style()->visibility() == VISIBLE && !object->style()->hasTransform();
+    return object && object->style()->visibility() == VISIBLE && object->style()->opacity() == 1 && !object->style()->hasTransform();
 }
     
 void RenderView::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)