Title: [151566] trunk
Revision
151566
Author
[email protected]
Date
2013-06-13 11:25:10 -0700 (Thu, 13 Jun 2013)

Log Message

[CSS Background Blending] Enable CSS Background blending for layers with SVGs.

Source/WebCore:

The change implies adding the blending parameter for SVGImage
https://bugs.webkit.org/show_bug.cgi?id=117588

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

Tests: css3/compositing/background-blend-mode-image-svg.html
       css3/compositing/background-blend-mode-svg-color.html

* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):

LayoutTests:

Adding tests for SVGs over simple background colors and images blending with SVGs.
https://bugs.webkit.org/show_bug.cgi?id=117588

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

* css3/compositing/background-blend-mode-image-svg-expected.txt: Added.
* css3/compositing/background-blend-mode-image-svg.html: Added.
* css3/compositing/background-blend-mode-svg-color-expected.txt: Added.
* css3/compositing/background-blend-mode-svg-color.html: Added.
* css3/compositing/resources/red-circle.svg: Added.
* platform/mac/css3/compositing/background-blend-mode-image-svg-expected.png: Added.
* platform/mac/css3/compositing/background-blend-mode-svg-color-expected.png: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151565 => 151566)


--- trunk/LayoutTests/ChangeLog	2013-06-13 18:24:21 UTC (rev 151565)
+++ trunk/LayoutTests/ChangeLog	2013-06-13 18:25:10 UTC (rev 151566)
@@ -1,5 +1,22 @@
 2013-06-13  Mihai Tica  <[email protected]>
 
+        [CSS Background Blending] Enable CSS Background blending for layers with SVGs.
+
+        Adding tests for SVGs over simple background colors and images blending with SVGs.
+        https://bugs.webkit.org/show_bug.cgi?id=117588
+
+        Reviewed by Dirk Schulze.
+
+        * css3/compositing/background-blend-mode-image-svg-expected.txt: Added.
+        * css3/compositing/background-blend-mode-image-svg.html: Added.
+        * css3/compositing/background-blend-mode-svg-color-expected.txt: Added.
+        * css3/compositing/background-blend-mode-svg-color.html: Added.
+        * css3/compositing/resources/red-circle.svg: Added.
+        * platform/mac/css3/compositing/background-blend-mode-image-svg-expected.png: Added.
+        * platform/mac/css3/compositing/background-blend-mode-svg-color-expected.png: Added.
+
+2013-06-13  Mihai Tica  <[email protected]>
+
         Updating the -webkit-background-blend-mode property dynamically does not trigger a redraw of the element.
 
         Adding test that sets background blend modes from script, after the page is loaded.

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


--- trunk/LayoutTests/css3/compositing/background-blend-mode-image-svg-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-image-svg-expected.txt	2013-06-13 18:25:10 UTC (rev 151566)
@@ -0,0 +1 @@
+

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


--- trunk/LayoutTests/css3/compositing/background-blend-mode-image-svg.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-image-svg.html	2013-06-13 18:25:10 UTC (rev 151566)
@@ -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: url('resources/ducky.png') no-repeat 0 0 /100% 100%, url('resources/red-circle.svg');
+        display: block;
+        float: left;
+    }
+</style>
+<!-- This file should contain a duck on top of an svg with 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-svg-color-expected.txt (0 => 151566)


--- trunk/LayoutTests/css3/compositing/background-blend-mode-svg-color-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-svg-color-expected.txt	2013-06-13 18:25:10 UTC (rev 151566)
@@ -0,0 +1 @@
+

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


--- trunk/LayoutTests/css3/compositing/background-blend-mode-svg-color.html	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/background-blend-mode-svg-color.html	2013-06-13 18:25:10 UTC (rev 151566)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    div {
+        width: 130px;
+        height: 130px;
+        background-size: 130px 130px;
+        background: url('resources/red-circle.svg'), green;
+        float: left;
+        margin: 5px;
+    }
+</style>
+</head>
+<!-- This file should contain an svg on top of a background color with every type of blending. -->
+<body>
+    <script>
+        if (window.testRunner)
+            window.testRunner.dumpAsText(true);
+    </script>
+        <div style="-webkit-background-blend-mode: normal, normal"></div>
+        <div style="-webkit-background-blend-mode: multiply, normal"></div>
+        <div style="-webkit-background-blend-mode: screen, normal"></div>
+        <div style="-webkit-background-blend-mode: overlay, normal"></div>
+        <div style="-webkit-background-blend-mode: darken, normal"></div>
+        <div style="-webkit-background-blend-mode: lighten, normal"></div>
+        <div style="-webkit-background-blend-mode: color-dodge, normal"></div>
+        <div style="-webkit-background-blend-mode: color-burn, normal"></div>
+        <div style="-webkit-background-blend-mode: hard-light, normal"></div>
+        <div style="-webkit-background-blend-mode: soft-light, normal"></div>
+        <div style="-webkit-background-blend-mode: difference, normal"></div>
+        <div style="-webkit-background-blend-mode: exclusion, normal"></div>
+        <div style="-webkit-background-blend-mode: hue, normal;"></div>
+        <div style="-webkit-background-blend-mode: saturation, normal"></div>
+        <div style="-webkit-background-blend-mode: color, normal"></div>
+        <div style="-webkit-background-blend-mode: luminosity, normal"></div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/compositing/resources/red-circle.svg (0 => 151566)


--- trunk/LayoutTests/css3/compositing/resources/red-circle.svg	                        (rev 0)
+++ trunk/LayoutTests/css3/compositing/resources/red-circle.svg	2013-06-13 18:25:10 UTC (rev 151566)
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100">
+  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="2" fill="red">
+  </circle>
+</svg>
\ No newline at end of file

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


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

Added: svn:mime-type

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


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

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (151565 => 151566)


--- trunk/Source/WebCore/ChangeLog	2013-06-13 18:24:21 UTC (rev 151565)
+++ trunk/Source/WebCore/ChangeLog	2013-06-13 18:25:10 UTC (rev 151566)
@@ -1,5 +1,20 @@
 2013-06-13  Mihai Tica  <[email protected]>
 
+        [CSS Background Blending] Enable CSS Background blending for layers with SVGs.
+
+        The change implies adding the blending parameter for SVGImage
+        https://bugs.webkit.org/show_bug.cgi?id=117588
+
+        Reviewed by Dirk Schulze.
+
+        Tests: css3/compositing/background-blend-mode-image-svg.html
+               css3/compositing/background-blend-mode-svg-color.html
+
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::draw):
+
+2013-06-13  Mihai Tica  <[email protected]>
+
         Updating the -webkit-background-blend-mode property dynamically does not trigger a redraw of the element.
 
         Adding krit's fix: actual blending values should be compared, not the sets.

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (151565 => 151566)


--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2013-06-13 18:24:21 UTC (rev 151565)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2013-06-13 18:25:10 UTC (rev 151566)
@@ -191,7 +191,7 @@
     image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase, colorSpace, compositeOp, dstRect);
 }
 
-void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode)
+void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode)
 {
     if (!m_page)
         return;
@@ -199,7 +199,7 @@
     FrameView* view = frameView();
 
     GraphicsContextStateSaver stateSaver(*context);
-    context->setCompositeOperation(compositeOp);
+    context->setCompositeOperation(compositeOp, blendMode);
     context->clip(enclosingIntRect(dstRect));
     if (compositeOp != CompositeSourceOver)
         context->beginTransparencyLayer(1);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to