<!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>[195371] branches/safari-601.1.46-branch</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/195088">r195088</a>. rdar://problem/24101168</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsChangeLog">branches/safari-601.1.46-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreChangeLog">branches/safari-601.1.46-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecontentextensionsContentExtensionStyleSheetcpp">branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorecontentextensionsContentExtensionStyleSheeth">branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoredomDocumentStyleSheetCollectioncpp">branches/safari-601.1.46-branch/Source/WebCore/dom/DocumentStyleSheetCollection.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentextensionsfontdisplaynonerepeatedlayoutexpectedtxt">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout-expected.txt</a></li>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentextensionsfontdisplaynonerepeatedlayouthtml">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html</a></li>
<li><a href="#branchessafari601146branchLayoutTestshttptestscontentextensionsfontdisplaynonerepeatedlayouthtmljson">branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html.json</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (195370 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2016-01-20 20:59:53 UTC (rev 195370)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -1,5 +1,23 @@
</span><span class="cx"> 2016-01-20  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r195088. rdar://problem/24101168
+
+    2016-01-14  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+            Mixing Content Blocking of fonts and display:none rules causes battery drain
+            https://bugs.webkit.org/show_bug.cgi?id=153051
+            &lt;rdar://problem/23187709&gt;
+
+            Reviewed by Alex Christensen.
+
+            Make sure that layoutCount does not skyrocket.
+
+            * http/tests/contentextensions/font-display-none-repeated-layout-expected.txt: Added.
+            * http/tests/contentextensions/font-display-none-repeated-layout.html: Added.
+            * http/tests/contentextensions/font-display-none-repeated-layout.html.json: Added.
+
+2016-01-20  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r188377. rdar://problem/24208161
</span><span class="cx"> 
</span><span class="cx">     2015-08-12  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentextensionsfontdisplaynonerepeatedlayoutexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout-expected.txt (0 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout-expected.txt                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout-expected.txt        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+CONSOLE MESSAGE: line 13: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/font-display-none-repeated-layout.html from loading a resource from http://127.0.0.1:8000/resources/Ahem.woff
+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/font-display-none-repeated-layout.html from loading a resource from http://127.0.0.1:8000/resources/Ahem.woff
+Hello
+Make sure that a content-blocker rule which is triggered by a webfont and causes display:none on an element doesn't cause looping layouts.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS endLayoutCount - startLayoutCount &lt; 5 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentextensionsfontdisplaynonerepeatedlayouthtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html (0 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+@font-face {
+    font-family: &quot;WebFont&quot;;
+    src: url(&quot;../resources/Ahem.woff&quot;) format(&quot;woff&quot;);
+}
+#contents {
+    font-family: &quot;WebFont&quot;;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;hideme&quot;&gt;Hello&lt;/div&gt;
+&lt;div id=&quot;contents&quot;&gt;Hello&lt;/div&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Make sure that a content-blocker rule which is triggered by a webfont and causes display:none on an element doesn't cause looping layouts.&quot;);
+
+window.jsTestIsAsync = true;
+
+var startLayoutCount = -1;
+var endLayoutCount = -1;
+
+if (window.internals)
+    startLayoutCount = window.internals.layoutCount;
+
+window.setTimeout(function() {
+    if (window.internals) {
+        endLayoutCount = window.internals.layoutCount;
+    }
+    shouldBeTrue(&quot;endLayoutCount - startLayoutCount &lt; 5&quot;);
+    finishJSTest();
+}, 500);
+&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari601146branchLayoutTestshttptestscontentextensionsfontdisplaynonerepeatedlayouthtmljson"></a>
<div class="addfile"><h4>Added: branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html.json (0 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html.json                                (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/http/tests/contentextensions/font-display-none-repeated-layout.html.json        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+[
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;css-display-none&quot;,
+            &quot;selector&quot;: &quot;#hideme&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;resource-type&quot;: [
+                &quot;font&quot;
+            ]
+        }
+    },
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;resource-type&quot;: [
+                &quot;font&quot;
+            ]
+        }
+    },
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;css-display-none&quot;,
+            &quot;selector&quot;: &quot;#hideme&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;resource-type&quot;: [
+                &quot;font&quot;
+            ],
+            &quot;load-type&quot;: [
+                &quot;third-party&quot;
+            ]
+        }
+    },
+    {
+        &quot;action&quot;: {
+            &quot;type&quot;: &quot;block&quot;
+        },
+        &quot;trigger&quot;: {
+            &quot;url-filter&quot;: &quot;.*&quot;,
+            &quot;resource-type&quot;: [
+                &quot;font&quot;
+            ],
+            &quot;load-type&quot;: [
+                &quot;third-party&quot;
+            ]
+        }
+    }
+]
</ins></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (195370 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2016-01-20 20:59:53 UTC (rev 195370)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2016-01-20  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r195088. rdar://problem/24101168
+
+    2016-01-14  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+            Mixing Content Blocking of fonts and display:none rules causes battery drain
+            https://bugs.webkit.org/show_bug.cgi?id=153051
+            &lt;rdar://problem/23187709&gt;
+
+            Reviewed by Alex Christensen.
+
+            If we have applied a rule before and we are not applying it again, don't
+            resolve the style again.
+
+            Test: http/tests/contentextensions/font-display-none-repeated-layout.html
+
+            * contentextensions/ContentExtensionStyleSheet.cpp:
+            (WebCore::ContentExtensions::ContentExtensionStyleSheet::addDisplayNoneSelector):
+            * contentextensions/ContentExtensionStyleSheet.h:
+            * dom/ExtensionStyleSheets.cpp:
+            (WebCore::ExtensionStyleSheets::addDisplayNoneSelector):
+
+2016-01-20  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r195082. rdar://problem/23633319
</span><span class="cx"> 
</span><span class="cx">     2016-01-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecontentextensionsContentExtensionStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.cpp (195370 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.cpp        2016-01-20 20:59:53 UTC (rev 195370)
+++ branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.cpp        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -42,12 +42,12 @@
</span><span class="cx">     m_styleSheet-&gt;contents().setIsUserStyleSheet(true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ContentExtensionStyleSheet::addDisplayNoneSelector(const String&amp; selector, uint32_t selectorID)
</del><ins>+bool ContentExtensionStyleSheet::addDisplayNoneSelector(const String&amp; selector, uint32_t selectorID)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(selectorID != std::numeric_limits&lt;uint32_t&gt;::max());
</span><span class="cx"> 
</span><span class="cx">     if (!m_addedSelectorIDs.add(selectorID).isNewEntry)
</span><del>-        return;
</del><ins>+        return false;
</ins><span class="cx"> 
</span><span class="cx">     StringBuilder css;
</span><span class="cx">     css.append(selector);
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx">     css.append(ContentExtensionsBackend::displayNoneCSSRule());
</span><span class="cx">     css.append('}');
</span><span class="cx">     m_styleSheet-&gt;contents().parseString(css.toString());
</span><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace ContentExtensions
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorecontentextensionsContentExtensionStyleSheeth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.h (195370 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.h        2016-01-20 20:59:53 UTC (rev 195370)
+++ branches/safari-601.1.46-branch/Source/WebCore/contentextensions/ContentExtensionStyleSheet.h        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">         return adoptRef(*new ContentExtensionStyleSheet(document));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void addDisplayNoneSelector(const String&amp; selector, uint32_t selectorID);
</del><ins>+    bool addDisplayNoneSelector(const String&amp; selector, uint32_t selectorID);
</ins><span class="cx"> 
</span><span class="cx">     CSSStyleSheet&amp; styleSheet() { return m_styleSheet.get(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoredomDocumentStyleSheetCollectioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/DocumentStyleSheetCollection.cpp (195370 => 195371)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/dom/DocumentStyleSheetCollection.cpp        2016-01-20 20:59:53 UTC (rev 195370)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/DocumentStyleSheetCollection.cpp        2016-01-20 21:00:05 UTC (rev 195371)
</span><span class="lines">@@ -203,8 +203,8 @@
</span><span class="cx">         m_userStyleSheets.append(&amp;result.iterator-&gt;value-&gt;styleSheet());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    result.iterator-&gt;value-&gt;addDisplayNoneSelector(selector, selectorID);
-    m_styleResolverChangedTimer.startOneShot(0);
</del><ins>+    if (result.iterator-&gt;value-&gt;addDisplayNoneSelector(selector, selectorID))
+        m_styleResolverChangedTimer.startOneShot(0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DocumentStyleSheetCollection::maybeAddContentExtensionSheet(const String&amp; identifier, StyleSheetContents&amp; sheet)
</span></span></pre>
</div>
</div>

</body>
</html>