Title: [168462] trunk
Revision
168462
Author
commit-qu...@webkit.org
Date
2014-05-07 22:42:21 -0700 (Wed, 07 May 2014)

Log Message

[CSS Blending] Blending doesn't work if the parent stacking context is not a self painting layer
https://bugs.webkit.org/show_bug.cgi?id=130891

Patch by Ion Rosca <ro...@adobe.com> on 2014-05-07
Reviewed by Dean Jackson.

Source/WebCore:
The stacking context layers having unisolated blending descendants should be able
to create transparency layers or to become composited in order to restrict blending
content to accessing the information outside the current stacking context.
Some layers are not self painting layers and these layers cannot crate transparency
layers and cannot be composited, thus they are not able to isolate blending descendants
when it's required.

The solution in this patch is to make a layer isSelfPaintingLayer when
it needs to isolate blending descendants (hasUnisolatedBlendingDescendants).

Tests: css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html
       css3/blending/blend-mode-isolation-overflow-hidden.html
       css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html
       css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html
       css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html
       css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateAncestorChainHasBlendingDescendants):
When hasUnisolatedBlendingDescendants is set we make sure that isSelfPaintingLayer flag is set too.
(WebCore::RenderLayer::updateDescendantDependentFlags):
The flags might be read or changed while walking the descendants, so we don't want to reset
them before traversing the tree.
(WebCore::RenderLayer::shouldBeSelfPaintingLayer):
Adding isolatesBlending() condition for a layer to be self painting.
* rendering/RenderLayer.h:
Removing ASSERT from hasUnisolatedBlendingDescendants(). It crashes in minibrowser
and in layout tests when painting contents. Similar bugs on other flags: #71044, #71277.
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange):
Telling ancestors that blend mode property has been removed from CSS when the layer for
this element is going to be removed; styleChanged will not be called anymore.

LayoutTests:
Removed position:relative which forced tests to avoid this bug.
* css3/blending/blend-mode-accelerated-parent-overflow-hidden.html:
* css3/blending/blend-mode-clip-accelerated-blending-canvas.html:
* css3/blending/blend-mode-clip-accelerated-blending-child.html:
* css3/blending/blend-mode-clip-accelerated-blending-with-siblings.html:
* css3/blending/blend-mode-clip-accelerated-transformed-blending.html:

New tests:
* css3/blending/blend-mode-isolation-accelerated-overflow-hidden-expected.txt: Added.
* css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html: Added.
* css3/blending/blend-mode-isolation-overflow-hidden-expected.html: Added.
* css3/blending/blend-mode-isolation-overflow-hidden.html: Added.
* css3/blending/blend-mode-isolation-turn-off-self-painting-layer-expected.txt: Added.
* css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html: Added.
* css3/blending/blend-mode-isolation-turn-off-self-painting-layer1-expected.txt: Added.
* css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html: Added.
* css3/blending/blend-mode-isolation-turn-off-self-painting-layer2-expected.txt: Added.
* css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html: Added.
* css3/blending/blend-mode-isolation-turn-on-self-painting-layer-expected.txt: Added.
* css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (168461 => 168462)


--- trunk/LayoutTests/ChangeLog	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/LayoutTests/ChangeLog	2014-05-08 05:42:21 UTC (rev 168462)
@@ -1,3 +1,31 @@
+2014-05-07  Ion Rosca  <ro...@adobe.com>
+
+        [CSS Blending] Blending doesn't work if the parent stacking context is not a self painting layer
+        https://bugs.webkit.org/show_bug.cgi?id=130891
+
+        Reviewed by Dean Jackson.
+
+        Removed position:relative which forced tests to avoid this bug. 
+        * css3/blending/blend-mode-accelerated-parent-overflow-hidden.html:
+        * css3/blending/blend-mode-clip-accelerated-blending-canvas.html:
+        * css3/blending/blend-mode-clip-accelerated-blending-child.html:
+        * css3/blending/blend-mode-clip-accelerated-blending-with-siblings.html:
+        * css3/blending/blend-mode-clip-accelerated-transformed-blending.html:
+
+        New tests:
+        * css3/blending/blend-mode-isolation-accelerated-overflow-hidden-expected.txt: Added.
+        * css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html: Added.
+        * css3/blending/blend-mode-isolation-overflow-hidden-expected.html: Added.
+        * css3/blending/blend-mode-isolation-overflow-hidden.html: Added.
+        * css3/blending/blend-mode-isolation-turn-off-self-painting-layer-expected.txt: Added.
+        * css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html: Added.
+        * css3/blending/blend-mode-isolation-turn-off-self-painting-layer1-expected.txt: Added.
+        * css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html: Added.
+        * css3/blending/blend-mode-isolation-turn-off-self-painting-layer2-expected.txt: Added.
+        * css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html: Added.
+        * css3/blending/blend-mode-isolation-turn-on-self-painting-layer-expected.txt: Added.
+        * css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html: Added.
+
 2014-05-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Dragging text from one paragraph to another does not render as expected

Modified: trunk/LayoutTests/css3/blending/blend-mode-accelerated-parent-overflow-hidden.html (168461 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-accelerated-parent-overflow-hidden.html	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/LayoutTests/css3/blending/blend-mode-accelerated-parent-overflow-hidden.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -8,7 +8,6 @@
 		background: rgb(0, 255, 0);
 		isolation:isolate;
 		-webkit-isolation:isolate;
-		position: relative; /*avoid #130891 issue*/
 	}
 
 	.blender {

Modified: trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-canvas.html (168461 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-canvas.html	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-canvas.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -6,7 +6,6 @@
        overflow:hidden;
        background: rgb(0, 255, 0);
        isolation: isolate;
-       position: relative; /*avoid #130891 issue*/
    }
    .blending {
         mix-blend-mode: difference;

Modified: trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-child.html (168461 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-child.html	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-child.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -6,7 +6,6 @@
        overflow:hidden;
        background: rgb(0, 255, 0);
        isolation: isolate;
-       position: relative; /*avoid #130891 issue*/
    }
 
    .child {

Modified: trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-with-siblings.html (168461 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-with-siblings.html	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-with-siblings.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -5,7 +5,6 @@
        height: 100px;
        overflow:hidden;
        isolation: isolate;
-       position: relative; /*avoid #130891 issue*/
    }
 
    .child {

Modified: trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-transformed-blending.html (168461 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-transformed-blending.html	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-transformed-blending.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -6,7 +6,6 @@
        overflow:hidden;
        background: rgb(0, 255, 0);
        isolation: isolate;
-       position: relative; /*avoid #130891 issue*/
    }
 
    .child {

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-accelerated-overflow-hidden-expected.txt (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-accelerated-overflow-hidden-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-accelerated-overflow-hidden-expected.txt	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,29 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 100.00 100.00)
+          (children 1
+            (GraphicsLayer
+              (bounds 100.00 100.00)
+              (blendMode difference)
+              (children 1
+                (GraphicsLayer
+                  (bounds 400.00 20.00)
+                  (contentsOpaque 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+        isolation:isolate;
+        -webkit-isolation: isolate;
+    }
+
+    .blender {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+        mix-blend-mode: difference;
+        -webkit-mix-blend-mode: difference;
+    }
+
+    .accelerated {
+        -webkit-transform: translateZ(0px);
+    }
+</style>
+
+<!-- This test checks that an element with overflow hidden, being normal flow only, can get accelerated in order to isolate blending descendants properly. -->
+<!-- Test passes if you see a green rectangle. -->
+<div class="parent">
+    <div class="blender accelerated"></div>
+</div>
+
+<pre id="layerTree"></pre>
+<script>
+    if (window.testRunner)
+        window.testRunner.dumpAsText();
+
+    var text = document.getElementById("layerTree");
+    text.innerHTML = window.internals.layerTreeAsText(document);
+</script>

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-overflow-hidden-expected.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-overflow-hidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-overflow-hidden-expected.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+    }
+
+    .blender {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+    }
+</style>
+
+<p>This test checks that an element with overflow hidden, being normal flow only, isolates blending descendants properly.<br/>
+Test passes if you see a green rectangle.</p>
+<div class="parent">
+    <div class="blender"></div>
+</div>

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-overflow-hidden.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-overflow-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-overflow-hidden.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+        isolation:isolate;
+        -webkit-isolation: isolate;
+    }
+
+    .blender {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+        mix-blend-mode: difference;
+        -webkit-mix-blend-mode: difference;
+    }
+</style>
+
+<p>This test checks that an element with overflow hidden, being normal flow only, isolates blending descendants properly.<br/>
+Test passes if you see a green rectangle.</p>
+<div class="parent">
+    <div class="blender"></div>
+</div>

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer-expected.txt (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer-expected.txt	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x158
+  RenderBlock {HTML} at (0,0) size 800x158
+    RenderBody {BODY} at (8,16) size 784x134
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 251x18
+          text run at (0,0) width 251: "Test passes if you see a green rectangle."
+layer at (8,50) size 100x100 scrollWidth 400
+  RenderBlock {DIV} at (0,34) size 100x100
+    RenderBlock {DIV} at (0,0) size 400x20 [bgcolor=#00FF00]

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+        isolation:isolate;
+        -webkit-isolation: isolate;
+    }
+
+    .child {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+    }
+
+    .blending {
+        mix-blend-mode: difference;
+        -webkit-mix-blend-mode: difference;
+    }
+</style>
+
+<!-- This test checks that an element with overflow hidden will be able to stop isolating after dinamically removing mix-blend-mode on descendants. -->
+<p>Test passes if you see a green rectangle.</p>
+<div class="parent">
+    <div id="target" class="child blending"></div>
+</div>
+
+<script type="text/_javascript_">
+    if (window.testRunner)
+        window.testRunner.waitUntilDone();
+
+    window.addEventListener('load', function() {
+       var target = document.getElementById("target");
+       target.className = "child";
+
+        if (window.testRunner)
+            window.testRunner.notifyDone();
+    }, false);
+</script>

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer1-expected.txt (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer1-expected.txt	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x158
+  RenderBlock {HTML} at (0,0) size 800x158
+    RenderBody {BODY} at (8,16) size 784x134
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 251x18
+          text run at (0,0) width 251: "Test passes if you see a green rectangle."
+layer at (8,50) size 100x100 scrollWidth 400
+  RenderBlock {DIV} at (0,34) size 100x100
+    RenderBlock {DIV} at (0,0) size 400x20 [bgcolor=#00FF00]

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+        isolation:isolate;
+        -webkit-isolation: isolate;
+    }
+
+    .child {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+    }
+
+    .blending {
+        mix-blend-mode: difference;
+        -webkit-mix-blend-mode: difference;
+    }
+
+    html {
+        /*Force compositing.*/
+        -webkit-transform: translateZ(0px);
+    }
+</style>
+
+<!-- This test checks that an element with overflow hidden will be able to stop isolating after dinamically removing mix-blend-mode on descendants. -->
+<p>Test passes if you see a green rectangle.</p>
+<div class="parent">
+    <div id="target" class="child blending"></div>
+</div>
+
+<script type="text/_javascript_">
+    if (window.testRunner)
+        window.testRunner.waitUntilDone();
+
+    window.addEventListener('load', function() {
+       var target = document.getElementById("target");
+       target.className = "child";
+
+        if (window.testRunner)
+            window.testRunner.notifyDone();
+    }, false);
+</script>

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer2-expected.txt (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer2-expected.txt	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x158
+  RenderBlock {HTML} at (0,0) size 800x158
+    RenderBody {BODY} at (8,16) size 784x134
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 251x18
+          text run at (0,0) width 251: "Test passes if you see a green rectangle."
+layer at (8,50) size 100x100 scrollWidth 400
+  RenderBlock {DIV} at (0,34) size 100x100
+layer at (8,50) size 400x20 backgroundClip at (8,50) size 100x100 clip at (8,50) size 100x100 outlineClip at (8,50) size 100x100
+  RenderBlock (relative positioned) {DIV} at (0,0) size 400x20 [bgcolor=#00FF00]

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+        isolation:isolate;
+        -webkit-isolation: isolate;
+    }
+
+    .child {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+        /*Keep child RenderLayer after removing blending*/
+        position: relative;
+    }
+
+    .blending {
+        mix-blend-mode: difference;
+        -webkit-mix-blend-mode: difference;
+    }
+</style>
+
+<!-- This test checks that an element with overflow hidden will be able to stop isolating after dinamically removing mix-blend-mode on descendants. -->
+<p>Test passes if you see a green rectangle.</p>
+<div class="parent">
+    <div id="target" class="child blending"></div>
+</div>
+
+<script type="text/_javascript_">
+    if (window.testRunner)
+        window.testRunner.waitUntilDone();
+
+    window.addEventListener('load', function() {
+       var target = document.getElementById("target");
+       target.className = "child";
+
+        if (window.testRunner)
+            window.testRunner.notifyDone();
+    }, false);
+</script>

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-on-self-painting-layer-expected.txt (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-on-self-painting-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-on-self-painting-layer-expected.txt	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x158
+  RenderBlock {HTML} at (0,0) size 800x158
+    RenderBody {BODY} at (8,16) size 784x134
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 251x18
+          text run at (0,0) width 251: "Test passes if you see a green rectangle."
+layer at (8,50) size 100x100 scrollWidth 400 isolatesBlending
+  RenderBlock {DIV} at (0,34) size 100x100
+layer at (8,50) size 400x20 backgroundClip at (8,50) size 100x100 clip at (8,50) size 100x100 outlineClip at (8,50) size 100x100 blendMode: difference
+  RenderBlock {DIV} at (0,0) size 400x20 [bgcolor=#00FF00]

Added: trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html (0 => 168462)


--- trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html	                        (rev 0)
+++ trunk/LayoutTests/css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html	2014-05-08 05:42:21 UTC (rev 168462)
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<style>
+    .parent {
+        width: 100px;
+        height: 100px;
+        overflow:hidden;
+        isolation:isolate;
+        -webkit-isolation: isolate;
+    }
+
+    .child {
+        width: 400px;
+        height: 20px;
+        background: rgb(0, 255, 0);
+    }
+
+    .blending {
+        mix-blend-mode: difference;
+        -webkit-mix-blend-mode: difference;
+    }
+</style>
+
+<!-- This test checks that an element with overflow hidden, not being a self painting layer, will be able to dynamically isolate blending descendants. -->
+<p>Test passes if you see a green rectangle.</p>
+<div class="parent">
+    <div id="target" class="child"></div>
+</div>
+
+<script type="text/_javascript_">
+    if (window.testRunner)
+        window.testRunner.waitUntilDone();
+
+    window.addEventListener('load', function() {
+       var target = document.getElementById("target");
+       target.className = "blending child";
+
+        if (window.testRunner)
+            window.testRunner.notifyDone();
+    }, false);
+</script>

Modified: trunk/Source/WebCore/ChangeLog (168461 => 168462)


--- trunk/Source/WebCore/ChangeLog	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/Source/WebCore/ChangeLog	2014-05-08 05:42:21 UTC (rev 168462)
@@ -1,3 +1,43 @@
+2014-05-07  Ion Rosca  <ro...@adobe.com>
+
+        [CSS Blending] Blending doesn't work if the parent stacking context is not a self painting layer
+        https://bugs.webkit.org/show_bug.cgi?id=130891
+
+        Reviewed by Dean Jackson.
+
+        The stacking context layers having unisolated blending descendants should be able
+        to create transparency layers or to become composited in order to restrict blending 
+        content to accessing the information outside the current stacking context.
+        Some layers are not self painting layers and these layers cannot crate transparency
+        layers and cannot be composited, thus they are not able to isolate blending descendants
+        when it's required.
+        
+        The solution in this patch is to make a layer isSelfPaintingLayer when
+        it needs to isolate blending descendants (hasUnisolatedBlendingDescendants).
+
+        Tests: css3/blending/blend-mode-isolation-accelerated-overflow-hidden.html
+               css3/blending/blend-mode-isolation-overflow-hidden.html
+               css3/blending/blend-mode-isolation-turn-off-self-painting-layer.html
+               css3/blending/blend-mode-isolation-turn-off-self-painting-layer1.html
+               css3/blending/blend-mode-isolation-turn-off-self-painting-layer2.html
+               css3/blending/blend-mode-isolation-turn-on-self-painting-layer.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateAncestorChainHasBlendingDescendants):
+        When hasUnisolatedBlendingDescendants is set we make sure that isSelfPaintingLayer flag is set too.
+        (WebCore::RenderLayer::updateDescendantDependentFlags):
+        The flags might be read or changed while walking the descendants, so we don't want to reset
+        them before traversing the tree.
+        (WebCore::RenderLayer::shouldBeSelfPaintingLayer):
+        Adding isolatesBlending() condition for a layer to be self painting.
+        * rendering/RenderLayer.h:
+        Removing ASSERT from hasUnisolatedBlendingDescendants(). It crashes in minibrowser
+        and in layout tests when painting contents. Similar bugs on other flags: #71044, #71277.
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::styleDidChange):
+        Telling ancestors that blend mode property has been removed from CSS when the layer for
+        this element is going to be removed; styleChanged will not be called anymore.
+
 2014-05-06  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Dragging text from one paragraph to another does not render as expected

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (168461 => 168462)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-05-08 05:42:21 UTC (rev 168462)
@@ -831,6 +831,8 @@
         layer->m_hasUnisolatedBlendingDescendants = true;
         layer->m_hasUnisolatedBlendingDescendantsStatusDirty = false;
 
+        layer->updateSelfPaintingLayer();
+
         if (layer->isStackingContext())
             break;
     }
@@ -1041,11 +1043,11 @@
 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* outOfFlowDescendantContainingBlocks)
 {
     if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty || hasUnisolatedBlendingDescendantsStatusDirty()) {
-        m_hasVisibleDescendant = false;
-        m_hasSelfPaintingLayerDescendant = false;
-        m_hasOutOfFlowPositionedDescendant = false;
+        bool hasVisibleDescendant = false;
+        bool hasSelfPaintingLayerDescendant = false;
+        bool hasOutOfFlowPositionedDescendant = false;
 #if ENABLE(CSS_COMPOSITING)
-        m_hasUnisolatedBlendingDescendants = false;
+        bool hasUnisolatedBlendingDescendants = false;
 #endif
 
         HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks;
@@ -1063,21 +1065,16 @@
                     outOfFlowDescendantContainingBlocks->add(*it);
             }
 
-            bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_hasVisibleDescendant;
-            bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant();
-            bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantContainingBlocks.isEmpty();
+            hasVisibleDescendant |= child->m_hasVisibleContent || child->m_hasVisibleDescendant;
+            hasSelfPaintingLayerDescendant |= child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant();
+            hasOutOfFlowPositionedDescendant |= !childOutOfFlowDescendantContainingBlocks.isEmpty();
 #if ENABLE(CSS_COMPOSITING)
-            bool hasUnisolatedBlendingDescendants = child->hasBlendMode() || (child->hasUnisolatedBlendingDescendants() && !child->isolatesBlending());
-
-            m_hasUnisolatedBlendingDescendants |= hasUnisolatedBlendingDescendants;
+            hasUnisolatedBlendingDescendants |= child->hasBlendMode() || (child->hasUnisolatedBlendingDescendants() && !child->isolatesBlending());
 #endif
-            m_hasVisibleDescendant |= hasVisibleDescendant;
-            m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant;
-            m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescendant;
 
-            bool allFlagsSet = m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_hasOutOfFlowPositionedDescendant;
+            bool allFlagsSet = hasVisibleDescendant && hasSelfPaintingLayerDescendant && hasOutOfFlowPositionedDescendant;
 #if ENABLE(CSS_COMPOSITING)
-            allFlagsSet &= m_hasUnisolatedBlendingDescendants;
+            allFlagsSet &= hasUnisolatedBlendingDescendants;
 #endif
             if (allFlagsSet)
                 break;
@@ -1086,15 +1083,22 @@
         if (outOfFlowDescendantContainingBlocks)
             outOfFlowDescendantContainingBlocks->remove(&renderer());
 
+        m_hasVisibleDescendant = hasVisibleDescendant;
         m_visibleDescendantStatusDirty = false;
+        m_hasSelfPaintingLayerDescendant = hasSelfPaintingLayerDescendant;
         m_hasSelfPaintingLayerDescendantDirty = false;
 
+        m_hasOutOfFlowPositionedDescendant = hasOutOfFlowPositionedDescendant;
         if (m_hasOutOfFlowPositionedDescendantDirty)
             updateNeedsCompositedScrolling();
 
         m_hasOutOfFlowPositionedDescendantDirty = false;
 #if ENABLE(CSS_COMPOSITING)
-        m_hasUnisolatedBlendingDescendantsStatusDirty = false;
+        m_hasUnisolatedBlendingDescendants = hasUnisolatedBlendingDescendants;
+        if (m_hasUnisolatedBlendingDescendantsStatusDirty) {
+            m_hasUnisolatedBlendingDescendantsStatusDirty = false;
+            updateSelfPaintingLayer();
+        }
 #endif
     }
 
@@ -6178,6 +6182,7 @@
     return !isNormalFlowOnly()
         || hasOverlayScrollbars()
         || needsCompositedScrolling()
+        || isolatesBlending()
         || renderer().hasReflection()
         || renderer().hasMask()
         || renderer().isTableRow()

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (168461 => 168462)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2014-05-08 05:42:21 UTC (rev 168462)
@@ -806,11 +806,9 @@
     }
 
     bool isolatesBlending() const { return hasUnisolatedBlendingDescendants() && isStackingContext(); }
-    bool hasUnisolatedBlendingDescendants() const
-    {
-        ASSERT(!m_hasUnisolatedBlendingDescendantsStatusDirty);
-        return m_hasUnisolatedBlendingDescendants;
-    }
+    
+    // FIXME: We should ASSERT(!m_hasUnisolatedBlendingDescendantsStatusDirty); here but we hit the same bugs as visible content above.
+    bool hasUnisolatedBlendingDescendants() const { return m_hasUnisolatedBlendingDescendants; }
     bool hasUnisolatedBlendingDescendantsStatusDirty() const { return m_hasUnisolatedBlendingDescendantsStatusDirty; }
 #else
     bool hasBlendMode() const { return false; }

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (168461 => 168462)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2014-05-08 04:10:21 UTC (rev 168461)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2014-05-08 05:42:21 UTC (rev 168462)
@@ -151,6 +151,10 @@
             }
         }
     } else if (layer() && layer()->parent()) {
+#if ENABLE(CSS_COMPOSITING)
+        if (oldStyle->hasBlendMode())
+            layer()->parent()->dirtyAncestorChainHasBlendingDescendants();
+#endif
         setHasTransform(false); // Either a transform wasn't specified or the object doesn't support transforms, so just null out the bit.
         setHasReflection(false);
         layer()->removeOnlyThisLayer(); // calls destroyLayer() which clears m_layer
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to