Title: [202022] trunk
Revision
202022
Author
[email protected]
Date
2016-06-13 20:05:21 -0700 (Mon, 13 Jun 2016)

Log Message

SVG elements don't blend correctly into HTML
https://bugs.webkit.org/show_bug.cgi?id=158718
<rdar://problem/26782004>

Reviewed by Antoine Quint.

Source/WebCore:

We were not creating any transparency layers for the root SVG nodes.
This is ok if the SVG is the root document, because it is the backdrop.
However, if it is inline SVG, it needs to apply the operation in
order to composite into the document.

Test: svg/css/mix-blend-mode-with-inline-svg.html

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

LayoutTests:

* svg/css/mix-blend-mode-with-inline-svg-expected.html: Added.
* svg/css/mix-blend-mode-with-inline-svg.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202021 => 202022)


--- trunk/LayoutTests/ChangeLog	2016-06-14 02:29:26 UTC (rev 202021)
+++ trunk/LayoutTests/ChangeLog	2016-06-14 03:05:21 UTC (rev 202022)
@@ -1,3 +1,14 @@
+2016-06-13  Dean Jackson  <[email protected]>
+
+        SVG elements don't blend correctly into HTML
+        https://bugs.webkit.org/show_bug.cgi?id=158718
+        <rdar://problem/26782004>
+
+        Reviewed by Antoine Quint.
+
+        * svg/css/mix-blend-mode-with-inline-svg-expected.html: Added.
+        * svg/css/mix-blend-mode-with-inline-svg.html: Added.
+
 2016-06-13  Brady Eidson  <[email protected]>
 
         storage/indexeddb/modern/leaks-1.html leaks the database connection handle.

Added: trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg-expected.html (0 => 202022)


--- trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg-expected.html	2016-06-14 03:05:21 UTC (rev 202022)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<body>
+<svg width="300" height="300">
+    <rect x="20" y="20" width="100" height="100" fill="rgb(0,255,255)"/>
+    <rect x="140" y="20" width="100" height="100" fill="rgb(255,0,255)"/>
+    <rect x="20" y="140" width="100" height="100" fill="rgb(255,255,0)"/>
+    <rect x="140" y="140" width="100" height="100" fill="rgb(0,0,0)"/>
+</svg>
+</body>
Property changes on: trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg.html (0 => 202022)


--- trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg.html	                        (rev 0)
+++ trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg.html	2016-06-14 03:05:21 UTC (rev 202022)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<body>
+<svg width="300" height="300" style="mix-blend-mode: difference;">
+    <rect x="20" y="20" width="100" height="100" fill="rgb(255,0,0)"/>
+    <rect x="140" y="20" width="100" height="100" fill="rgb(0,255,0)"/>
+    <rect x="20" y="140" width="100" height="100" fill="rgb(0,0,255)"/>
+    <rect x="140" y="140" width="100" height="100" fill="rgb(255,255,255)"/>
+</svg>
+</body>
Property changes on: trunk/LayoutTests/svg/css/mix-blend-mode-with-inline-svg.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (202021 => 202022)


--- trunk/Source/WebCore/ChangeLog	2016-06-14 02:29:26 UTC (rev 202021)
+++ trunk/Source/WebCore/ChangeLog	2016-06-14 03:05:21 UTC (rev 202022)
@@ -1,3 +1,21 @@
+2016-06-13  Dean Jackson  <[email protected]>
+
+        SVG elements don't blend correctly into HTML
+        https://bugs.webkit.org/show_bug.cgi?id=158718
+        <rdar://problem/26782004>
+
+        Reviewed by Antoine Quint.
+
+        We were not creating any transparency layers for the root SVG nodes.
+        This is ok if the SVG is the root document, because it is the backdrop.
+        However, if it is inline SVG, it needs to apply the operation in
+        order to composite into the document.
+
+        Test: svg/css/mix-blend-mode-with-inline-svg.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::beginTransparencyLayers):
+
 2016-06-13  Brady Eidson  <[email protected]>
 
         storage/indexeddb/modern/leaks-1.html leaks the database connection handle.

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (202021 => 202022)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-06-14 02:29:26 UTC (rev 202021)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-06-14 03:05:21 UTC (rev 202022)
@@ -1815,15 +1815,15 @@
         context.clip(pixelSnappedClipRect);
 
 #if ENABLE(CSS_COMPOSITING)
-        // RenderSVGRoot takes care of its blend mode.
-        if (!renderer().isSVGRoot() && hasBlendMode())
+        bool usesCompositeOperation = hasBlendMode() && !(renderer().isSVGRoot() && parent() && parent()->isRootLayer());
+        if (usesCompositeOperation)
             context.setCompositeOperation(context.compositeOperation(), blendMode());
 #endif
 
         context.beginTransparencyLayer(renderer().opacity());
 
 #if ENABLE(CSS_COMPOSITING)
-        if (!renderer().isSVGRoot() && hasBlendMode())
+        if (usesCompositeOperation)
             context.setCompositeOperation(context.compositeOperation(), BlendModeNormal);
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to