<!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>[184315] 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/184315">184315</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2015-05-13 16:09:13 -0700 (Wed, 13 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cached CSS image resources don't show up after reloading &lt;http://nightly.webkit.org/start/&gt;
https://bugs.webkit.org/show_bug.cgi?id=144952
Source/WebCore:

rdar://problem/13387307

Reviewed by Oliver Hunt.

This is a symptom of a general problem that we don't revalidate subresources of cached parsed stylesheets.

Fix by tightening the check we perform when choosing to used the cached sheet. If there are expired subresources
we reparse the sheet.

Test: http/tests/cache/stylesheet-sharing.html

* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::traverseSubresources):
(WebCore::CSSCrossfadeValue::hasFailedOrCanceledSubresources): Deleted.

    Replace hasFailedOrCanceledSubresources with general purpose subresource traversal functions.

* css/CSSCrossfadeValue.h:
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::traverseSubresources):
(WebCore::CSSFilterImageValue::hasFailedOrCanceledSubresources): Deleted.
* css/CSSFilterImageValue.h:
* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::traverseSubresources):
(WebCore::CSSFontFaceSrcValue::hasFailedOrCanceledSubresources): Deleted.
* css/CSSFontFaceSrcValue.h:
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::traverseSubresources):
(WebCore::CSSImageSetValue::hasFailedOrCanceledSubresources): Deleted.
* css/CSSImageSetValue.h:
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::traverseSubresources):
(WebCore::CSSImageValue::hasFailedOrCanceledSubresources): Deleted.
* css/CSSImageValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::traverseSubresources):
(WebCore::CSSValue::hasFailedOrCanceledSubresources): Deleted.
* css/CSSValue.h:
* css/CSSValueList.cpp:
(WebCore::CSSValueList::traverseSubresources):
(WebCore::CSSValueList::hasFailedOrCanceledSubresources): Deleted.
* css/CSSValueList.h:
* css/StyleProperties.cpp:
(WebCore::StyleProperties::traverseSubresources):
(WebCore::StyleProperties::hasFailedOrCanceledSubresources): Deleted.
* css/StyleProperties.h:
* css/StyleSheetContents.cpp:
(WebCore::traverseSubresourcesInRules):
(WebCore::StyleSheetContents::traverseSubresources):
(WebCore::StyleSheetContents::subresourcesAllowReuse):

    Disallow reuse if there are expired subresources.

(WebCore::StyleSheetContents::isLoadingSubresources):

    Testing support.

(WebCore::childRulesHaveFailedOrCanceledSubresources): Deleted.
(WebCore::StyleSheetContents::hasFailedOrCanceledSubresources): Deleted.
* css/StyleSheetContents.h:
(WebCore::StyleSheetContents::loadCompleted):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::setCSSStyleSheet):
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
* loader/cache/CachedCSSStyleSheet.h:
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::makeRevalidationDecision):
(WebCore::CachedImage::mustRevalidateDueToCacheHeaders): Deleted.

    Move the logging code out from this function (it requires frame access this function doesn't otherwise need)
    and refactor to return a decision enum.

* loader/cache/CachedImage.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::makeRevalidationDecision):
(WebCore::logResourceRevalidationReason): Deleted.
(WebCore::CachedResource::mustRevalidateDueToCacheHeaders): Deleted.
* loader/cache/CachedResource.h:
(WebCore::CachedResource::loadFailedOrCanceled):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::logRevalidation):
(WebCore::logResourceRevalidationDecision):
(WebCore::CachedResourceLoader::determineRevalidationPolicy):

    Move logging here.

* testing/Internals.cpp:
(WebCore::Internals::isSharingStyleSheetContents):
(WebCore::Internals::isStyleSheetLoadingSubresources):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Reviewed by Oliver Hunt.

* http/tests/cache/resources/non-shareable.css: Added.
(#foo):
(#bar):
(#test1):
(#test2):
* http/tests/cache/resources/shareable.css: Added.
(#foo):
(#bar):
(#test1):
(#test2):
* http/tests/cache/resources/stylesheet-html.php: Added.
* http/tests/cache/stylesheet-sharing-expected.txt: Added.
* http/tests/cache/stylesheet-sharing.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSCrossfadeValuecpp">trunk/Source/WebCore/css/CSSCrossfadeValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSCrossfadeValueh">trunk/Source/WebCore/css/CSSCrossfadeValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSFilterImageValuecpp">trunk/Source/WebCore/css/CSSFilterImageValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFilterImageValueh">trunk/Source/WebCore/css/CSSFilterImageValue.h</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="#trunkSourceWebCorecssCSSImageSetValuecpp">trunk/Source/WebCore/css/CSSImageSetValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSImageSetValueh">trunk/Source/WebCore/css/CSSImageSetValue.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSImageValuecpp">trunk/Source/WebCore/css/CSSImageValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSImageValueh">trunk/Source/WebCore/css/CSSImageValue.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="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentsh">trunk/Source/WebCore/css/StyleSheetContents.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedCSSStyleSheetcpp">trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedCSSStyleSheeth">trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedImagecpp">trunk/Source/WebCore/loader/cache/CachedImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedImageh">trunk/Source/WebCore/loader/cache/CachedImage.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceh">trunk/Source/WebCore/loader/cache/CachedResource.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceLoadercpp">trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestscacheresourcesnonshareablecss">trunk/LayoutTests/http/tests/cache/resources/non-shareable.css</a></li>
<li><a href="#trunkLayoutTestshttptestscacheresourcesshareablecss">trunk/LayoutTests/http/tests/cache/resources/shareable.css</a></li>
<li><a href="#trunkLayoutTestshttptestscacheresourcesstylesheethtmlphp">trunk/LayoutTests/http/tests/cache/resources/stylesheet-html.php</a></li>
<li><a href="#trunkLayoutTestshttptestscachestylesheetsharingexpectedtxt">trunk/LayoutTests/http/tests/cache/stylesheet-sharing-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestscachestylesheetsharinghtml">trunk/LayoutTests/http/tests/cache/stylesheet-sharing.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/LayoutTests/ChangeLog        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-05-13  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Cached CSS image resources don't show up after reloading &lt;http://nightly.webkit.org/start/&gt;
+        https://bugs.webkit.org/show_bug.cgi?id=144952
+
+        Reviewed by Oliver Hunt.
+
+        * http/tests/cache/resources/non-shareable.css: Added.
+        (#foo):
+        (#bar):
+        (#test1):
+        (#test2):
+        * http/tests/cache/resources/shareable.css: Added.
+        (#foo):
+        (#bar):
+        (#test1):
+        (#test2):
+        * http/tests/cache/resources/stylesheet-html.php: Added.
+        * http/tests/cache/stylesheet-sharing-expected.txt: Added.
+        * http/tests/cache/stylesheet-sharing.html: Added.
+
</ins><span class="cx"> 2015-05-13  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r183770): Crash inside WebEditorClient::shouldApplyStyle when applying underline
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscacheresourcesnonshareablecss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/resources/non-shareable.css (0 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/resources/non-shareable.css                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/non-shareable.css        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+#foo { color: red }
+#bar { color: blue }
+#test1 { background-image:url(/resources/square100.png) }
+#test2 { background-image:url(../disk-cache/resources/generate-response.cgi?Content-Type=image/png&amp;Cache-Control=max-age=0) }
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscacheresourcesshareablecss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/resources/shareable.css (0 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/resources/shareable.css                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/shareable.css        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+#foo { color: red }
+#bar { color: blue }
+#test1 { background-image:url(/resources/square100.png) }
+#test2 { background-image:url(../disk-cache/resources/generate-response.cgi?Content-Type=image/png&amp;Cache-Control=max-age=100) }
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscacheresourcesstylesheethtmlphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/resources/stylesheet-html.php (0 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/resources/stylesheet-html.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/stylesheet-html.php        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+&lt;?php
+echo &quot;&lt;link rel=stylesheet href=&quot; . $_GET['sheet'] . &quot;&gt;&quot;;
+?&gt;
+&lt;div id=test1&gt;&lt;/div&gt;
+&lt;div id=test2&gt;&lt;/div&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachestylesheetsharingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/stylesheet-sharing-expected.txt (0 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/stylesheet-sharing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/stylesheet-sharing-expected.txt        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+shareable.css
+PASS styleSheetContentsShared is true
+non-shareable.css
+PASS styleSheetContentsShared is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachestylesheetsharinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/stylesheet-sharing.html (0 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/stylesheet-sharing.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/stylesheet-sharing.html        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;script src=&quot;../../js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;script&gt;
+jsTestIsAsync = true;
+
+function waitForStylesheet(iframe, completionHandler)
+{
+    var link = iframe.contentDocument.getElementsByTagName('link')[0];
+    if (internals.isStyleSheetLoadingSubresources(link)) {
+        setTimeout(function () { waitForStylesheet(iframe, completionHandler) }, 10);
+        return;
+    }
+    completionHandler(link);
+}
+
+function load(src, completionHandler)
+{
+    var iframe = document.createElement(&quot;iframe&quot;);
+    iframe.src = &quot;resources/stylesheet-html.php?sheet=&quot; + src;
+    iframe.onload = function () {
+        iframe.contentDocument.body.offsetWidth;
+        waitForStylesheet(iframe, completionHandler);
+    };
+    document.body.appendChild(iframe);
+}
+
+function testSharing(src, expected, completionHandler)
+{
+    load(src, function (linkA) {
+        load(src, function (linkB) {
+            styleSheetContentsShared = internals.isSharingStyleSheetContents(linkA, linkB);
+            debug(src);
+            if (expected)
+                shouldBeTrue(&quot;styleSheetContentsShared&quot;);
+            else
+                shouldBeFalse(&quot;styleSheetContentsShared&quot;);
+            completionHandler();
+        });
+    });
+}
+
+testSharing(&quot;shareable.css&quot;, true, function () {
+    testSharing(&quot;non-shareable.css&quot;, false, function () {
+        finishJSTest();
+    });
+});
+
+&lt;/script&gt;
+
+&lt;script src=&quot;../../js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/ChangeLog        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -1,3 +1,100 @@
</span><ins>+2015-05-13  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Cached CSS image resources don't show up after reloading &lt;http://nightly.webkit.org/start/&gt;
+        https://bugs.webkit.org/show_bug.cgi?id=144952
+        rdar://problem/13387307
+
+        Reviewed by Oliver Hunt.
+
+        This is a symptom of a general problem that we don't revalidate subresources of cached parsed stylesheets.
+
+        Fix by tightening the check we perform when choosing to used the cached sheet. If there are expired subresources
+        we reparse the sheet.
+
+        Test: http/tests/cache/stylesheet-sharing.html
+
+        * css/CSSCrossfadeValue.cpp:
+        (WebCore::CSSCrossfadeValue::traverseSubresources):
+        (WebCore::CSSCrossfadeValue::hasFailedOrCanceledSubresources): Deleted.
+
+            Replace hasFailedOrCanceledSubresources with general purpose subresource traversal functions.
+
+        * css/CSSCrossfadeValue.h:
+        * css/CSSFilterImageValue.cpp:
+        (WebCore::CSSFilterImageValue::traverseSubresources):
+        (WebCore::CSSFilterImageValue::hasFailedOrCanceledSubresources): Deleted.
+        * css/CSSFilterImageValue.h:
+        * css/CSSFontFaceSrcValue.cpp:
+        (WebCore::CSSFontFaceSrcValue::traverseSubresources):
+        (WebCore::CSSFontFaceSrcValue::hasFailedOrCanceledSubresources): Deleted.
+        * css/CSSFontFaceSrcValue.h:
+        * css/CSSImageSetValue.cpp:
+        (WebCore::CSSImageSetValue::traverseSubresources):
+        (WebCore::CSSImageSetValue::hasFailedOrCanceledSubresources): Deleted.
+        * css/CSSImageSetValue.h:
+        * css/CSSImageValue.cpp:
+        (WebCore::CSSImageValue::traverseSubresources):
+        (WebCore::CSSImageValue::hasFailedOrCanceledSubresources): Deleted.
+        * css/CSSImageValue.h:
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::traverseSubresources):
+        (WebCore::CSSValue::hasFailedOrCanceledSubresources): Deleted.
+        * css/CSSValue.h:
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::traverseSubresources):
+        (WebCore::CSSValueList::hasFailedOrCanceledSubresources): Deleted.
+        * css/CSSValueList.h:
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::traverseSubresources):
+        (WebCore::StyleProperties::hasFailedOrCanceledSubresources): Deleted.
+        * css/StyleProperties.h:
+        * css/StyleSheetContents.cpp:
+        (WebCore::traverseSubresourcesInRules):
+        (WebCore::StyleSheetContents::traverseSubresources):
+        (WebCore::StyleSheetContents::subresourcesAllowReuse):
+
+            Disallow reuse if there are expired subresources.
+
+        (WebCore::StyleSheetContents::isLoadingSubresources):
+
+            Testing support.
+
+        (WebCore::childRulesHaveFailedOrCanceledSubresources): Deleted.
+        (WebCore::StyleSheetContents::hasFailedOrCanceledSubresources): Deleted.
+        * css/StyleSheetContents.h:
+        (WebCore::StyleSheetContents::loadCompleted):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::setCSSStyleSheet):
+        * loader/cache/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
+        * loader/cache/CachedCSSStyleSheet.h:
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::makeRevalidationDecision):
+        (WebCore::CachedImage::mustRevalidateDueToCacheHeaders): Deleted.
+
+            Move the logging code out from this function (it requires frame access this function doesn't otherwise need)
+            and refactor to return a decision enum.
+
+        * loader/cache/CachedImage.h:
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::makeRevalidationDecision):
+        (WebCore::logResourceRevalidationReason): Deleted.
+        (WebCore::CachedResource::mustRevalidateDueToCacheHeaders): Deleted.
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::loadFailedOrCanceled):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::logRevalidation):
+        (WebCore::logResourceRevalidationDecision):
+        (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+
+            Move logging here.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::isSharingStyleSheetContents):
+        (WebCore::Internals::isStyleSheetLoadingSubresources):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
</ins><span class="cx"> 2015-05-13  Ryuan Choi  &lt;ryuan.choi@navercorp.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CoordinatedGraphics] Remove scaleFactor from SurfaceUpdateInfo
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSCrossfadeValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSCrossfadeValue.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSCrossfadeValue.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSCrossfadeValue.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -174,11 +174,11 @@
</span><span class="cx">         m_ownerValue-&gt;crossfadeChanged(*rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSCrossfadeValue::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSCrossfadeValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><del>-    if (m_cachedFromImage &amp;&amp; m_cachedFromImage-&gt;loadFailedOrCanceled())
</del><ins>+    if (m_cachedFromImage &amp;&amp; handler(*m_cachedFromImage))
</ins><span class="cx">         return true;
</span><del>-    if (m_cachedToImage &amp;&amp; m_cachedToImage-&gt;loadFailedOrCanceled())
</del><ins>+    if (m_cachedToImage &amp;&amp; handler(*m_cachedToImage))
</ins><span class="cx">         return true;
</span><span class="cx">     return false;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSCrossfadeValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSCrossfadeValue.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSCrossfadeValue.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSCrossfadeValue.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setPercentage(PassRefPtr&lt;CSSPrimitiveValue&gt; percentageValue) { m_percentageValue = percentageValue; }
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;CSSCrossfadeValue&gt; blend(const CSSCrossfadeValue&amp;, double) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFilterImageValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -149,11 +149,11 @@
</span><span class="cx">         m_ownerValue-&gt;filterImageChanged(*rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSFilterImageValue::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSFilterImageValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><del>-    if (m_cachedImage &amp;&amp; m_cachedImage-&gt;loadFailedOrCanceled())
-        return true;
-    return false;
</del><ins>+    if (!m_cachedImage)
+        return false;
+    return handler(*m_cachedImage);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CSSFilterImageValue::equals(const CSSFilterImageValue&amp; other) const
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFilterImageValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFilterImageValue.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFilterImageValue.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">     void loadSubimages(CachedResourceLoader&amp;);
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     bool equals(const CSSFilterImageValue&amp;) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSrcValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -91,11 +91,11 @@
</span><span class="cx">         addSubresourceURL(urls, styleSheet-&gt;completeURL(m_resource));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSFontFaceSrcValue::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSFontFaceSrcValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_cachedFont)
</span><span class="cx">         return false;
</span><del>-    return m_cachedFont-&gt;loadFailedOrCanceled();
</del><ins>+    return handler(*m_cachedFont);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document, bool isSVG)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceSrcValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceSrcValue.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceSrcValue.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSFontFaceSrcValue.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> 
</span><span class="cx">     void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     CachedFont* cachedFont(Document*, bool isSVG);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImageSetValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImageSetValue.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImageSetValue.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSImageSetValue.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -184,14 +184,13 @@
</span><span class="cx">     return result.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSImageSetValue::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSImageSetValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><span class="cx">     if (!is&lt;StyleCachedImageSet&gt;(m_imageSet.get()))
</span><span class="cx">         return false;
</span><span class="cx">     CachedImage* cachedResource = downcast&lt;StyleCachedImageSet&gt;(*m_imageSet).cachedImage();
</span><del>-    if (!cachedResource)
-        return true;
-    return cachedResource-&gt;loadFailedOrCanceled();
</del><ins>+    ASSERT(cachedResource);
+    return handler(*cachedResource);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CSSImageSetValue::CSSImageSetValue(const CSSImageSetValue&amp; cloneFrom)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImageSetValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImageSetValue.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImageSetValue.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSImageSetValue.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">         float scaleFactor;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;CSSImageSetValue&gt; cloneForCSSOM() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImageValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImageValue.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImageValue.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSImageValue.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -99,14 +99,13 @@
</span><span class="cx">     return cachedImage(loader, CachedResourceLoader::defaultCachedResourceOptions());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSImageValue::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSImageValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><span class="cx">     if (!is&lt;StyleCachedImage&gt;(m_image.get()))
</span><span class="cx">         return false;
</span><span class="cx">     CachedResource* cachedResource = downcast&lt;StyleCachedImage&gt;(*m_image).cachedImage();
</span><del>-    if (!cachedResource)
-        return true;
-    return cachedResource-&gt;loadFailedOrCanceled();
</del><ins>+    ASSERT(cachedResource);
+    return handler(*cachedResource);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CSSImageValue::equals(const CSSImageValue&amp; other) const
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImageValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImageValue.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImageValue.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSImageValue.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;CSSValue&gt; cloneForCSSOM() const;
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     bool equals(const CSSImageValue&amp;) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValue.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValue.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSValue.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -125,24 +125,24 @@
</span><span class="cx">         downcast&lt;CSSReflectValue&gt;(*this).addSubresourceStyleURLs(urls, styleSheet);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSValue::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSValue::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><span class="cx">     // This should get called for internal instances only.
</span><span class="cx">     ASSERT(!isCSSOMSafe());
</span><span class="cx"> 
</span><span class="cx">     if (is&lt;CSSValueList&gt;(*this))
</span><del>-        return downcast&lt;CSSValueList&gt;(*this).hasFailedOrCanceledSubresources();
</del><ins>+        return downcast&lt;CSSValueList&gt;(*this).traverseSubresources(handler);
</ins><span class="cx">     if (is&lt;CSSFontFaceSrcValue&gt;(*this))
</span><del>-        return downcast&lt;CSSFontFaceSrcValue&gt;(*this).hasFailedOrCanceledSubresources();
</del><ins>+        return downcast&lt;CSSFontFaceSrcValue&gt;(*this).traverseSubresources(handler);
</ins><span class="cx">     if (is&lt;CSSImageValue&gt;(*this))
</span><del>-        return downcast&lt;CSSImageValue&gt;(*this).hasFailedOrCanceledSubresources();
</del><ins>+        return downcast&lt;CSSImageValue&gt;(*this).traverseSubresources(handler);
</ins><span class="cx">     if (is&lt;CSSCrossfadeValue&gt;(*this))
</span><del>-        return downcast&lt;CSSCrossfadeValue&gt;(*this).hasFailedOrCanceledSubresources();
</del><ins>+        return downcast&lt;CSSCrossfadeValue&gt;(*this).traverseSubresources(handler);
</ins><span class="cx">     if (is&lt;CSSFilterImageValue&gt;(*this))
</span><del>-        return downcast&lt;CSSFilterImageValue&gt;(*this).hasFailedOrCanceledSubresources();
</del><ins>+        return downcast&lt;CSSFilterImageValue&gt;(*this).traverseSubresources(handler);
</ins><span class="cx"> #if ENABLE(CSS_IMAGE_SET)
</span><span class="cx">     if (is&lt;CSSImageSetValue&gt;(*this))
</span><del>-        return downcast&lt;CSSImageSetValue&gt;(*this).hasFailedOrCanceledSubresources();
</del><ins>+        return downcast&lt;CSSImageSetValue&gt;(*this).traverseSubresources(handler);
</ins><span class="cx"> #endif
</span><span class="cx">     return false;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValue.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValue.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSValue.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class CachedResource;
</ins><span class="cx"> class StyleSheetContents;
</span><span class="cx">     
</span><span class="cx"> // FIXME: The current CSSValue and subclasses should be turned into internal types (StyleValue).
</span><span class="lines">@@ -122,7 +123,7 @@
</span><span class="cx"> 
</span><span class="cx">     void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     bool equals(const CSSValue&amp;) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueList.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueList.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSValueList.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -151,10 +151,10 @@
</span><span class="cx">         m_values[i].get().addSubresourceStyleURLs(urls, styleSheet);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CSSValueList::hasFailedOrCanceledSubresources() const
</del><ins>+bool CSSValueList::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0; i &lt; m_values.size(); ++i) {
</span><del>-        if (m_values[i].get().hasFailedOrCanceledSubresources())
</del><ins>+        if (m_values[i].get().traverseSubresources(handler))
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueList.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueList.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/CSSValueList.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">     void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;, const StyleSheetContents*) const;
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx">     
</span><span class="cx">     PassRefPtr&lt;CSSValueList&gt; cloneForCSSOM() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/StyleProperties.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -1074,11 +1074,11 @@
</span><span class="cx">         propertyAt(i).value()-&gt;addSubresourceStyleURLs(urls, contextStyleSheet);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool StyleProperties::hasFailedOrCanceledSubresources() const
</del><ins>+bool StyleProperties::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><span class="cx">     unsigned size = propertyCount();
</span><span class="cx">     for (unsigned i = 0; i &lt; size; ++i) {
</span><del>-        if (propertyAt(i).value()-&gt;hasFailedOrCanceledSubresources())
</del><ins>+        if (propertyAt(i).value()-&gt;traverseSubresources(handler))
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStylePropertiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleProperties.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleProperties.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/StyleProperties.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class CSSStyleDeclaration;
</span><ins>+class CachedResource;
</ins><span class="cx"> class ImmutableStyleProperties;
</span><span class="cx"> class URL;
</span><span class="cx"> class MutableStyleProperties;
</span><span class="lines">@@ -107,7 +108,7 @@
</span><span class="cx">     bool isMutable() const { return m_isMutable; }
</span><span class="cx">     bool hasCSSOMWrapper() const;
</span><span class="cx"> 
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     static unsigned averageSizeInBytes();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -423,24 +423,24 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool childRulesHaveFailedOrCanceledSubresources(const Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; rules)
</del><ins>+static bool traverseSubresourcesInRules(const Vector&lt;RefPtr&lt;StyleRuleBase&gt;&gt;&amp; rules, const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler)
</ins><span class="cx"> {
</span><span class="cx">     for (auto&amp; rule : rules) {
</span><span class="cx">         switch (rule-&gt;type()) {
</span><span class="cx">         case StyleRuleBase::Style:
</span><del>-            if (downcast&lt;StyleRule&gt;(*rule).properties().hasFailedOrCanceledSubresources())
</del><ins>+            if (downcast&lt;StyleRule&gt;(*rule).properties().traverseSubresources(handler))
</ins><span class="cx">                 return true;
</span><span class="cx">             break;
</span><span class="cx">         case StyleRuleBase::FontFace:
</span><del>-            if (downcast&lt;StyleRuleFontFace&gt;(*rule).properties().hasFailedOrCanceledSubresources())
</del><ins>+            if (downcast&lt;StyleRuleFontFace&gt;(*rule).properties().traverseSubresources(handler))
</ins><span class="cx">                 return true;
</span><span class="cx">             break;
</span><span class="cx">         case StyleRuleBase::Media:
</span><del>-            if (childRulesHaveFailedOrCanceledSubresources(downcast&lt;StyleRuleMedia&gt;(*rule).childRules()))
</del><ins>+            if (traverseSubresourcesInRules(downcast&lt;StyleRuleMedia&gt;(*rule).childRules(), handler))
</ins><span class="cx">                 return true;
</span><span class="cx">             break;
</span><span class="cx">         case StyleRuleBase::Region:
</span><del>-            if (childRulesHaveFailedOrCanceledSubresources(downcast&lt;StyleRuleRegion&gt;(*rule).childRules()))
</del><ins>+            if (traverseSubresourcesInRules(downcast&lt;StyleRuleRegion&gt;(*rule).childRules(), handler))
</ins><span class="cx">                 return true;
</span><span class="cx">             break;
</span><span class="cx">         case StyleRuleBase::Import:
</span><span class="lines">@@ -463,12 +463,37 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool StyleSheetContents::hasFailedOrCanceledSubresources() const
</del><ins>+bool StyleSheetContents::traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const
</ins><span class="cx"> {
</span><del>-    ASSERT(isCacheable());
-    return childRulesHaveFailedOrCanceledSubresources(m_childRules);
</del><ins>+    for (auto&amp; importRule : m_importRules) {
+        if (!importRule-&gt;styleSheet())
+            continue;
+        if (traverseSubresourcesInRules(importRule-&gt;styleSheet()-&gt;m_childRules, handler))
+            return true;
+    }
+    return traverseSubresourcesInRules(m_childRules, handler);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool StyleSheetContents::subresourcesAllowReuse(CachePolicy cachePolicy) const
+{
+    bool hasFailedOrExpiredResources = traverseSubresources([cachePolicy](const CachedResource&amp; resource) {
+        if (resource.loadFailedOrCanceled())
+            return true;
+        // We can't revalidate subresources individually so don't use reuse the parsed sheet if they need revalidation.
+        if (resource.makeRevalidationDecision(cachePolicy) != CachedResource::RevalidationDecision::No)
+            return true;
+        return false;
+    });
+    return !hasFailedOrExpiredResources;
+}
+
+bool StyleSheetContents::isLoadingSubresources() const
+{
+    return traverseSubresources([](const CachedResource&amp; resource) {
+        return resource.isLoading();
+    });
+}
+
</ins><span class="cx"> StyleSheetContents* StyleSheetContents::parentStyleSheet() const
</span><span class="cx"> {
</span><span class="cx">     return m_ownerRule ? m_ownerRule-&gt;parentStyleSheet() : 0;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/css/StyleSheetContents.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #define StyleSheetContents_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CSSParserMode.h&quot;
</span><ins>+#include &quot;CachePolicy.h&quot;
</ins><span class="cx"> #include &quot;URL.h&quot;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/ListHashSet.h&gt;
</span><span class="lines">@@ -34,6 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> class CSSStyleSheet;
</span><span class="cx"> class CachedCSSStyleSheet;
</span><ins>+class CachedResource;
</ins><span class="cx"> class Document;
</span><span class="cx"> class Node;
</span><span class="cx"> class StyleRuleBase;
</span><span class="lines">@@ -67,6 +69,8 @@
</span><span class="cx">     bool isCacheable() const;
</span><span class="cx"> 
</span><span class="cx">     bool isLoading() const;
</span><ins>+    bool subresourcesAllowReuse(CachePolicy) const;
+    WEBCORE_EXPORT bool isLoadingSubresources() const;
</ins><span class="cx"> 
</span><span class="cx">     void checkLoaded();
</span><span class="cx">     void startLoadingDynamicSheet();
</span><span class="lines">@@ -78,10 +82,10 @@
</span><span class="cx">     const String&amp; charset() const { return m_parserContext.charset; }
</span><span class="cx"> 
</span><span class="cx">     bool loadCompleted() const { return m_loadCompleted; }
</span><del>-    bool hasFailedOrCanceledSubresources() const;
</del><span class="cx"> 
</span><span class="cx">     URL completeURL(const String&amp; url) const;
</span><span class="cx">     void addSubresourceStyleURLs(ListHashSet&lt;URL&gt;&amp;);
</span><ins>+    bool traverseSubresources(const std::function&lt;bool (const CachedResource&amp;)&gt;&amp; handler) const;
</ins><span class="cx"> 
</span><span class="cx">     void setIsUserStyleSheet(bool b) { m_isUserStyleSheet = b; }
</span><span class="cx">     bool isUserStyleSheet() const { return m_isUserStyleSheet; }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -321,8 +321,9 @@
</span><span class="cx">     Ref&lt;HTMLLinkElement&gt; protect(*this);
</span><span class="cx"> 
</span><span class="cx">     CSSParserContext parserContext(document(), baseURL, charset);
</span><ins>+    auto cachePolicy = document().frame()-&gt;loader().subresourceCachePolicy();
</ins><span class="cx"> 
</span><del>-    if (RefPtr&lt;StyleSheetContents&gt; restoredSheet = const_cast&lt;CachedCSSStyleSheet*&gt;(cachedStyleSheet)-&gt;restoreParsedStyleSheet(parserContext)) {
</del><ins>+    if (RefPtr&lt;StyleSheetContents&gt; restoredSheet = const_cast&lt;CachedCSSStyleSheet*&gt;(cachedStyleSheet)-&gt;restoreParsedStyleSheet(parserContext, cachePolicy)) {
</ins><span class="cx">         ASSERT(restoredSheet-&gt;isCacheable());
</span><span class="cx">         ASSERT(!restoredSheet-&gt;isLoading());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -143,11 +143,11 @@
</span><span class="cx">     setDecodedSize(0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;StyleSheetContents&gt; CachedCSSStyleSheet::restoreParsedStyleSheet(const CSSParserContext&amp; context)
</del><ins>+PassRefPtr&lt;StyleSheetContents&gt; CachedCSSStyleSheet::restoreParsedStyleSheet(const CSSParserContext&amp; context, CachePolicy cachePolicy)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_parsedStyleSheetCache)
</span><span class="cx">         return 0;
</span><del>-    if (m_parsedStyleSheetCache-&gt;hasFailedOrCanceledSubresources()) {
</del><ins>+    if (!m_parsedStyleSheetCache-&gt;subresourcesAllowReuse(cachePolicy)) {
</ins><span class="cx">         m_parsedStyleSheetCache-&gt;removedFromMemoryCache();
</span><span class="cx">         m_parsedStyleSheetCache.clear();
</span><span class="cx">         return 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedCSSStyleSheeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx">         const String sheetText(bool* hasValidMIMEType = nullptr) const;
</span><span class="cx"> 
</span><del>-        PassRefPtr&lt;StyleSheetContents&gt; restoreParsedStyleSheet(const CSSParserContext&amp;);
</del><ins>+        PassRefPtr&lt;StyleSheetContents&gt; restoreParsedStyleSheet(const CSSParserContext&amp;, CachePolicy);
</ins><span class="cx">         void saveParsedStyleSheet(Ref&lt;StyleSheetContents&gt;&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     private:
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedImage.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -515,7 +515,7 @@
</span><span class="cx">     return !securityOrigin-&gt;taintsCanvas(response().url());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CachedImage::mustRevalidateDueToCacheHeaders(const CachedResourceLoader&amp; cachedResourceLoader, CachePolicy policy) const
</del><ins>+CachedResource::RevalidationDecision CachedImage::makeRevalidationDecision(CachePolicy cachePolicy) const
</ins><span class="cx"> {
</span><span class="cx">     if (UNLIKELY(isManuallyCached())) {
</span><span class="cx">         // Do not revalidate manually cached images. This mechanism is used as a
</span><span class="lines">@@ -523,9 +523,9 @@
</span><span class="cx">         // the URL for that image may not represent a resource that can be
</span><span class="cx">         // retrieved by standard means. If the manual caching SPI is used, it is
</span><span class="cx">         // incumbent on the client to only use valid resources.
</span><del>-        return false;
</del><ins>+        return RevalidationDecision::No;
</ins><span class="cx">     }
</span><del>-    return CachedResource::mustRevalidateDueToCacheHeaders(cachedResourceLoader, policy);
</del><ins>+    return CachedResource::makeRevalidationDecision(cachePolicy);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedImage.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedImage.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedImage.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx">     void computeIntrinsicDimensions(Length&amp; intrinsicWidth, Length&amp; intrinsicHeight, FloatSize&amp; intrinsicRatio);
</span><span class="cx"> 
</span><span class="cx">     bool isManuallyCached() const { return m_isManuallyCached; }
</span><del>-    virtual bool mustRevalidateDueToCacheHeaders(const CachedResourceLoader&amp;, CachePolicy) const override;
</del><ins>+    RevalidationDecision makeRevalidationDecision(CachePolicy) const override;
</ins><span class="cx">     virtual void load(CachedResourceLoader&amp;, const ResourceLoaderOptions&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     bool isOriginClean(SecurityOrigin*);
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -680,39 +680,30 @@
</span><span class="cx">     return m_response.hasCacheValidatorFields();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void logResourceRevalidationReason(Frame* frame, const String&amp; reason)
-{
-    if (frame)
-        frame-&gt;mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), DiagnosticLoggingKeys::reasonKey(), reason, ShouldSample::Yes);
-}
-
-bool CachedResource::mustRevalidateDueToCacheHeaders(const CachedResourceLoader&amp; cachedResourceLoader, CachePolicy cachePolicy) const
</del><ins>+CachedResource::RevalidationDecision CachedResource::makeRevalidationDecision(CachePolicy cachePolicy) const
</ins><span class="cx"> {    
</span><del>-    ASSERT(cachePolicy == CachePolicyRevalidate || cachePolicy == CachePolicyVerify);
</del><ins>+    switch (cachePolicy) {
+    case CachePolicyHistoryBuffer:
+        return RevalidationDecision::No;
</ins><span class="cx"> 
</span><del>-    if (cachePolicy == CachePolicyRevalidate) {
-        logResourceRevalidationReason(cachedResourceLoader.frame(), DiagnosticLoggingKeys::reloadKey());
-        return true;
-    }
</del><ins>+    case CachePolicyReload:
+    case CachePolicyRevalidate:
+        return RevalidationDecision::YesDueToCachePolicy;
</ins><span class="cx"> 
</span><del>-    if (m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()) {
-        LOG(ResourceLoading, &quot;CachedResource %p mustRevalidate because of m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()\n&quot;, this);
</del><ins>+    case CachePolicyVerify:
+        if (m_response.cacheControlContainsNoCache())
+            return RevalidationDecision::YesDueToNoCache;
+        // FIXME: Cache-Control:no-store should prevent storing, not reuse.
</ins><span class="cx">         if (m_response.cacheControlContainsNoStore())
</span><del>-            logResourceRevalidationReason(cachedResourceLoader.frame(), DiagnosticLoggingKeys::noStoreKey());
-        else
-            logResourceRevalidationReason(cachedResourceLoader.frame(), DiagnosticLoggingKeys::noCacheKey());
</del><ins>+            return RevalidationDecision::YesDueToNoStore;
</ins><span class="cx"> 
</span><del>-        return true;
-    }
</del><ins>+        if (isExpired())
+            return RevalidationDecision::YesDueToExpired;
</ins><span class="cx"> 
</span><del>-    // CachePolicyVerify
-    if (isExpired()) {
-        LOG(ResourceLoading, &quot;CachedResource %p mustRevalidate because of isExpired()\n&quot;, this);
-        logResourceRevalidationReason(cachedResourceLoader.frame(), DiagnosticLoggingKeys::isExpiredKey());
-        return true;
-    }
-
-    return false;
</del><ins>+        return RevalidationDecision::No;
+    };
+    ASSERT_NOT_REACHED();
+    return RevalidationDecision::No;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CachedResource::redirectChainAllowsReuse(ReuseExpiredRedirectionOrNot reuseExpiredRedirection) const
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -211,7 +211,7 @@
</span><span class="cx">     void cancelLoad();
</span><span class="cx">     bool wasCanceled() const { return m_error.isCancellation(); }
</span><span class="cx">     bool errorOccurred() const { return m_status == LoadError || m_status == DecodeError; }
</span><del>-    bool loadFailedOrCanceled() { return !m_error.isNull(); }
</del><ins>+    bool loadFailedOrCanceled() const { return !m_error.isNull(); }
</ins><span class="cx"> 
</span><span class="cx">     bool shouldSendResourceLoadCallbacks() const { return m_options.sendLoadCallbacks() == SendCallbacks; }
</span><span class="cx">     DataBufferingPolicy dataBufferingPolicy() const { return m_options.dataBufferingPolicy(); }
</span><span class="lines">@@ -229,7 +229,8 @@
</span><span class="cx">     
</span><span class="cx">     bool canUseCacheValidator() const;
</span><span class="cx"> 
</span><del>-    virtual bool mustRevalidateDueToCacheHeaders(const CachedResourceLoader&amp;, CachePolicy) const;
</del><ins>+    enum class RevalidationDecision { No, YesDueToCachePolicy, YesDueToNoStore, YesDueToNoCache, YesDueToExpired };
+    virtual RevalidationDecision makeRevalidationDecision(CachePolicy) const;
</ins><span class="cx">     bool redirectChainAllowsReuse(ReuseExpiredRedirectionOrNot) const;
</span><span class="cx"> 
</span><span class="cx">     bool isCacheValidator() const { return m_resourceToRevalidate; }
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -646,6 +646,34 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(RESOURCE_TIMING)
</span><span class="cx"> 
</span><ins>+static void logRevalidation(const String&amp; reason, DiagnosticLoggingClient&amp; logClient)
+{
+    logClient.logDiagnosticMessageWithValue(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), DiagnosticLoggingKeys::reasonKey(), reason, ShouldSample::Yes);
+}
+
+static void logResourceRevalidationDecision(CachedResource::RevalidationDecision reason, const Frame* frame)
+{
+    if (!frame)
+        return;
+    auto&amp; logClient = frame-&gt;mainFrame().diagnosticLoggingClient();
+    switch (reason) {
+    case CachedResource::RevalidationDecision::No:
+        break;
+    case CachedResource::RevalidationDecision::YesDueToExpired:
+        logRevalidation(DiagnosticLoggingKeys::isExpiredKey(), logClient);
+        break;
+    case CachedResource::RevalidationDecision::YesDueToNoStore:
+        logRevalidation(DiagnosticLoggingKeys::noStoreKey(), logClient);
+        break;
+    case CachedResource::RevalidationDecision::YesDueToNoCache:
+        logRevalidation(DiagnosticLoggingKeys::noCacheKey(), logClient);
+        break;
+    case CachedResource::RevalidationDecision::YesDueToCachePolicy:
+        logRevalidation(DiagnosticLoggingKeys::reloadKey(), logClient);
+        break;
+    }
+}
+
</ins><span class="cx"> CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest&amp; request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const
</span><span class="cx"> {
</span><span class="cx">     if (!existingResource)
</span><span class="lines">@@ -738,8 +766,11 @@
</span><span class="cx">     if (existingResource-&gt;isLoading())
</span><span class="cx">         return Use;
</span><span class="cx"> 
</span><ins>+    auto revalidationDecision = existingResource-&gt;makeRevalidationDecision(cachePolicy(type));
+    logResourceRevalidationDecision(revalidationDecision, frame());
+
</ins><span class="cx">     // Check if the cache headers requires us to revalidate (cache expiration for example).
</span><del>-    if (existingResource-&gt;mustRevalidateDueToCacheHeaders(*this, cachePolicy(type))) {
</del><ins>+    if (revalidationDecision != CachedResource::RevalidationDecision::No) {
</ins><span class="cx">         // See if the resource has usable ETag or Last-modified headers.
</span><span class="cx">         if (existingResource-&gt;canUseCacheValidator())
</span><span class="cx">             return Revalidate;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> #include &quot;HTMLIFrameElement.h&quot;
</span><span class="cx"> #include &quot;HTMLImageElement.h&quot;
</span><span class="cx"> #include &quot;HTMLInputElement.h&quot;
</span><ins>+#include &quot;HTMLLinkElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLPlugInElement.h&quot;
</span><span class="cx"> #include &quot;HTMLPreloadScanner.h&quot;
</span><span class="lines">@@ -441,6 +442,25 @@
</span><span class="cx">     return &quot;Error&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool Internals::isSharingStyleSheetContents(Element* a, Element* b)
+{
+    if (!is&lt;HTMLLinkElement&gt;(a) || !is&lt;HTMLLinkElement&gt;(b))
+        return false;
+    auto&amp; aLink = downcast&lt;HTMLLinkElement&gt;(*a);
+    auto&amp; bLink = downcast&lt;HTMLLinkElement&gt;(*b);
+    if (!aLink.sheet() || !bLink.sheet())
+        return false;
+    return &amp;aLink.sheet()-&gt;contents() == &amp;bLink.sheet()-&gt;contents();
+}
+
+bool Internals::isStyleSheetLoadingSubresources(Element* link)
+{
+    if (!is&lt;HTMLLinkElement&gt;(link))
+        return false;
+    auto&amp; linkElement = downcast&lt;HTMLLinkElement&gt;(*link);
+    return linkElement.sheet() &amp;&amp; linkElement.sheet()-&gt;contents().isLoadingSubresources();
+}
+
</ins><span class="cx"> static ResourceRequestCachePolicy stringToResourceRequestCachePolicy(const String&amp; policy)
</span><span class="cx"> {
</span><span class="cx">     if (policy == &quot;UseProtocolCachePolicy&quot;)
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/testing/Internals.h        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -91,6 +91,8 @@
</span><span class="cx">     bool isPreloaded(const String&amp; url);
</span><span class="cx">     bool isLoadingFromMemoryCache(const String&amp; url);
</span><span class="cx">     String xhrResponseSource(XMLHttpRequest*);
</span><ins>+    bool isSharingStyleSheetContents(Element* linkA, Element* linkB);
+    bool isStyleSheetLoadingSubresources(Element* link);
</ins><span class="cx">     void setOverrideCachePolicy(const String&amp;);
</span><span class="cx">     void setOverrideResourceLoadPriority(const String&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (184314 => 184315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2015-05-13 22:27:37 UTC (rev 184314)
+++ trunk/Source/WebCore/testing/Internals.idl        2015-05-13 23:09:13 UTC (rev 184315)
</span><span class="lines">@@ -59,6 +59,8 @@
</span><span class="cx">     boolean isPreloaded(DOMString url);
</span><span class="cx">     boolean isLoadingFromMemoryCache(DOMString url);
</span><span class="cx">     DOMString xhrResponseSource(XMLHttpRequest xhr);
</span><ins>+    boolean isSharingStyleSheetContents(Element linkA, Element linkB);
+    boolean isStyleSheetLoadingSubresources(Element link);
</ins><span class="cx">     void clearMemoryCache();
</span><span class="cx">     void pruneMemoryCacheToSize(long size);
</span><span class="cx">     long memoryCacheSize();
</span></span></pre>
</div>
</div>

</body>
</html>