Title: [151547] trunk
Revision
151547
Author
[email protected]
Date
2013-06-13 08:05:14 -0700 (Thu, 13 Jun 2013)

Log Message

[CSS Background Blending] Gradients don't blend with any of the layers behind.
First, allow the layers behind opaque gradients to be drawn, then add the blending filters
when working with gradients.

Source/WebCore:

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

Patch by Mihai Tica <[email protected]> on 2013-06-13
Reviewed by Dirk Schulze.

Tests: css3/compositing/background-blend-mode-gradient-color.html
       css3/compositing/background-blend-mode-gradient-gradient.html
       css3/compositing/background-blend-mode-gradient-image.html
       css3/compositing/background-blend-mode-multiple-background-layers.html

* platform/graphics/GeneratorGeneratedImage.cpp:
(WebCore::GeneratorGeneratedImage::draw):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintFillLayers):

LayoutTests:

https://bugs.webkit.org/show_bug.cgi?id=117532
Patch by Mihai Tica <[email protected]> on 2013-06-13
Reviewed by Dirk Schulze.

* css3/compositing/background-blend-mode-gradient-color-expected.txt: Added.
* css3/compositing/background-blend-mode-gradient-color.html: Added.
* css3/compositing/background-blend-mode-gradient-gradient-expected.txt: Added.
* css3/compositing/background-blend-mode-gradient-gradient.html: Added.
* css3/compositing/background-blend-mode-gradient-image-expected.txt: Added.
* css3/compositing/background-blend-mode-gradient-image.html: Added.
* css3/compositing/background-blend-mode-multiple-background-layers-expected.txt: Added.
* css3/compositing/background-blend-mode-multiple-background-layers.html: Added.
* platform/mac/css3/compositing/background-blend-mode-gradient-color-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-gradient-gradient-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-gradient-image-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-multiple-background-layers-expected.png: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151546 => 151547)


--- trunk/LayoutTests/ChangeLog	2013-06-13 14:42:29 UTC (rev 151546)
+++ trunk/LayoutTests/ChangeLog	2013-06-13 15:05:14 UTC (rev 151547)
@@ -1,3 +1,25 @@
+2013-06-13  Mihai Tica  <[email protected]>
+
+        [CSS Background Blending] Gradients don't blend with any of the layers behind.
+        First, allow the layers behind opaque gradients to be drawn, then add the blending filters
+        when working with gradients.
+
+        https://bugs.webkit.org/show_bug.cgi?id=117532
+        Reviewed by Dirk Schulze.
+
+        * css3/compositing/background-blend-mode-gradient-color-expected.txt: Added.
+        * css3/compositing/background-blend-mode-gradient-color.html: Added.
+        * css3/compositing/background-blend-mode-gradient-gradient-expected.txt: Added.
+        * css3/compositing/background-blend-mode-gradient-gradient.html: Added.
+        * css3/compositing/background-blend-mode-gradient-image-expected.txt: Added.
+        * css3/compositing/background-blend-mode-gradient-image.html: Added.
+        * css3/compositing/background-blend-mode-multiple-background-layers-expected.txt: Added.
+        * css3/compositing/background-blend-mode-multiple-background-layers.html: Added.
+        * platform/mac/css3/compositing/background-blend-mode-gradient-color-expected.png: Added.
+        * platform/mac/css3/compositing/background-blend-mode-gradient-gradient-expected.png: Added.
+        * platform/mac/css3/compositing/background-blend-mode-gradient-image-expected.png: Added.
+        * platform/mac/css3/compositing/background-blend-mode-multiple-background-layers-expected.png: Added.
+
 2013-06-13  Morten Stenshorne  <[email protected]>
 
         Column balancing support in the region based multicol implementation

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-color-expected.txt (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-color-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-color-expected.txt	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-color.html (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-color.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-color.html	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        window.testRunner.dumpAsText(true);
+</script>
+<style>
+    li {
+        margin: 5px;
+        width: 130px;
+        height: 130px;
+        background: linear-gradient(to right, gray 0%, gray 100%), green;
+        display: block;
+        float: left;
+    }
+</style>
+<!-- This file should contain a gradient on top of a background color for every type of blending. -->
+<body>
+    <ul>
+        <li style="-webkit-background-blend-mode: normal, normal"></li>
+        <li style="-webkit-background-blend-mode: multiply, normal"></li>
+        <li style="-webkit-background-blend-mode: screen, normal"></li>
+        <li style="-webkit-background-blend-mode: overlay, normal"></li>
+        <li style="-webkit-background-blend-mode: darken, normal"></li>
+        <li style="-webkit-background-blend-mode: lighten, normal"></li>
+        <li style="-webkit-background-blend-mode: color-dodge, normal"></li>
+        <li style="-webkit-background-blend-mode: color-burn, normal"></li>
+        <li style="-webkit-background-blend-mode: hard-light, normal"></li>
+        <li style="-webkit-background-blend-mode: soft-light, normal"></li>
+        <li style="-webkit-background-blend-mode: difference, normal"></li>
+        <li style="-webkit-background-blend-mode: exclusion, normal"></li>
+        <li style="-webkit-background-blend-mode: hue, normal;"></li>
+        <li style="-webkit-background-blend-mode: saturation, normal"></li>
+        <li style="-webkit-background-blend-mode: color, normal"></li>
+        <li style="-webkit-background-blend-mode: luminosity, normal"></li>
+    </ul>
+</body>
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-gradient-expected.txt (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-gradient-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-gradient-expected.txt	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-gradient.html (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-gradient.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-gradient.html	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        window.testRunner.dumpAsText(true);
+</script>
+<style>
+    li {
+        margin: 5px;
+        width: 130px;
+        height: 130px;
+        background: linear-gradient(to right, white 0%, gray 100%), radial-gradient(green 0%, white 100%);
+        display: block;
+        float: left;
+    }
+</style>
+<!-- This file should contain a gradient on top of another gradient for every type of blending. -->
+<body>
+    <ul>
+        <li style="-webkit-background-blend-mode: normal, normal"></li>
+        <li style="-webkit-background-blend-mode: multiply, normal"></li>
+        <li style="-webkit-background-blend-mode: screen, normal"></li>
+        <li style="-webkit-background-blend-mode: overlay, normal; opacity:.9"></li>
+        <li style="-webkit-background-blend-mode: darken, normal"></li>
+        <li style="-webkit-background-blend-mode: lighten, normal"></li>
+        <li style="-webkit-background-blend-mode: color-dodge, normal"></li>
+        <li style="-webkit-background-blend-mode: color-burn, normal"></li>
+        <li style="-webkit-background-blend-mode: hard-light, normal"></li>
+        <li style="-webkit-background-blend-mode: soft-light, normal"></li>
+        <li style="-webkit-background-blend-mode: difference, normal"></li>
+        <li style="-webkit-background-blend-mode: exclusion, normal"></li>
+        <li style="-webkit-background-blend-mode: hue, normal;"></li>
+        <li style="-webkit-background-blend-mode: saturation, normal"></li>
+        <li style="-webkit-background-blend-mode: color, normal"></li>
+        <li style="-webkit-background-blend-mode: luminosity, normal"></li>
+    </ul>
+</body>
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-image-expected.txt (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-image-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-image-expected.txt	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-image.html (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-image.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-gradient-image.html	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        window.testRunner.dumpAsText(true);
+</script>
+<style>
+    li {
+        margin: 5px;
+        width: 130px;
+        height: 130px;
+        background: linear-gradient(to right, white 0%, gray 100%), url('resources/ducky.png') no-repeat 0 0 /100% 100%;
+        display: block;
+        float: left;
+    }
+</style>
+<!-- This file should contain a gradient on top of a background image for every type of blending. -->
+<body>
+    <ul>
+        <li style="-webkit-background-blend-mode: normal, normal"></li>
+        <li style="-webkit-background-blend-mode: multiply, normal"></li>
+        <li style="-webkit-background-blend-mode: screen, normal"></li>
+        <li style="-webkit-background-blend-mode: overlay, normal; opacity:.9"></li>
+        <li style="-webkit-background-blend-mode: darken, normal"></li>
+        <li style="-webkit-background-blend-mode: lighten, normal"></li>
+        <li style="-webkit-background-blend-mode: color-dodge, normal"></li>
+        <li style="-webkit-background-blend-mode: color-burn, normal"></li>
+        <li style="-webkit-background-blend-mode: hard-light, normal"></li>
+        <li style="-webkit-background-blend-mode: soft-light, normal"></li>
+        <li style="-webkit-background-blend-mode: difference, normal"></li>
+        <li style="-webkit-background-blend-mode: exclusion, normal"></li>
+        <li style="-webkit-background-blend-mode: hue, normal;"></li>
+        <li style="-webkit-background-blend-mode: saturation, normal"></li>
+        <li style="-webkit-background-blend-mode: color, normal"></li>
+        <li style="-webkit-background-blend-mode: luminosity, normal"></li>
+    </ul>
+</body>
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-multiple-background-layers-expected.txt (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-multiple-background-layers-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-multiple-background-layers-expected.txt	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/css3/compositing/background-blend-mode-multiple-background-layers.html (0 => 151547)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-multiple-background-layers.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-multiple-background-layers.html	2013-06-13 15:05:14 UTC (rev 151547)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        window.testRunner.dumpAsText(true);
+</script>
+<style>
+    div {
+        background: url('resources/ducky.png') no-repeat 0 0 /100% 100%, linear-gradient(to right, white 0%, gray 100%), green;
+        width: 200px;
+        height: 200px;
+        margin: 10px;
+    }
+</style>
+</head>
+<!-- This file should contain two divs with 3 background layers. Test background blend mode differences when only one layer blends differently. -->
+<body>
+    <div style="-webkit-background-blend-mode: hue, difference, normal;"></div>
+    <div style="-webkit-background-blend-mode: difference, difference, normal;"></div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-gradient-color-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-gradient-color-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-gradient-gradient-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-gradient-gradient-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-gradient-image-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-gradient-image-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-multiple-background-layers-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/css3/compositing/background-blend-mode-multiple-background-layers-expected.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (151546 => 151547)


--- trunk/Source/WebCore/ChangeLog	2013-06-13 14:42:29 UTC (rev 151546)
+++ trunk/Source/WebCore/ChangeLog	2013-06-13 15:05:14 UTC (rev 151547)
@@ -1,3 +1,23 @@
+2013-06-13  Mihai Tica  <[email protected]>
+
+        [CSS Background Blending] Gradients don't blend with any of the layers behind.
+        First, allow the layers behind opaque gradients to be drawn, then add the blending filters
+        when working with gradients.
+
+        https://bugs.webkit.org/show_bug.cgi?id=117532
+
+        Reviewed by Dirk Schulze.
+
+        Tests: css3/compositing/background-blend-mode-gradient-color.html
+               css3/compositing/background-blend-mode-gradient-gradient.html
+               css3/compositing/background-blend-mode-gradient-image.html
+               css3/compositing/background-blend-mode-multiple-background-layers.html
+
+        * platform/graphics/GeneratorGeneratedImage.cpp:
+        (WebCore::GeneratorGeneratedImage::draw):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintFillLayers):
+
 2013-06-13  Michael BrĂ¼ning  <[email protected]>
 
         [Qt][Mac] Disable QTKit video on OS X.

Modified: trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp (151546 => 151547)


--- trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp	2013-06-13 14:42:29 UTC (rev 151546)
+++ trunk/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp	2013-06-13 15:05:14 UTC (rev 151547)
@@ -32,10 +32,10 @@
 
 namespace WebCore {
 
-void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode)
+void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode)
 {
     GraphicsContextStateSaver stateSaver(*destContext);
-    destContext->setCompositeOperation(compositeOp);
+    destContext->setCompositeOperation(compositeOp, blendMode);
     destContext->clip(destRect);
     destContext->translate(destRect.x(), destRect.y());
     if (destRect.size() != srcRect.size())

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (151546 => 151547)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-06-13 14:42:29 UTC (rev 151546)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-06-13 15:05:14 UTC (rev 151547)
@@ -1374,7 +1374,7 @@
             shouldDrawBackgroundInSeparateBuffer = true;
 
         // The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting.
-        if (curLayer->clipOccludesNextLayers(curLayer == fillLayer) && curLayer->hasOpaqueImage(this) && curLayer->image()->canRender(this, style()->effectiveZoom()) && curLayer->hasRepeatXY())
+        if (curLayer->clipOccludesNextLayers(curLayer == fillLayer) && curLayer->hasOpaqueImage(this) && curLayer->image()->canRender(this, style()->effectiveZoom()) && curLayer->hasRepeatXY() && curLayer->blendMode() == BlendModeNormal)
             break;
         curLayer = curLayer->next();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to