<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[246309] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/246309">246309</a></dd>
<dt>Author</dt> <dd>Hironori.Fujii@sony.com</dd>
<dt>Date</dt> <dd>2019-06-11 05:50:50 -0700 (Tue, 11 Jun 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts
https://bugs.webkit.org/show_bug.cgi?id=198701

Source/WebCore:

PlatformContextCairo::pushImageMask blits wrong position of the
surface to the background of masking objects. And, I don't know
the reason why this blitting is needed. Removed the blitting.

Reviewed by Carlos Garcia Campos.

Tests: svg/clip-path/clip-opacity.html
       svg/clip-path/svg-in-html.html

* platform/graphics/cairo/PlatformContextCairo.cpp:
(WebCore::PlatformContextCairo::pushImageMask): Don't blit the
surface to the background.

LayoutTests:

Reviewed by Carlos Garcia Campos.

* platform/gtk/TestExpectations:
* platform/wpe/TestExpectations:
Unskipped svg/gradients/spreadMethodDiagonal3.svg and svg/gradients/spreadMethodDiagonal4.svg.

* svg/clip-path/clip-opacity-expected.html: Added.
* svg/clip-path/clip-opacity.html: Added.
* svg/clip-path/svg-in-html-expected.html: Added.
* svg/clip-path/svg-in-html.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwpeTestExpectations">trunk/LayoutTests/platform/wpe/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoPlatformContextCairocpp">trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvgclippathclipopacityexpectedhtml">trunk/LayoutTests/svg/clip-path/clip-opacity-expected.html</a></li>
<li><a href="#trunkLayoutTestssvgclippathclipopacityhtml">trunk/LayoutTests/svg/clip-path/clip-opacity.html</a></li>
<li><a href="#trunkLayoutTestssvgclippathsvginhtmlexpectedhtml">trunk/LayoutTests/svg/clip-path/svg-in-html-expected.html</a></li>
<li><a href="#trunkLayoutTestssvgclippathsvginhtmlhtml">trunk/LayoutTests/svg/clip-path/svg-in-html.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (246308 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-06-11 11:17:31 UTC (rev 246308)
+++ trunk/LayoutTests/ChangeLog 2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2019-06-11  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts
+        https://bugs.webkit.org/show_bug.cgi?id=198701
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/TestExpectations:
+        * platform/wpe/TestExpectations:
+        Unskipped svg/gradients/spreadMethodDiagonal3.svg and svg/gradients/spreadMethodDiagonal4.svg.
+
+        * svg/clip-path/clip-opacity-expected.html: Added.
+        * svg/clip-path/clip-opacity.html: Added.
+        * svg/clip-path/svg-in-html-expected.html: Added.
+        * svg/clip-path/svg-in-html.html: Added.
+
</ins><span class="cx"> 2019-06-10  Daniel Bates  <dabates@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [CSP] Blob URLs should inherit their CSP policy
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (246308 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations  2019-06-11 11:17:31 UTC (rev 246308)
+++ trunk/LayoutTests/platform/gtk/TestExpectations     2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -3622,8 +3622,6 @@
</span><span class="cx"> webkit.org/b/189737 editing/pasteboard/4930986-3-paste-as-quotation.html [ Failure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/189739 svg/gradients/spreadMethodClose2.svg [ ImageOnlyFailure ]
</span><del>-webkit.org/b/189739 svg/gradients/spreadMethodDiagonal3.svg [ ImageOnlyFailure ]
-webkit.org/b/189739 svg/gradients/spreadMethodDiagonal4.svg [ ImageOnlyFailure ]
</del><span class="cx"> 
</span><span class="cx"> webkit.org/b/189994 fast/files/xhr-response-blob.html [ Failure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwpeTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wpe/TestExpectations (246308 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wpe/TestExpectations  2019-06-11 11:17:31 UTC (rev 246308)
+++ trunk/LayoutTests/platform/wpe/TestExpectations     2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -1306,8 +1306,6 @@
</span><span class="cx"> webkit.org/b/160137 svg/custom/non-scaling-stroke-update.svg [ ImageOnlyFailure Pass ]
</span><span class="cx"> webkit.org/b/112228 svg/custom/resources-css-scaled.html [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/189739 svg/gradients/spreadMethodClose2.svg [ ImageOnlyFailure ]
</span><del>-webkit.org/b/189739 svg/gradients/spreadMethodDiagonal3.svg [ ImageOnlyFailure ]
-webkit.org/b/189739 svg/gradients/spreadMethodDiagonal4.svg [ ImageOnlyFailure ]
</del><span class="cx"> webkit.org/b/115440 svg/stroke/animated-non-scaling-stroke.html [ ImageOnlyFailure Pass ]
</span><span class="cx"> webkit.org/b/88230 svg/stroke/non-scaling-stroke-pattern.svg [ ImageOnlyFailure Pass ]
</span><span class="cx"> webkit.org/b/137096 svg/text/alt-glyph-for-surrogate-pair.svg [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestssvgclippathclipopacityexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/clip-path/clip-opacity-expected.html (0 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/clip-path/clip-opacity-expected.html                               (rev 0)
+++ trunk/LayoutTests/svg/clip-path/clip-opacity-expected.html  2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<svg xmlns="http://www.w3.org/2000/svg" width="350">
+<g>
+  <circle cx="50" cy="50" r="50" fill="green"/>
+  <circle cx="100" cy="50" r="50" fill="red" />
+  <g>
+    <circle cx="50" cy="100" r="50" fill="green" opacity=".5" />
+    <circle cx="100" cy="100" r="50" fill="red"  opacity=".5" />
+  </g>
+</g>
+<g transform="translate(200,0)">
+  <circle cx="50" cy="50" r="50" fill="green"/>
+  <circle cx="100" cy="50" r="50" fill="red" />
+  <g>
+    <circle cx="50" cy="100" r="50" fill="green" opacity=".5" />
+    <circle cx="100" cy="100" r="50" fill="red"  opacity=".5" />
+  </g>
+</g>
+</svg>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestssvgclippathclipopacityhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/clip-path/clip-opacity.html (0 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/clip-path/clip-opacity.html                                (rev 0)
+++ trunk/LayoutTests/svg/clip-path/clip-opacity.html   2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<svg xmlns="http://www.w3.org/2000/svg" width="350">
+<defs>
+<clipPath id="clip1">
+    <rect width="200" height="200"/>
+</clipPath>
+<clipPath id="clip2">
+    <rect width="200" height="200"/>
+    <rect width="200" height="200"/>
+</clipPath>
+</defs>
+<g>
+  <circle cx="50" cy="50" r="50" fill="green"/>
+  <circle cx="100" cy="50" r="50" fill="red" />
+  <g clip-path="url(#clip1)">
+    <circle cx="50" cy="100" r="50" fill="green" opacity=".5" />
+    <circle cx="100" cy="100" r="50" fill="red"  opacity=".5" />
+  </g>
+</g>
+<g transform="translate(200,0)">
+  <circle cx="50" cy="50" r="50" fill="green"/>
+  <circle cx="100" cy="50" r="50" fill="red" />
+  <g clip-path="url(#clip2)">
+    <circle cx="50" cy="100" r="50" fill="green" opacity=".5" />
+    <circle cx="100" cy="100" r="50" fill="red"  opacity=".5" />
+  </g>
+</g>
+</svg>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestssvgclippathsvginhtmlexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/clip-path/svg-in-html-expected.html (0 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/clip-path/svg-in-html-expected.html                                (rev 0)
+++ trunk/LayoutTests/svg/clip-path/svg-in-html-expected.html   2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+    border: 2em blue solid;
+}
+svg {
+    background: pink;
+}
+</style>
+</head>
+<body>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <g>
+        <circle cx="1" cy="1" r="1" fill="green"></circle>
+        <circle cx="7" cy="1" r="1" fill="green"></circle>
+    </g>
+</svg>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <g>
+        <circle cx="1" cy="7" r="1" fill="green"></circle>
+        <circle cx="7" cy="7" r="1" fill="green"></circle>
+    </g>
+</svg>
+<br>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <g>
+        <circle cx="1" cy="1" r="1" fill="green"></circle>
+        <circle cx="7" cy="1" r="1" fill="green"></circle>
+    </g>
+</svg>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <g>
+        <circle cx="1" cy="7" r="1" fill="green"></circle>
+        <circle cx="7" cy="7" r="1" fill="green"></circle>
+    </g>
+</svg>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestssvgclippathsvginhtmlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/clip-path/svg-in-html.html (0 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/clip-path/svg-in-html.html                         (rev 0)
+++ trunk/LayoutTests/svg/clip-path/svg-in-html.html    2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+    border: 2em blue solid;
+}
+svg {
+    background: pink;
+}
+</style>
+</head>
+<body>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <clippath id="clip1">
+        <rect width="8" height="4"></rect>
+    </clippath>
+    <g clip-path="url(#clip1)">
+        <circle cx="1" cy="1" r="1" fill="green"></circle>
+        <circle cx="7" cy="1" r="1" fill="green"></circle>
+        <circle cx="1" cy="7" r="1" fill="green"></circle>
+        <circle cx="7" cy="7" r="1" fill="green"></circle>
+    </g>
+</svg>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <clippath id="clip2">
+        <rect y="4" width="8" height="4"></rect>
+    </clippath>
+    <g clip-path="url(#clip2)">
+        <circle cx="1" cy="1" r="1" fill="green"></circle>
+        <circle cx="7" cy="1" r="1" fill="green"></circle>
+        <circle cx="1" cy="7" r="1" fill="green"></circle>
+        <circle cx="7" cy="7" r="1" fill="green"></circle>
+    </g>
+</svg>
+<br>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <clippath id="clip3">
+        <rect width="8" height="2"></rect>
+        <rect y="4" width="8" height="2"></rect>
+    </clippath>
+    <g clip-path="url(#clip3)">
+        <circle cx="1" cy="1" r="1" fill="green"></circle>
+        <circle cx="7" cy="1" r="1" fill="green"></circle>
+        <circle cx="1" cy="7" r="1" fill="green"></circle>
+        <circle cx="7" cy="7" r="1" fill="green"></circle>
+    </g>
+</svg>
+<svg width="200px" height="200px" viewBox="0 0 8 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <clippath id="clip4">
+        <rect y="2" width="8" height="2"></rect>
+        <rect y="6" width="8" height="2"></rect>
+    </clippath>
+    <g clip-path="url(#clip4)">
+        <circle cx="1" cy="1" r="1" fill="green"></circle>
+        <circle cx="7" cy="1" r="1" fill="green"></circle>
+        <circle cx="1" cy="7" r="1" fill="green"></circle>
+        <circle cx="7" cy="7" r="1" fill="green"></circle>
+    </g>
+</svg>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (246308 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-06-11 11:17:31 UTC (rev 246308)
+++ trunk/Source/WebCore/ChangeLog      2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2019-06-11  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [cairo][SVG] Putting multiple path elements in clippath causes rendering artifacts
+        https://bugs.webkit.org/show_bug.cgi?id=198701
+
+        PlatformContextCairo::pushImageMask blits wrong position of the
+        surface to the background of masking objects. And, I don't know
+        the reason why this blitting is needed. Removed the blitting.
+
+        Reviewed by Carlos Garcia Campos.
+
+        Tests: svg/clip-path/clip-opacity.html
+               svg/clip-path/svg-in-html.html
+
+        * platform/graphics/cairo/PlatformContextCairo.cpp:
+        (WebCore::PlatformContextCairo::pushImageMask): Don't blit the
+        surface to the background.
+
</ins><span class="cx"> 2019-06-10  Fujii Hironori  <Hironori.Fujii@sony.com>
</span><span class="cx"> 
</span><span class="cx">         [WinCairo][MediaFoundation] Remove the unused video window
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoPlatformContextCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp (246308 => 246309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp    2019-06-11 11:17:31 UTC (rev 246308)
+++ trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp       2019-06-11 12:50:50 UTC (rev 246309)
</span><span class="lines">@@ -110,24 +110,7 @@
</span><span class="cx">     // Cairo doesn't support the notion of an image clip, so we push a group here
</span><span class="cx">     // and then paint it to the surface with an image mask (which is an immediate
</span><span class="cx">     // operation) during restorePlatformState.
</span><del>-
-    // We want to allow the clipped elements to composite with the surface as it
-    // is now, but they are isolated in another group. To make this work, we're
-    // going to blit the current surface contents onto the new group once we push it.
-    cairo_surface_t* currentTarget = cairo_get_target(m_cr.get());
-    cairo_surface_flush(currentTarget);
-
-    // Pushing a new group ensures that only things painted after this point are clipped.
</del><span class="cx">     cairo_push_group(m_cr.get());
</span><del>-    cairo_set_operator(m_cr.get(), CAIRO_OPERATOR_SOURCE);
-
-    // To avoid the limit of Pixman backend, we need to reduce the size of pattern matrix
-    // See https://bugs.webkit.org/show_bug.cgi?id=154283
-    cairo_set_source_surface(m_cr.get(), currentTarget, rect.x(), rect.y());
-    cairo_translate(m_cr.get(), rect.x(), rect.y());
-    cairo_rectangle(m_cr.get(), 0, 0, rect.width(), rect.height());
-    cairo_fill(m_cr.get());
-    cairo_translate(m_cr.get(), -rect.x(), -rect.y());
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>