Title: [155131] trunk
Revision
155131
Author
[email protected]
Date
2013-09-05 10:56:58 -0700 (Thu, 05 Sep 2013)

Log Message

Source/WebCore: Fix repaint issue on "paints into ancestor" filtered layers
https://bugs.webkit.org/show_bug.cgi?id=120780

Reviewed by Tim Horton.

When a repaint happened on a layer with a filter, and which paints into
its compositing ancestor, we'd repaint the wrong layer (and assert).

Fix by ensuring that RenderLayer::enclosingFilterLayer() takes paintsIntoCompositedAncestor()
into account, by adding a function that we share between three callers who
check isComposited() && !paintsIntoCompositedAncestor(). I didn't use a function
on RenderLayer, because I wanted it to be inline but to not #include RenderLayerBacking
in RenderLayer.h.

Test: compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html

* dom/Node.cpp: Drive-by removal of #include "RenderLayer.h"
* rendering/RenderLayer.cpp:
(WebCore::compositedWithOwnBackingStore):
(WebCore::RenderLayer::enclosingCompositingLayerForRepaint):
(WebCore::RenderLayer::enclosingFilterRepaintLayer):
(WebCore::RenderLayer::clippingRootForPainting):

LayoutTests: Fix repaint issue on "paints into ancestor" filtered layers
https://bugs.webkit.org/show_bug.cgi?id=120780
<rdar://problem/14884148>

Reviewed by Tim Horton.

Ref test for opacity change on a filtered layer which paints into its compositing ancestor.

* compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html: Added.
* compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (155130 => 155131)


--- trunk/LayoutTests/ChangeLog	2013-09-05 17:54:11 UTC (rev 155130)
+++ trunk/LayoutTests/ChangeLog	2013-09-05 17:56:58 UTC (rev 155131)
@@ -1,3 +1,16 @@
+2013-09-05  Simon Fraser  <[email protected]>
+
+        Fix repaint issue on "paints into ancestor" filtered layers
+        https://bugs.webkit.org/show_bug.cgi?id=120780
+        <rdar://problem/14884148>
+
+        Reviewed by Tim Horton.
+        
+        Ref test for opacity change on a filtered layer which paints into its compositing ancestor.
+
+        * compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html: Added.
+        * compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html: Added.
+
 2013-09-05  Danilo Cesar Lemes de Paula  <[email protected]>
 
         [GTK] improving tests expectations related to trackmenu

Added: trunk/LayoutTests/compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html (0 => 155131)


--- trunk/LayoutTests/compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html	2013-09-05 17:56:58 UTC (rev 155131)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            overflow: hidden;
+            position: absolute;
+            z-index: 1;
+            border: 1px solid black;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .box {
+          width: 100px;
+          height: 100px;
+          margin: 10px;
+          background-color: blue;
+        }
+        
+        .filtered {
+            -webkit-filter: blur(2px);
+            opacity: 0.8;
+        }
+    </style>
+</head>
+<body>
+
+    <div class="container">
+        <div class="filtered box"></div>
+        <div class="composited box"></div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html (0 => 155131)


--- trunk/LayoutTests/compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html	2013-09-05 17:56:58 UTC (rev 155131)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            overflow: hidden;
+            position: absolute;
+            z-index: 1;
+            border: 1px solid black;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+        .box {
+          width: 100px;
+          height: 100px;
+          margin: 10px;
+          background-color: blue;
+        }
+        
+        .filtered {
+            -webkit-filter: blur(2px);
+            opacity: 0.2;
+        }
+        
+        .filtered.changed {
+            opacity: 0.8;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.getElementById('target').classList.add('changed');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="container">
+        <div id="target" class="filtered box"></div>
+        <div class="composited box"></div>
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (155130 => 155131)


--- trunk/Source/WebCore/ChangeLog	2013-09-05 17:54:11 UTC (rev 155130)
+++ trunk/Source/WebCore/ChangeLog	2013-09-05 17:56:58 UTC (rev 155131)
@@ -1,3 +1,28 @@
+2013-09-05  Simon Fraser  <[email protected]>
+
+        Fix repaint issue on "paints into ancestor" filtered layers
+        https://bugs.webkit.org/show_bug.cgi?id=120780
+
+        Reviewed by Tim Horton.
+        
+        When a repaint happened on a layer with a filter, and which paints into
+        its compositing ancestor, we'd repaint the wrong layer (and assert).
+        
+        Fix by ensuring that RenderLayer::enclosingFilterLayer() takes paintsIntoCompositedAncestor()
+        into account, by adding a function that we share between three callers who
+        check isComposited() && !paintsIntoCompositedAncestor(). I didn't use a function
+        on RenderLayer, because I wanted it to be inline but to not #include RenderLayerBacking
+        in RenderLayer.h.
+
+        Test: compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html
+
+        * dom/Node.cpp: Drive-by removal of #include "RenderLayer.h"
+        * rendering/RenderLayer.cpp: 
+        (WebCore::compositedWithOwnBackingStore):
+        (WebCore::RenderLayer::enclosingCompositingLayerForRepaint):
+        (WebCore::RenderLayer::enclosingFilterRepaintLayer):
+        (WebCore::RenderLayer::clippingRootForPainting):
+
 2013-09-05  Brent Fulgham  <[email protected]>
 
         [Windows] Unreviewed build/link improvement after r155127 to be

Modified: trunk/Source/WebCore/dom/Node.cpp (155130 => 155131)


--- trunk/Source/WebCore/dom/Node.cpp	2013-09-05 17:54:11 UTC (rev 155130)
+++ trunk/Source/WebCore/dom/Node.cpp	2013-09-05 17:56:58 UTC (rev 155131)
@@ -117,10 +117,6 @@
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 
-#ifndef NDEBUG
-#include "RenderLayer.h"
-#endif
-
 #if ENABLE(GESTURE_EVENTS)
 #include "GestureEvent.h"
 #endif

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (155130 => 155131)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-09-05 17:54:11 UTC (rev 155130)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-09-05 17:56:58 UTC (rev 155131)
@@ -1417,6 +1417,11 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
+static bool compositedWithOwnBackingStore(const RenderLayer* layer)
+{
+    return layer->isComposited() && !layer->backing()->paintsIntoCompositedAncestor();
+}
+
 RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf) const
 {
     if (includeSelf == IncludeSelf && isComposited())
@@ -1436,7 +1441,7 @@
         return const_cast<RenderLayer*>(this);
 
     for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
-        if (curr->isComposited() && !curr->backing()->paintsIntoCompositedAncestor())
+        if (compositedWithOwnBackingStore(curr))
             return const_cast<RenderLayer*>(curr);
     }
          
@@ -1461,7 +1466,7 @@
 RenderLayer* RenderLayer::enclosingFilterRepaintLayer() const
 {
     for (const RenderLayer* curr = this; curr; curr = curr->parent()) {
-        if ((curr != this && curr->requiresFullLayerImageForFilters()) || curr->isComposited() || curr->isRootLayer())
+        if ((curr != this && curr->requiresFullLayerImageForFilters()) || compositedWithOwnBackingStore(curr) || curr->isRootLayer())
             return const_cast<RenderLayer*>(curr);
     }
     return 0;
@@ -1528,7 +1533,7 @@
 }
 
 #endif
-    
+
 RenderLayer* RenderLayer::clippingRootForPainting() const
 {
 #if USE(ACCELERATED_COMPOSITING)
@@ -1545,7 +1550,7 @@
         ASSERT(current);
         if (current->transform()
 #if USE(ACCELERATED_COMPOSITING)
-            || (current->isComposited() && !current->backing()->paintsIntoCompositedAncestor())
+            || compositedWithOwnBackingStore(current)
 #endif
         )
             return const_cast<RenderLayer*>(current);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to