Title: [148117] trunk
Revision
148117
Author
ach...@adobe.com
Date
2013-04-10 11:48:01 -0700 (Wed, 10 Apr 2013)

Log Message

Layers with opacity and blur filters are reported as opaque to the compositor
https://bugs.webkit.org/show_bug.cgi?id=114295

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/contents-opaque/filter.html

Some filters like opacity and blur might still trigger transparency in the layer, even though the
background is opaque. I've added the special case in RenderLayer::backgroundIsKnownToBeOpaqueInRect to check
for filters that might have transparency. Note that this special case is required only for software drawn
filters, as the transparency is going to be backed in the GraphicsLayer content. Composited filters can
figure it out in the compositor.

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

LayoutTests:

Added test to check for blur and opacity filters drawn in software mode which needs
to force the layer report non-opaque to the compositor.

* compositing/contents-opaque/filter-expected.txt: Added.
* compositing/contents-opaque/filter.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148116 => 148117)


--- trunk/LayoutTests/ChangeLog	2013-04-10 18:37:46 UTC (rev 148116)
+++ trunk/LayoutTests/ChangeLog	2013-04-10 18:48:01 UTC (rev 148117)
@@ -1,3 +1,16 @@
+2013-04-10  Alexandru Chiculita  <ach...@adobe.com>
+
+        Layers with opacity and blur filters are reported as opaque to the compositor
+        https://bugs.webkit.org/show_bug.cgi?id=114295
+
+        Reviewed by Simon Fraser.
+
+        Added test to check for blur and opacity filters drawn in software mode which needs 
+        to force the layer report non-opaque to the compositor.
+
+        * compositing/contents-opaque/filter-expected.txt: Added.
+        * compositing/contents-opaque/filter.html: Added.
+
 2013-04-10  Noam Rosenthal  <n...@webkit.org>
 
         [Texmap] In certain situations nested blending with overflow:hidden displays clipped results

Added: trunk/LayoutTests/compositing/contents-opaque/filter-expected.txt (0 => 148117)


--- trunk/LayoutTests/compositing/contents-opaque/filter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/filter-expected.txt	2013-04-10 18:48:01 UTC (rev 148117)
@@ -0,0 +1,22 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 10.00 10.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 10.00 120.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/contents-opaque/filter.html (0 => 148117)


--- trunk/LayoutTests/compositing/contents-opaque/filter.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/contents-opaque/filter.html	2013-04-10 18:48:01 UTC (rev 148117)
@@ -0,0 +1,58 @@
+<html>
+    <head>
+        <style type="text/css">
+            body {
+                margin: 0;
+            }
+            .layer {
+                position: absolute;
+                top: 0;
+                left: 0;
+            }
+            .container-box {
+                margin: 10px;
+                width: 100px;
+                height: 100px;
+                overflow: hidden;
+            }
+            .box {
+                width: 100px;
+                height: 100px;
+                background-color: green;
+            }
+            .composited {
+                -webkit-transform: translateZ(0);
+            }
+            .filter-blur {
+                -webkit-filter: blur(10px);
+            }
+            .filter-opacity {
+                -webkit-filter: opacity(50%);
+            }
+        </style>
+        <script type="text/_javascript_">
+            if (window.testRunner)
+                testRunner.dumpAsText();
+
+            function doTest() {
+                if (window.testRunner && window.internals)
+                    document.getElementById('layertree').innerText = window.internals.layerTreeAsText(document);
+            }
+            window.addEventListener('load', doTest, false);
+        </script>
+    </head>
+    <body>
+        <!-- There should be 2 boxes with different shades of green:
+            Box 1. There should be a white gradient on the margins.
+            Box 2. Light green box.
+        -->
+        <!-- GraphicsLayer::contentsOpaque for these boxes should be false. -->
+        <div class="composited container-box">
+            <div class="box filter-blur"></div>
+        </div>
+        <div class="composited container-box">
+            <div class="box filter-opacity"></div>
+        </div>
+        <pre id="layertree"></pre>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (148116 => 148117)


--- trunk/Source/WebCore/ChangeLog	2013-04-10 18:37:46 UTC (rev 148116)
+++ trunk/Source/WebCore/ChangeLog	2013-04-10 18:48:01 UTC (rev 148117)
@@ -1,3 +1,21 @@
+2013-04-10  Alexandru Chiculita  <ach...@adobe.com>
+
+        Layers with opacity and blur filters are reported as opaque to the compositor
+        https://bugs.webkit.org/show_bug.cgi?id=114295
+
+        Reviewed by Simon Fraser.
+
+        Test: compositing/contents-opaque/filter.html
+
+        Some filters like opacity and blur might still trigger transparency in the layer, even though the
+        background is opaque. I've added the special case in RenderLayer::backgroundIsKnownToBeOpaqueInRect to check
+        for filters that might have transparency. Note that this special case is required only for software drawn
+        filters, as the transparency is going to be backed in the GraphicsLayer content. Composited filters can
+        figure it out in the compositor.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::backgroundIsKnownToBeOpaqueInRect):
+
 2013-04-10  Noam Rosenthal  <n...@webkit.org>
 
         [Texmap] In certain situations nested blending with overflow:hidden displays clipped results

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (148116 => 148117)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-04-10 18:37:46 UTC (rev 148116)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-04-10 18:48:01 UTC (rev 148117)
@@ -5566,6 +5566,11 @@
     if (paintsWithTransparency(PaintBehaviorNormal))
         return false;
 
+#if ENABLE(CSS_FILTERS)
+    if (paintsWithFilters() && renderer()->style()->filter().hasFilterThatAffectsOpacity())
+        return false;
+#endif
+
     // FIXME: Handle simple transforms.
     if (paintsWithTransform(PaintBehaviorNormal))
         return false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to