<!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>[192224] releases/WebKitGTK/webkit-2.10</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/192224">192224</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-10 03:26:20 -0800 (Tue, 10 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/191731">r191731</a> - Exploitable crash happens when an SVG contains an indirect resource inheritance cycle
https://bugs.webkit.org/show_bug.cgi?id=150203

Reviewed by Brent Fulgham.

Source/WebCore:

Detecting cycles in SVG resource references happens in two places.
1. In SVGResourcesCycleSolver::resolveCycles() which it is called from
   SVGResourcesCache::addResourcesFromRenderer(). When a cycle is deleted,
   SVGResourcesCycleSolver::breakCycle() is called to break the link. In
   the case of a cyclic resource inheritance, SVGResources::resetLinkedResource()
   is called to break this cycle.
2. SVGPatternElement::collectPatternAttributes() which is called from
   RenderSVGResourcePattern::buildPattern(). The purpose is to resolve
   the pattern attributes and to build a tile image which can be used to
   fill the SVG element renderer. Detecting the cyclic resource reference
   in this function is not sufficient and can detect simple cycles like
    &lt;pattern id=&quot;a&quot; xlink:href=&quot;#b&quot;/&gt;
    &lt;pattern id=&quot;b&quot; xlink:href=&quot;#a&quot;/&gt;.
   But it does not detect cycles like:
    &lt;pattern id=&quot;a&quot;&gt;
        &lt;rect fill=&quot;url(#b)&quot;/&gt;
    &lt;/pattern&gt;
    &lt;pattern id=&quot;b&quot; xlink:href=&quot;#a&quot;/&gt;.

The fix is to get rid of SVGPatternElement::collectPatternAttributes() which
uses SVGURIReference::targetElementFromIRIString() to navigates through the
referenced resource elements and tries to detect cycles. Instead we can
implement RenderSVGResourcePattern::collectPatternAttributes() which calls
SVGResourcesCache::cachedResourcesForRenderer() to get the SVGResources
of the pattern. Then we use SVGResources::linkedResource() to navigate the
resource inheritance tree. The cached SVGResources is guaranteed to be free
of cycles.

Tests: svg/custom/pattern-content-inheritance-cycle.svg

* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::collectPatternAttributes):
Collect the pattern attributes through the cachedResourcesForRenderer().

(WebCore::RenderSVGResourcePattern::buildPattern):
Direct the call to the renderer function.

* rendering/svg/RenderSVGResourcePattern.h:

* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):
RenderSVGRoot needs to call SVGResourcesCache::clientStyleChanged() for all
the invalidated resources. If an attribute of an SVG resource was updated
dynamically, the cached SVGResources associated with the renderer of this
resource was stale.

* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
Direct the call to the renderer function.

* svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::collectPatternAttributes):
(WebCore::setPatternAttributes): Deleted.
collectPatternAttributes() is a replacement of setPatternAttributes().

LayoutTests:

Ensure that we do not crash when an SVG has an indirect cyclic resource
inheritance. Make sure the cyclic resource was just ignored as if it did
not exist.

* svg/custom/pattern-content-inheritance-cycle-expected.svg: Added.
* svg/custom/pattern-content-inheritance-cycle.svg: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingsvgRenderSVGResourcePatterncpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingsvgRenderSVGResourcePatternh">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingsvgRenderSVGRootcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGRoot.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCorerenderingsvgSVGRenderTreeAsTextcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoresvgSVGPatternElementcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/svg/SVGPatternElement.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestssvgcustompatterncontentinheritancecycleexpectedsvg">releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle-expected.svg</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestssvgcustompatterncontentinheritancecyclesvg">releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle.svg</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-10-29  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+        Exploitable crash happens when an SVG contains an indirect resource inheritance cycle
+        https://bugs.webkit.org/show_bug.cgi?id=150203
+
+        Reviewed by Brent Fulgham.
+
+        Ensure that we do not crash when an SVG has an indirect cyclic resource
+        inheritance. Make sure the cyclic resource was just ignored as if it did
+        not exist.
+
+        * svg/custom/pattern-content-inheritance-cycle-expected.svg: Added.
+        * svg/custom/pattern-content-inheritance-cycle.svg: Added.
+
</ins><span class="cx"> 2015-10-28  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Should never be reached failure in WebCore::backgroundRectForBox
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestssvgcustompatterncontentinheritancecycleexpectedsvg"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle-expected.svg (0 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle-expected.svg                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle-expected.svg        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;
+    &lt;g fill=&quot;none&quot; stroke=&quot;black&quot; stroke-width=&quot;1&quot;&gt;
+        &lt;circle cx=&quot;75&quot; cy=&quot;75&quot; fill=&quot;lime&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;75&quot; fill=&quot;none&quot; r=&quot;50&quot;/&gt;
+
+        &lt;circle cx=&quot;75&quot; cy=&quot;200&quot; fill=&quot;lime&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;200&quot; fill=&quot;none&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;325&quot; cy=&quot;200&quot; fill=&quot;none&quot; r=&quot;50&quot;/&gt;
+    
+        &lt;circle cx=&quot;75&quot; cy=&quot;325&quot; fill=&quot;lime&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;325&quot; fill=&quot;none&quot; r=&quot;50&quot;/&gt;
+    
+        &lt;circle cx=&quot;75&quot; cy=&quot;450&quot; fill=&quot;lime&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;450&quot; fill=&quot;none&quot; r=&quot;50&quot;/&gt;
+    &lt;/g&gt;
+&lt;/svg&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestssvgcustompatterncontentinheritancecyclesvg"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle.svg (0 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle.svg                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/svg/custom/pattern-content-inheritance-cycle.svg        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; version=&quot;1.1&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot;&gt;
+    &lt;defs&gt;
+        &lt;!-- a =&gt; b =&gt; a --&gt;
+        &lt;pattern id=&quot;a&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;.25&quot; height=&quot;.25&quot;&gt;
+            &lt;rect fill=&quot;lime&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+            &lt;rect fill=&quot;url(#b)&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+        &lt;/pattern&gt;
+        &lt;pattern id=&quot;b&quot; xlink:href=&quot;#a&quot;/&gt;
+        
+        &lt;!-- l =&gt; m =&gt; n =&gt; l --&gt;
+        &lt;pattern id=&quot;l&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;.25&quot; height=&quot;.25&quot;&gt;
+            &lt;rect fill=&quot;lime&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+            &lt;rect fill=&quot;url(#m)&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+        &lt;/pattern&gt;
+        &lt;pattern id=&quot;m&quot; xlink:href=&quot;#n&quot;/&gt;
+        &lt;pattern id=&quot;n&quot; xlink:href=&quot;#l&quot;/&gt;
+        
+        &lt;!-- p =&gt; q --&gt;
+        &lt;pattern id=&quot;p&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;.25&quot; height=&quot;.25&quot;&gt;
+            &lt;rect fill=&quot;lime&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+            &lt;rect fill=&quot;url(#q)&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+        &lt;/pattern&gt;
+        &lt;pattern id=&quot;q&quot;/&gt;
+        
+        &lt;!-- t =&gt; s --&gt;
+        &lt;pattern id=&quot;s&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;.25&quot; height=&quot;.25&quot;&gt;
+            &lt;rect fill=&quot;lime&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+            &lt;rect id=&quot;r&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;
+        &lt;/pattern&gt;
+        &lt;pattern id=&quot;t&quot; xlink:href=&quot;#s&quot;/&gt;
+    &lt;/defs&gt;
+    &lt;g fill=&quot;none&quot; stroke=&quot;black&quot; stroke-width=&quot;1&quot;&gt;
+        &lt;circle cx=&quot;75&quot; cy=&quot;75&quot; fill=&quot;url(#a)&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;75&quot; fill=&quot;url(#b)&quot; r=&quot;50&quot;/&gt;
+
+        &lt;circle cx=&quot;75&quot; cy=&quot;200&quot; fill=&quot;url(#l)&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;200&quot; fill=&quot;url(#m)&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;325&quot; cy=&quot;200&quot; fill=&quot;url(#n)&quot; r=&quot;50&quot;/&gt;
+    
+        &lt;circle cx=&quot;75&quot; cy=&quot;325&quot; fill=&quot;url(#p)&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;325&quot; fill=&quot;url(#q)&quot; r=&quot;50&quot;/&gt;
+    
+        &lt;circle cx=&quot;75&quot; cy=&quot;450&quot; fill=&quot;url(#s)&quot; r=&quot;50&quot;/&gt;
+        &lt;circle cx=&quot;200&quot; cy=&quot;450&quot; fill=&quot;url(#t)&quot; r=&quot;50&quot;/&gt;
+    &lt;/g&gt;
+    &lt;script&gt;
+        // Add q =&gt; p to get p =&gt; q =&gt; p
+        document.getElementById(&quot;q&quot;).setAttributeNS(&quot;http://www.w3.org/1999/xlink&quot;, &quot;href&quot;, &quot;#p&quot;);        
+        
+        // Add s =&gt; t to get s =&gt; t =&gt; s
+        document.getElementById(&quot;r&quot;).setAttribute(&quot;fill&quot;, &quot;url(#t)&quot;);
+        
+        // Force layout
+        document.documentElement.removeAttribute(&quot;class&quot;);
+    &lt;/script&gt;
+&lt;/svg&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2015-10-29  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+        Exploitable crash happens when an SVG contains an indirect resource inheritance cycle
+        https://bugs.webkit.org/show_bug.cgi?id=150203
+
+        Reviewed by Brent Fulgham.
+
+        Detecting cycles in SVG resource references happens in two places.
+        1. In SVGResourcesCycleSolver::resolveCycles() which it is called from 
+           SVGResourcesCache::addResourcesFromRenderer(). When a cycle is deleted,
+           SVGResourcesCycleSolver::breakCycle() is called to break the link. In
+           the case of a cyclic resource inheritance, SVGResources::resetLinkedResource()
+           is called to break this cycle.
+        2. SVGPatternElement::collectPatternAttributes() which is called from
+           RenderSVGResourcePattern::buildPattern(). The purpose is to resolve
+           the pattern attributes and to build a tile image which can be used to
+           fill the SVG element renderer. Detecting the cyclic resource reference
+           in this function is not sufficient and can detect simple cycles like
+            &lt;pattern id=&quot;a&quot; xlink:href=&quot;#b&quot;/&gt;
+            &lt;pattern id=&quot;b&quot; xlink:href=&quot;#a&quot;/&gt;.
+           But it does not detect cycles like:
+            &lt;pattern id=&quot;a&quot;&gt;
+                &lt;rect fill=&quot;url(#b)&quot;/&gt;
+            &lt;/pattern&gt;
+            &lt;pattern id=&quot;b&quot; xlink:href=&quot;#a&quot;/&gt;.
+   
+        The fix is to get rid of SVGPatternElement::collectPatternAttributes() which
+        uses SVGURIReference::targetElementFromIRIString() to navigates through the
+        referenced resource elements and tries to detect cycles. Instead we can
+        implement RenderSVGResourcePattern::collectPatternAttributes() which calls
+        SVGResourcesCache::cachedResourcesForRenderer() to get the SVGResources
+        of the pattern. Then we use SVGResources::linkedResource() to navigate the
+        resource inheritance tree. The cached SVGResources is guaranteed to be free
+        of cycles.
+
+        Tests: svg/custom/pattern-content-inheritance-cycle.svg
+
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::collectPatternAttributes):
+        Collect the pattern attributes through the cachedResourcesForRenderer().
+        
+        (WebCore::RenderSVGResourcePattern::buildPattern):
+        Direct the call to the renderer function.
+        
+        * rendering/svg/RenderSVGResourcePattern.h:
+        
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::layout):
+        RenderSVGRoot needs to call SVGResourcesCache::clientStyleChanged() for all
+        the invalidated resources. If an attribute of an SVG resource was updated
+        dynamically, the cached SVGResources associated with the renderer of this
+        resource was stale.
+        
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::writeSVGResourceContainer):
+        Direct the call to the renderer function.        
+        
+        * svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::collectPatternAttributes):
+        (WebCore::setPatternAttributes): Deleted.
+        collectPatternAttributes() is a replacement of setPatternAttributes().
+        
</ins><span class="cx"> 2015-10-28  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Should never be reached failure in WebCore::backgroundRectForBox
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingsvgRenderSVGResourcePatterncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -27,6 +27,8 @@
</span><span class="cx"> #include &quot;RenderSVGRoot.h&quot;
</span><span class="cx"> #include &quot;SVGFitToViewBox.h&quot;
</span><span class="cx"> #include &quot;SVGRenderingContext.h&quot;
</span><ins>+#include &quot;SVGResources.h&quot;
+#include &quot;SVGResourcesCache.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -54,6 +56,19 @@
</span><span class="cx">     markClientForInvalidation(client, markForInvalidation ? RepaintInvalidation : ParentOnlyInvalidation);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderSVGResourcePattern::collectPatternAttributes(PatternAttributes&amp; attributes) const
+{
+    const RenderSVGResourcePattern* current = this;
+
+    while (current) {
+        const SVGPatternElement&amp; pattern = current-&gt;patternElement();
+        pattern.collectPatternAttributes(attributes);
+
+        auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*current);
+        current = resources ? downcast&lt;RenderSVGResourcePattern&gt;(resources-&gt;linkedResource()) : nullptr;
+    }
+}
+
</ins><span class="cx"> PatternData* RenderSVGResourcePattern::buildPattern(RenderElement&amp; renderer, unsigned short resourceMode, GraphicsContext&amp; context)
</span><span class="cx"> {
</span><span class="cx">     PatternData* currentData = m_patternMap.get(&amp;renderer);
</span><span class="lines">@@ -64,7 +79,7 @@
</span><span class="cx">         patternElement().synchronizeAnimatedSVGAttribute(anyQName());
</span><span class="cx"> 
</span><span class="cx">         m_attributes = PatternAttributes();
</span><del>-        patternElement().collectPatternAttributes(m_attributes);
</del><ins>+        collectPatternAttributes(m_attributes);
</ins><span class="cx">         m_shouldCollectPatternAttributes = false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingsvgRenderSVGResourcePatternh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -53,6 +53,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RenderSVGResourceType resourceType() const override { return PatternResourceType; }
</span><span class="cx"> 
</span><ins>+    void collectPatternAttributes(PatternAttributes&amp;) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     void element() const = delete;
</span><span class="cx">     virtual const char* renderName() const override { return &quot;RenderSVGResourcePattern&quot;; }
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingsvgRenderSVGRootcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -180,9 +180,10 @@
</span><span class="cx"> 
</span><span class="cx">     if (!m_resourcesNeedingToInvalidateClients.isEmpty()) {
</span><span class="cx">         // Invalidate resource clients, which may mark some nodes for layout.
</span><del>-        HashSet&lt;RenderSVGResourceContainer*&gt;::iterator end = m_resourcesNeedingToInvalidateClients.end();
-        for (HashSet&lt;RenderSVGResourceContainer*&gt;::iterator it = m_resourcesNeedingToInvalidateClients.begin(); it != end; ++it)
-            (*it)-&gt;removeAllClientsFromCache();
</del><ins>+        for (auto&amp; resource :  m_resourcesNeedingToInvalidateClients) {
+            resource-&gt;removeAllClientsFromCache();
+            SVGResourcesCache::clientStyleChanged(*resource, StyleDifferenceLayout, resource-&gt;style());
+        }
</ins><span class="cx"> 
</span><span class="cx">         m_isLayoutSizeChanged = false;
</span><span class="cx">         SVGRenderSupport::layoutChildren(*this, false);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCorerenderingsvgSVGRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -510,7 +510,7 @@
</span><span class="cx">         // Dump final results that are used for rendering. No use in asking SVGPatternElement for its patternUnits(), as it may
</span><span class="cx">         // link to other patterns using xlink:href, we need to build the full inheritance chain, aka. collectPatternProperties()
</span><span class="cx">         PatternAttributes attributes;
</span><del>-        pattern.patternElement().collectPatternAttributes(attributes);
</del><ins>+        pattern.collectPatternAttributes(attributes);
</ins><span class="cx"> 
</span><span class="cx">         writeNameValuePair(ts, &quot;patternUnits&quot;, attributes.patternUnits());
</span><span class="cx">         writeNameValuePair(ts, &quot;patternContentUnits&quot;, attributes.patternContentUnits());
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoresvgSVGPatternElementcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/svg/SVGPatternElement.cpp (192223 => 192224)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/svg/SVGPatternElement.cpp        2015-11-10 11:17:32 UTC (rev 192223)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/svg/SVGPatternElement.cpp        2015-11-10 11:26:20 UTC (rev 192224)
</span><span class="lines">@@ -187,65 +187,42 @@
</span><span class="cx">     return createRenderer&lt;RenderSVGResourcePattern&gt;(*this, WTF::move(style));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void setPatternAttributes(const SVGPatternElement&amp; element, PatternAttributes&amp; attributes)
</del><ins>+void SVGPatternElement::collectPatternAttributes(PatternAttributes&amp; attributes) const
</ins><span class="cx"> {
</span><del>-    if (!attributes.hasX() &amp;&amp; element.hasAttribute(SVGNames::xAttr))
-        attributes.setX(element.x());
</del><ins>+    if (!attributes.hasX() &amp;&amp; hasAttribute(SVGNames::xAttr))
+        attributes.setX(x());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasY() &amp;&amp; element.hasAttribute(SVGNames::yAttr))
-        attributes.setY(element.y());
</del><ins>+    if (!attributes.hasY() &amp;&amp; hasAttribute(SVGNames::yAttr))
+        attributes.setY(y());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasWidth() &amp;&amp; element.hasAttribute(SVGNames::widthAttr))
-        attributes.setWidth(element.width());
</del><ins>+    if (!attributes.hasWidth() &amp;&amp; hasAttribute(SVGNames::widthAttr))
+        attributes.setWidth(width());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasHeight() &amp;&amp; element.hasAttribute(SVGNames::heightAttr))
-        attributes.setHeight(element.height());
</del><ins>+    if (!attributes.hasHeight() &amp;&amp; hasAttribute(SVGNames::heightAttr))
+        attributes.setHeight(height());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasViewBox() &amp;&amp; element.hasAttribute(SVGNames::viewBoxAttr) &amp;&amp; element.viewBoxIsValid())
-        attributes.setViewBox(element.viewBox());
</del><ins>+    if (!attributes.hasViewBox() &amp;&amp; hasAttribute(SVGNames::viewBoxAttr) &amp;&amp; viewBoxIsValid())
+        attributes.setViewBox(viewBox());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasPreserveAspectRatio() &amp;&amp; element.hasAttribute(SVGNames::preserveAspectRatioAttr))
-        attributes.setPreserveAspectRatio(element.preserveAspectRatio());
</del><ins>+    if (!attributes.hasPreserveAspectRatio() &amp;&amp; hasAttribute(SVGNames::preserveAspectRatioAttr))
+        attributes.setPreserveAspectRatio(preserveAspectRatio());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasPatternUnits() &amp;&amp; element.hasAttribute(SVGNames::patternUnitsAttr))
-        attributes.setPatternUnits(element.patternUnits());
</del><ins>+    if (!attributes.hasPatternUnits() &amp;&amp; hasAttribute(SVGNames::patternUnitsAttr))
+        attributes.setPatternUnits(patternUnits());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasPatternContentUnits() &amp;&amp; element.hasAttribute(SVGNames::patternContentUnitsAttr))
-        attributes.setPatternContentUnits(element.patternContentUnits());
</del><ins>+    if (!attributes.hasPatternContentUnits() &amp;&amp; hasAttribute(SVGNames::patternContentUnitsAttr))
+        attributes.setPatternContentUnits(patternContentUnits());
</ins><span class="cx"> 
</span><del>-    if (!attributes.hasPatternTransform() &amp;&amp; element.hasAttribute(SVGNames::patternTransformAttr)) {
</del><ins>+    if (!attributes.hasPatternTransform() &amp;&amp; hasAttribute(SVGNames::patternTransformAttr)) {
</ins><span class="cx">         AffineTransform transform;
</span><del>-        element.patternTransform().concatenate(transform);
</del><ins>+        patternTransform().concatenate(transform);
</ins><span class="cx">         attributes.setPatternTransform(transform);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!attributes.hasPatternContentElement() &amp;&amp; element.childElementCount())
-        attributes.setPatternContentElement(&amp;element);
</del><ins>+    if (!attributes.hasPatternContentElement() &amp;&amp; childElementCount())
+        attributes.setPatternContentElement(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGPatternElement::collectPatternAttributes(PatternAttributes&amp; attributes) const
-{
-    HashSet&lt;const SVGPatternElement*&gt; processedPatterns;
-    const SVGPatternElement* current = this;
-
-    while (true) {
-        setPatternAttributes(*current, attributes);
-        processedPatterns.add(current);
-
-        // Respect xlink:href, take attributes from referenced element
-        Element* refElement = SVGURIReference::targetElementFromIRIString(current-&gt;href(), document());
-        if (is&lt;SVGPatternElement&gt;(refElement)) {
-            current = downcast&lt;SVGPatternElement&gt;(refElement);
-
-            // Cycle detection
-            if (processedPatterns.contains(current))
-                return;
-        } else
-            return;
-    }
-    ASSERT_NOT_REACHED();
-}
-
</del><span class="cx"> AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const
</span><span class="cx"> {
</span><span class="cx">     AffineTransform matrix;
</span></span></pre>
</div>
</div>

</body>
</html>