<!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>[186571] branches/safari-600.1.4.17-branch</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/186571">186571</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2015-07-08 20:37:59 -0700 (Wed, 08 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/185392">r185392</a>.  rdar://problem/21716560</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6001417branchLayoutTestsChangeLog">branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreChangeLog">branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreplatformgraphicsIntRecth">branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/IntRect.h</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreplatformgraphicsfiltersFECompositecpp">branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreplatformgraphicsfiltersFilterEffectcpp">branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp</a></li>
<li><a href="#branchessafari6001417branchSourceWebCoreplatformgraphicsfiltersFilterEffecth">branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6001417branchLayoutTestssvgfiltersfeCompositebackgroundrectcontroloperatorsexpectedsvg">branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg</a></li>
<li><a href="#branchessafari6001417branchLayoutTestssvgfiltersfeCompositebackgroundrectcontroloperatorssvg">branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6001417branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog (186570 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog        2015-07-09 03:33:49 UTC (rev 186570)
+++ branches/safari-600.1.4.17-branch/LayoutTests/ChangeLog        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-07-08  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r185392
+
+    2015-06-09  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            feComposite filter does not clip the paint rect to its effect rect when the operator is 'in' or 'atop'
+            https://bugs.webkit.org/show_bug.cgi?id=137856
+
+            Reviewed by Darin Adler.
+
+            * svg/filters/feComposite-background-rect-control-operators-expected.svg: Added.
+            * svg/filters/feComposite-background-rect-control-operators.svg: Added.
+            Ensure the painting rect of the feComposite filter with operator 'in' or
+            'atop' is clipped to its bounding rectangle
+
</ins><span class="cx"> 2015-07-08  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r184653. rdar://problem/21716528
</span></span></pre></div>
<a id="branchessafari6001417branchLayoutTestssvgfiltersfeCompositebackgroundrectcontroloperatorsexpectedsvgfromrev185392trunkLayoutTestssvgfiltersfeCompositebackgroundrectcontroloperatorsexpectedsvg"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg (from rev 185392, trunk/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg) (0 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg                                (rev 0)
+++ branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; width=&quot;200&quot; height=&quot;100&quot;&gt;
+  &lt;rect x=&quot;20&quot; y=&quot;20&quot; width=&quot;60&quot; height=&quot;60&quot; fill=&quot;green&quot;/&gt;
+  &lt;rect x=&quot;120&quot; y=&quot;20&quot; width=&quot;60&quot; height=&quot;60&quot; fill=&quot;green&quot;/&gt;
+&lt;/svg&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari6001417branchLayoutTestssvgfiltersfeCompositebackgroundrectcontroloperatorssvgfromrev185392trunkLayoutTestssvgfiltersfeCompositebackgroundrectcontroloperatorssvg"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg (from rev 185392, trunk/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg) (0 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg                                (rev 0)
+++ branches/safari-600.1.4.17-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; width=&quot;200&quot; height=&quot;100&quot;&gt;
+  &lt;filter id=&quot;filter-in&quot; filterUnits=&quot;objectBoundingBox&quot; primitiveUnits=&quot;objectBoundingBox&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;1&quot; height=&quot;1&quot;&gt;
+    &lt;feFlood flood-color=&quot;orange&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;0.9&quot; height=&quot;0.9&quot; result=&quot;flood-orange&quot;/&gt;
+    &lt;feFlood flood-color=&quot;green&quot; x=&quot;0.1&quot; y=&quot;0.1&quot; width=&quot;0.9&quot; height=&quot;0.9&quot; result=&quot;flood-green&quot;/&gt;
+    &lt;feComposite x=&quot;0.2&quot; y=&quot;0.2&quot; width=&quot;0.6&quot; height=&quot;0.6&quot; operator=&quot;in&quot; in=&quot;flood-green&quot; in2=&quot;flood-orange&quot;/&gt;
+  &lt;/filter&gt;
+  &lt;filter id=&quot;filter-atop&quot; filterUnits=&quot;objectBoundingBox&quot; primitiveUnits=&quot;objectBoundingBox&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;1&quot; height=&quot;1&quot;&gt;
+    &lt;feFlood flood-color=&quot;orange&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;0.8&quot; height=&quot;0.8&quot; result=&quot;flood-orange&quot;/&gt;
+    &lt;feFlood flood-color=&quot;green&quot; x=&quot;0.2&quot; y=&quot;0.2&quot; width=&quot;0.8&quot; height=&quot;0.8&quot; result=&quot;flood-green&quot;/&gt;
+    &lt;feComposite x=&quot;0.2&quot; y=&quot;0.2&quot; width=&quot;0.8&quot; height=&quot;0.8&quot; operator=&quot;atop&quot; in=&quot;flood-green&quot; in2=&quot;flood-orange&quot;/&gt;
+  &lt;/filter&gt;
+  &lt;rect x=  &quot;0&quot; y=&quot;0&quot; width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot; filter=&quot;url(#filter-in)&quot;/&gt;
+  &lt;rect x=&quot;100&quot; y=&quot;0&quot; width=&quot;100&quot; height=&quot;100&quot; fill=&quot;red&quot; filter=&quot;url(#filter-atop)&quot;/&gt;
+&lt;/svg&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog (186570 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog        2015-07-09 03:33:49 UTC (rev 186570)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -1,5 +1,43 @@
</span><span class="cx"> 2015-07-08  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r185392
+
+    2015-06-09  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+            feComposite filter does not clip the paint rect to its effect rect when the operator is 'in' or 'atop'
+            https://bugs.webkit.org/show_bug.cgi?id=137856
+
+            Reviewed by Darin Adler.
+
+            There was bug in calculating the absolutePaintRect of the feComposite filter
+            when the operator is equal to 'in' or 'atop'. The absolutePaintRect was set
+            to the absolutePaintRect of the background FilterEffect which is correct.
+            What was missing is clipping this rectangle to the maxEffectRect of the
+            filter which we do for other operators.
+
+            Tests: svg/filters/feComposite-background-rect-control-operators.svg
+
+            * platform/graphics/IntRect.h:
+            (WebCore::operator-=):
+            (WebCore::operator-): Add new operators to IntRect.
+
+            * platform/graphics/filters/FEComposite.cpp:
+            (WebCore::FEComposite::determineAbsolutePaintRect): Make sure the filter
+            absolutePaintRect is clipped to maxEffectRect for all operators.
+
+            (WebCore::FEComposite::platformApplySoftware): Code clean-up.
+
+            * platform/graphics/filters/FilterEffect.cpp:
+            (WebCore::FilterEffect::determineAbsolutePaintRect): Move the clipping
+            part to a separate function.
+
+            (WebCore::FilterEffect::clipAbsolutePaintRect): Clip the absolutePaintRect
+            to the maxEffectRect of the filter.
+
+            * platform/graphics/filters/FilterEffect.h:
+
+2015-07-08  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r184965 rdar://problem/21716564
</span><span class="cx"> 
</span><span class="cx">     2015-05-28  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreplatformgraphicsIntRecth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/IntRect.h (186570 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/IntRect.h        2015-07-09 03:33:49 UTC (rev 186570)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/IntRect.h        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -225,6 +225,18 @@
</span><span class="cx">     return a.location() != b.location() || a.size() != b.size();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline IntRect&amp; operator-=(IntRect&amp; r, const IntPoint&amp; offset)
+{
+    r.move(-offset.x(), -offset.y());
+    return r;
+}
+
+inline IntRect operator-(const IntRect&amp; r, const IntPoint&amp; offset)
+{
+    IntRect t = r;
+    return t -= offset;
+}
+
</ins><span class="cx"> #if USE(CG)
</span><span class="cx"> IntRect enclosingIntRect(const CGRect&amp;);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreplatformgraphicsfiltersFECompositecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp (186570 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp        2015-07-09 03:33:49 UTC (rev 186570)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -237,6 +237,7 @@
</span><span class="cx">         // For In and Atop the first effect just influences the result of
</span><span class="cx">         // the second effect. So just use the absolute paint rect of the second effect here.
</span><span class="cx">         setAbsolutePaintRect(inputEffect(1)-&gt;absolutePaintRect());
</span><ins>+        clipAbsolutePaintRect();
</ins><span class="cx">         return;
</span><span class="cx">     case FECOMPOSITE_OPERATOR_ARITHMETIC:
</span><span class="cx">         // Arithmetic may influnce the compele filter primitive region. So we can't
</span><span class="lines">@@ -292,13 +293,11 @@
</span><span class="cx">         destinationRect.intersect(absolutePaintRect());
</span><span class="cx">         if (destinationRect.isEmpty())
</span><span class="cx">             break;
</span><del>-        IntPoint destinationPoint(destinationRect.x() - absolutePaintRect().x(), destinationRect.y() - absolutePaintRect().y());
-        IntRect sourceRect(IntPoint(destinationRect.x() - in-&gt;absolutePaintRect().x(),
-                                    destinationRect.y() - in-&gt;absolutePaintRect().y()), destinationRect.size());
-        IntRect source2Rect(IntPoint(destinationRect.x() - in2-&gt;absolutePaintRect().x(),
-                                     destinationRect.y() - in2-&gt;absolutePaintRect().y()), destinationRect.size());
-        filterContext-&gt;drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, IntRect(destinationPoint, source2Rect.size()), source2Rect);
-        filterContext-&gt;drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, IntRect(destinationPoint, sourceRect.size()), sourceRect, CompositeSourceIn);
</del><ins>+        IntRect adjustedDestinationRect = destinationRect - absolutePaintRect().location();
+        IntRect sourceRect = destinationRect - in-&gt;absolutePaintRect().location();
+        IntRect source2Rect = destinationRect - in2-&gt;absolutePaintRect().location();
+        filterContext-&gt;drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, adjustedDestinationRect, source2Rect);
+        filterContext-&gt;drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, adjustedDestinationRect, sourceRect, CompositeSourceIn);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case FECOMPOSITE_OPERATOR_OUT:
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreplatformgraphicsfiltersFilterEffectcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (186570 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2015-07-09 03:33:49 UTC (rev 186570)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -74,16 +74,18 @@
</span><span class="cx"> void FilterEffect::determineAbsolutePaintRect()
</span><span class="cx"> {
</span><span class="cx">     m_absolutePaintRect = IntRect();
</span><del>-    unsigned size = m_inputEffects.size();
-    for (unsigned i = 0; i &lt; size; ++i)
-        m_absolutePaintRect.unite(m_inputEffects.at(i)-&gt;absolutePaintRect());
-    
</del><ins>+    for (auto&amp; effect : m_inputEffects)
+        m_absolutePaintRect.unite(effect-&gt;absolutePaintRect());
+    clipAbsolutePaintRect();
+}
+
+void FilterEffect::clipAbsolutePaintRect()
+{
</ins><span class="cx">     // Filters in SVG clip to primitive subregion, while CSS doesn't.
</span><span class="cx">     if (m_clipsToBounds)
</span><span class="cx">         m_absolutePaintRect.intersect(enclosingIntRect(m_maxEffectRect));
</span><span class="cx">     else
</span><span class="cx">         m_absolutePaintRect.unite(enclosingIntRect(m_maxEffectRect));
</span><del>-    
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntRect FilterEffect::requestedRegionOfInputImageData(const IntRect&amp; effectRect) const
</span></span></pre></div>
<a id="branchessafari6001417branchSourceWebCoreplatformgraphicsfiltersFilterEffecth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h (186570 => 186571)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h        2015-07-09 03:33:49 UTC (rev 186570)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h        2015-07-09 03:37:59 UTC (rev 186571)
</span><span class="lines">@@ -179,6 +179,8 @@
</span><span class="cx">     // If a pre-multiplied image, check every pixel for validity and correct if necessary.
</span><span class="cx">     void forceValidPreMultipliedPixels();
</span><span class="cx"> 
</span><ins>+    void clipAbsolutePaintRect();
+
</ins><span class="cx"> private:
</span><span class="cx">     std::unique_ptr&lt;ImageBuffer&gt; m_imageBufferResult;
</span><span class="cx">     RefPtr&lt;Uint8ClampedArray&gt; m_unmultipliedImageResult;
</span></span></pre>
</div>
</div>

</body>
</html>