<!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>[206603] trunk/Source/WebCore</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/206603">206603</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-09-29 12:36:39 -0700 (Thu, 29 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove addSubresourceStyleURLs functions
https://bugs.webkit.org/show_bug.cgi?id=162731

Reviewed by Ryosuke Niwa.

Use the generic std::function taking traverseSubresources instead. This prevents bugs caused by the code paths
not being in sync.

These functions are only used by the legacy webarchive code to gather URLs to locate CachedResources from the memory cache.
This can be improved further by returning the cached resources themselves instead of the URLs.

* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): Deleted.
* css/CSSFontFaceSrcValue.h:
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): Deleted.
* css/CSSPrimitiveValue.h:
* css/CSSReflectValue.cpp:
(WebCore::CSSReflectValue::addSubresourceStyleURLs): Deleted.
* css/CSSReflectValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::addSubresourceStyleURLs): Deleted.
* css/CSSValue.h:
* css/CSSValueList.cpp:
(WebCore::CSSValueList::addSubresourceStyleURLs): Deleted.
* css/CSSValueList.h:
* css/StyleProperties.cpp:
(WebCore::StyleProperties::addSubresourceStyleURLs): Deleted.
* css/StyleProperties.h:
* css/StyleRuleImport.h:
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::traverseSubresources):

    Fix a bug where this would miss @import rules in @imported stylesheets.
    Include the CachedResource for the imported stylesheet itself.

    Tested by the test cases under LayoutTests/webarchive

(WebCore::StyleSheetContents::addSubresourceStyleURLs): Deleted.
* css/StyleSheetContents.h:
* dom/StyledElement.cpp:
(WebCore::StyledElement::addSubresourceAttributeURLs):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::addSubresourceAttributeURLs):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceSrcValuecpp">trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceSrcValueh">trunk/Source/WebCore/css/CSSFontFaceSrcValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValuecpp">trunk/Source/WebCore/css/CSSPrimitiveValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValueh">trunk/Source/WebCore/css/CSSPrimitiveValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSReflectValuecpp">trunk/Source/WebCore/css/CSSReflectValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSReflectValueh">trunk/Source/WebCore/css/CSSReflectValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSValuecpp">trunk/Source/WebCore/css/CSSValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueh">trunk/Source/WebCore/css/CSSValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueListcpp">trunk/Source/WebCore/css/CSSValueList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueListh">trunk/Source/WebCore/css/CSSValueList.h</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiescpp">trunk/Source/WebCore/css/StyleProperties.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStylePropertiesh">trunk/Source/WebCore/css/StyleProperties.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleImporth">trunk/Source/WebCore/css/StyleRuleImport.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentsh">trunk/Source/WebCore/css/StyleSheetContents.h</a></li>
<li><a href="#trunkSourceWebCoredomStyledElementcpp">trunk/Source/WebCore/dom/StyledElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLStyleElementcpp">trunk/Source/WebCore/html/HTMLStyleElement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/ChangeLog        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2016-09-29  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Remove addSubresourceStyleURLs functions
+        https://bugs.webkit.org/show_bug.cgi?id=162731
+
+        Reviewed by Ryosuke Niwa.
+
+        Use the generic std::function taking traverseSubresources instead. This prevents bugs caused by the code paths
+        not being in sync.
+
+        These functions are only used by the legacy webarchive code to gather URLs to locate CachedResources from the memory cache.
+        This can be improved further by returning the cached resources themselves instead of the URLs.
+
+        * css/CSSFontFaceSrcValue.cpp:
+        (WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): Deleted.
+        * css/CSSFontFaceSrcValue.h:
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): Deleted.
+        * css/CSSPrimitiveValue.h:
+        * css/CSSReflectValue.cpp:
+        (WebCore::CSSReflectValue::addSubresourceStyleURLs): Deleted.
+        * css/CSSReflectValue.h:
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::addSubresourceStyleURLs): Deleted.
+        * css/CSSValue.h:
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::addSubresourceStyleURLs): Deleted.
+        * css/CSSValueList.h:
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::addSubresourceStyleURLs): Deleted.
+        * css/StyleProperties.h:
+        * css/StyleRuleImport.h:
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::traverseSubresources):
+
+            Fix a bug where this would miss @import rules in @imported stylesheets.
+            Include the CachedResource for the imported stylesheet itself.
+
+            Tested by the test cases under LayoutTests/webarchive
+
+        (WebCore::StyleSheetContents::addSubresourceStyleURLs): Deleted.
+        * css/StyleSheetContents.h:
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::addSubresourceAttributeURLs):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::addSubresourceAttributeURLs):
+
</ins><span class="cx"> 2016-09-29  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win][Direct2D] Add D2D Font handling code
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSrcValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -85,12 +85,6 @@
</span><span class="cx">     return result.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSFontFaceSrcValue::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls, const StyleSheetContents* styleSheet) const
-{
-    if (!isLocal())
-        addSubresourceURL(urls, styleSheet-&gt;completeURL(m_resource));
-}
-
</del><span class="cx"> bool CSSFontFaceSrcValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</span><span class="cx"> {
</span><span class="cx">     if (!m_cachedFont)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSrcValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -65,8 +65,6 @@
</span><span class="cx"> 
</span><span class="cx">     String customCSSText() const;
</span><span class="cx"> 
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
-
</del><span class="cx">     bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</span><span class="cx"> 
</span><span class="cx">     CachedFont* cachedFont(Document*, bool isSVG, bool isInitiatingElementInUserAgentShadowTree);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -1264,12 +1264,6 @@
</span><span class="cx">     return text;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSPrimitiveValue::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls, const StyleSheetContents* styleSheet) const
-{
-    if (m_primitiveUnitType == CSS_URI)
-        addSubresourceURL(urls, styleSheet-&gt;completeURL(m_value.string));
-}
-
</del><span class="cx"> Ref&lt;CSSPrimitiveValue&gt; CSSPrimitiveValue::cloneForCSSOM() const
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;CSSPrimitiveValue&gt; result;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValue.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -381,8 +381,6 @@
</span><span class="cx">     // FIXME-NEWPARSER: Can ditch the boolean and just use the unit type once old parser is gone.
</span><span class="cx">     bool isQuirkValue() const { return m_isQuirkValue || primitiveType() == CSS_QUIRKY_EMS; }
</span><span class="cx"> 
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
-
</del><span class="cx">     Ref&lt;CSSPrimitiveValue&gt; cloneForCSSOM() const;
</span><span class="cx">     void setCSSOMSafe() { m_isCSSOMSafe = true; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSReflectValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSReflectValue.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSReflectValue.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSReflectValue.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -38,12 +38,6 @@
</span><span class="cx">     return m_direction-&gt;cssText() + ' ' + m_offset-&gt;cssText();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSReflectValue::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls, const StyleSheetContents* styleSheet) const
-{
-    if (m_mask)
-        m_mask-&gt;addSubresourceStyleURLs(urls, styleSheet);
-}
-
</del><span class="cx"> bool CSSReflectValue::equals(const CSSReflectValue&amp; other) const
</span><span class="cx"> {
</span><span class="cx">     return m_direction.ptr() == other.m_direction.ptr()
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSReflectValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSReflectValue.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSReflectValue.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSReflectValue.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -48,8 +48,6 @@
</span><span class="cx"> 
</span><span class="cx">     String customCSSText() const;
</span><span class="cx"> 
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
-
</del><span class="cx">     bool equals(const CSSReflectValue&amp;) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValue.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValue.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSValue.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -123,21 +123,6 @@
</span><span class="cx">     return CSS_CUSTOM;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSValue::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls, const StyleSheetContents* styleSheet) const
-{
-    // This should get called for internal instances only.
-    ASSERT(!isCSSOMSafe());
-
-    if (is&lt;CSSPrimitiveValue&gt;(*this))
-        downcast&lt;CSSPrimitiveValue&gt;(*this).addSubresourceStyleURLs(urls, styleSheet);
-    else if (is&lt;CSSValueList&gt;(*this))
-        downcast&lt;CSSValueList&gt;(*this).addSubresourceStyleURLs(urls, styleSheet);
-    else if (is&lt;CSSFontFaceSrcValue&gt;(*this))
-        downcast&lt;CSSFontFaceSrcValue&gt;(*this).addSubresourceStyleURLs(urls, styleSheet);
-    else if (is&lt;CSSReflectValue&gt;(*this))
-        downcast&lt;CSSReflectValue&gt;(*this).addSubresourceStyleURLs(urls, styleSheet);
-}
-
</del><span class="cx"> bool CSSValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</span><span class="cx"> {
</span><span class="cx">     // This should get called for internal instances only.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValue.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValue.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSValue.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -137,8 +137,6 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CSSValue&gt; cloneForCSSOM() const;
</span><span class="cx"> 
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
-
</del><span class="cx">     bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</span><span class="cx"> 
</span><span class="cx">     bool equals(const CSSValue&amp;) const;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueList.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueList.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSValueList.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -155,12 +155,6 @@
</span><span class="cx">     return m_values[0].get().equals(other);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CSSValueList::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls, const StyleSheetContents* styleSheet) const
-{
-    for (unsigned i = 0, size = m_values.size(); i &lt; size; ++i)
-        m_values[i].get().addSubresourceStyleURLs(urls, styleSheet);
-}
-
</del><span class="cx"> bool CSSValueList::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</span><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0; i &lt; m_values.size(); ++i) {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueList.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueList.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/CSSValueList.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -72,8 +72,6 @@
</span><span class="cx">     bool equals(const CSSValueList&amp;) const;
</span><span class="cx">     bool equals(const CSSValue&amp;) const;
</span><span class="cx"> 
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
-
</del><span class="cx">     bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</span><span class="cx">     
</span><span class="cx">     Ref&lt;CSSValueList&gt; cloneForCSSOM() const;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -1113,13 +1113,6 @@
</span><span class="cx">         addParsedProperty(other.propertyAt(i).toCSSProperty());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StyleProperties::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls, StyleSheetContents* contextStyleSheet) const
-{
-    unsigned size = propertyCount();
-    for (unsigned i = 0; i &lt; size; ++i)
-        propertyAt(i).value()-&gt;addSubresourceStyleURLs(urls, contextStyleSheet);
-}
-
</del><span class="cx"> bool StyleProperties::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</span><span class="cx"> {
</span><span class="cx">     unsigned size = propertyCount();
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/StyleProperties.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -96,8 +96,6 @@
</span><span class="cx"> 
</span><span class="cx">     CSSParserMode cssParserMode() const { return static_cast&lt;CSSParserMode&gt;(m_cssParserMode); }
</span><span class="cx"> 
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, StyleSheetContents* contextStyleSheet) const;
-
</del><span class="cx">     WEBCORE_EXPORT Ref&lt;MutableStyleProperties&gt; mutableCopy() const;
</span><span class="cx">     Ref&lt;ImmutableStyleProperties&gt; immutableCopyIfNeeded() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleImporth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleImport.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleImport.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/StyleRuleImport.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">     MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
</span><span class="cx"> 
</span><span class="cx">     void requestStyleSheet();
</span><ins>+    const CachedCSSStyleSheet* cachedCSSStyleSheet() const { return m_cachedSheet.get(); }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     // NOTE: We put the CachedStyleSheetClient in a member instead of inheriting from it
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -410,29 +410,6 @@
</span><span class="cx">     return CSSParser::completeURL(m_parserContext, url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StyleSheetContents::addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp; urls)
-{
-    Deque&lt;StyleSheetContents*&gt; styleSheetQueue;
-    styleSheetQueue.append(this);
-
-    while (!styleSheetQueue.isEmpty()) {
-        StyleSheetContents* styleSheet = styleSheetQueue.takeFirst();
-        
-        for (auto&amp; importRule : styleSheet-&gt;m_importRules) {
-            if (importRule-&gt;styleSheet()) {
-                styleSheetQueue.append(importRule-&gt;styleSheet());
-                addSubresourceURL(urls, importRule-&gt;styleSheet()-&gt;baseURL());
-            }
-        }
-        for (auto&amp; rule : styleSheet-&gt;m_childRules) {
-            if (is&lt;StyleRule&gt;(*rule))
-                downcast&lt;StyleRule&gt;(*rule).properties().addSubresourceStyleURLs(urls, this);
-            else if (is&lt;StyleRuleFontFace&gt;(*rule))
-                downcast&lt;StyleRuleFontFace&gt;(*rule).properties().addSubresourceStyleURLs(urls, this);
-        }
-    }
-}
-
</del><span class="cx"> static bool traverseSubresourcesInRules(const Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; rules, const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler)
</span><span class="cx"> {
</span><span class="cx">     for (auto&amp; rule : rules) {
</span><span class="lines">@@ -477,9 +454,12 @@
</span><span class="cx"> bool StyleSheetContents::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</span><span class="cx"> {
</span><span class="cx">     for (auto&amp; importRule : m_importRules) {
</span><del>-        if (!importRule-&gt;styleSheet())
-            continue;
-        if (traverseSubresourcesInRules(importRule-&gt;styleSheet()-&gt;m_childRules, handler))
</del><ins>+        if (auto* cachedResource = importRule-&gt;cachedCSSStyleSheet()) {
+            if (handler(*cachedResource))
+                return true;
+        }
+        auto* importedStyleSheet = importRule-&gt;styleSheet();
+        if (importedStyleSheet &amp;&amp; importedStyleSheet-&gt;traverseSubresources(handler))
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return traverseSubresourcesInRules(m_childRules, handler);
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.h (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.h        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/css/StyleSheetContents.h        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -86,7 +86,6 @@
</span><span class="cx">     bool loadCompleted() const { return m_loadCompleted; }
</span><span class="cx"> 
</span><span class="cx">     URL completeURL(const String&amp; url) const;
</span><del>-    void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;);
</del><span class="cx">     bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</span><span class="cx"> 
</span><span class="cx">     void setIsUserStyleSheet(bool b) { m_isUserStyleSheet = b; }
</span></span></pre></div>
<a id="trunkSourceWebCoredomStyledElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/StyledElement.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/StyledElement.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/dom/StyledElement.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #include &quot;CSSParser.h&quot;
</span><span class="cx"> #include &quot;CSSStyleSheet.h&quot;
</span><span class="cx"> #include &quot;CSSValuePool.h&quot;
</span><ins>+#include &quot;CachedResource.h&quot;
</ins><span class="cx"> #include &quot;ContentSecurityPolicy.h&quot;
</span><span class="cx"> #include &quot;DOMTokenList.h&quot;
</span><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="lines">@@ -266,8 +267,13 @@
</span><span class="cx"> 
</span><span class="cx"> void StyledElement::addSubresourceAttributeURLs(ListHashSet&lt;URL&gt;&amp; urls) const
</span><span class="cx"> {
</span><del>-    if (const StyleProperties* inlineStyle = elementData() ? elementData()-&gt;inlineStyle() : nullptr)
-        inlineStyle-&gt;addSubresourceStyleURLs(urls, &amp;document().elementSheet().contents());
</del><ins>+    auto* inlineStyle = this-&gt;inlineStyle();
+    if (!inlineStyle)
+        return;
+    inlineStyle-&gt;traverseSubresources([&amp;] (auto&amp; resource) {
+        urls.add(resource.url());
+        return false;
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline bool attributeNameSort(const std::pair&lt;AtomicStringImpl*, AtomicString&gt;&amp; p1, const std::pair&lt;AtomicStringImpl*, AtomicString&gt;&amp; p2)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -530,10 +530,13 @@
</span><span class="cx">     
</span><span class="cx">     // Append the URL of this link element.
</span><span class="cx">     addSubresourceURL(urls, href());
</span><del>-    
-    // Walk the URLs linked by the linked-to stylesheet.
-    if (CSSStyleSheet* styleSheet = const_cast&lt;HTMLLinkElement*&gt;(this)-&gt;sheet())
-        styleSheet-&gt;contents().addSubresourceStyleURLs(urls);
</del><ins>+
+    if (auto* styleSheet = this-&gt;sheet()) {
+        styleSheet-&gt;contents().traverseSubresources([&amp;] (auto&amp; resource) {
+            urls.add(resource.url());
+            return false;
+        });
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLLinkElement::addPendingSheet(PendingSheetType type)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLStyleElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLStyleElement.cpp (206602 => 206603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLStyleElement.cpp        2016-09-29 19:22:56 UTC (rev 206602)
+++ trunk/Source/WebCore/html/HTMLStyleElement.cpp        2016-09-29 19:36:39 UTC (rev 206603)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include &quot;HTMLStyleElement.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AuthorStyleSheets.h&quot;
</span><ins>+#include &quot;CachedResource.h&quot;
</ins><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Event.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="lines">@@ -142,8 +143,12 @@
</span><span class="cx"> {    
</span><span class="cx">     HTMLElement::addSubresourceAttributeURLs(urls);
</span><span class="cx"> 
</span><del>-    if (CSSStyleSheet* styleSheet = const_cast&lt;HTMLStyleElement*&gt;(this)-&gt;sheet())
-        styleSheet-&gt;contents().addSubresourceStyleURLs(urls);
</del><ins>+    if (auto* styleSheet = this-&gt;sheet()) {
+        styleSheet-&gt;contents().traverseSubresources([&amp;] (auto&amp; resource) {
+            urls.add(resource.url());
+            return false;
+        });
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLStyleElement::disabled() const
</span></span></pre>
</div>
</div>

</body>
</html>