<!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>[186195] 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/186195">186195</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-07-01 14:52:07 -0700 (Wed, 01 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Regression(183998): Disqus comments take a very long time to load
https://bugs.webkit.org/show_bug.cgi?id=146522
&lt;rdar://problem/21590601&gt;

Reviewed by Simon Fraser.

Source/WebCore:

Stop throttling requestAnimationFrame() in iframes that are not visible
due to them being zero-sized or display:none. Those are usually utility
iframes and throttling them is risky.

Se still throttle requestAnimationFrame() in iframes that would be
visible in theory but are currently not noticeable because they are
outside the viewport.

Test:
- fast/animation/request-animation-frame-throttle-subframe.html
- fast/animation/request-animation-frame-throttle-subframe-display-none.html
- fast/animation/request-animation-frame-throttle-subframe-zero-size.html

* page/FrameView.cpp:
(WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):

LayoutTests:

* fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt:
* fast/animation/request-animation-frame-throttle-subframe-display-none.html:
Update layout test as we changed behavior here. We no longer throttle display:none
iframes.

* fast/animation/request-animation-frame-throttle-subframe-zero-size-expected.txt: Added.
* fast/animation/request-animation-frame-throttle-subframe-zero-size.html: Added.
Add layout test to check that we don't throttle RaF in iframes that are zero-sized.

* fast/animation/resources/requestAnimationFrame-frame-2.html:
* fast/animation/resources/requestAnimationFrame-frame.html:
Update use of requestAnimationFrame() to be more representative of real world usage.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastanimationrequestanimationframethrottlesubframedisplaynoneexpectedtxt">trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastanimationrequestanimationframethrottlesubframedisplaynonehtml">trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none.html</a></li>
<li><a href="#trunkLayoutTestsfastanimationresourcesrequestAnimationFrameframe2html">trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame-2.html</a></li>
<li><a href="#trunkLayoutTestsfastanimationresourcesrequestAnimationFrameframehtml">trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastanimationrequestanimationframethrottlesubframezerosizeexpectedtxt">trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastanimationrequestanimationframethrottlesubframezerosizehtml">trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/LayoutTests/ChangeLog        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-07-01  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Regression(183998): Disqus comments take a very long time to load
+        https://bugs.webkit.org/show_bug.cgi?id=146522
+        &lt;rdar://problem/21590601&gt;
+
+        Reviewed by Simon Fraser.
+
+        * fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt:
+        * fast/animation/request-animation-frame-throttle-subframe-display-none.html:
+        Update layout test as we changed behavior here. We no longer throttle display:none
+        iframes.
+
+        * fast/animation/request-animation-frame-throttle-subframe-zero-size-expected.txt: Added.
+        * fast/animation/request-animation-frame-throttle-subframe-zero-size.html: Added.
+        Add layout test to check that we don't throttle RaF in iframes that are zero-sized.
+
+        * fast/animation/resources/requestAnimationFrame-frame-2.html:
+        * fast/animation/resources/requestAnimationFrame-frame.html:
+        Update use of requestAnimationFrame() to be more representative of real world usage.
+
</ins><span class="cx"> 2015-07-01  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Mark compositing/masks/compositing-clip-path-origin.html as being image-flakey.
</span></span></pre></div>
<a id="trunkLayoutTestsfastanimationrequestanimationframethrottlesubframedisplaynoneexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none-expected.txt        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -1,18 +1,9 @@
</span><del>-Tests that requestAnimationFrame is throttled in subframes that are display:none
</del><ins>+Tests that requestAnimationFrame is not throttled in subframes that are display:none
</ins><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-Frame is initially visibile so requestAnimationFrame should not be throttled
-PASS testFrame.contentWindow.internals.isRequestAnimationFrameThrottled() became false
</del><span class="cx"> PASS testFrame.contentWindow.internals.isRequestAnimationFrameThrottled() is false
</span><del>-Hiding subframe.
-testFrame.style.display = 'none';
-PASS testFrame.contentWindow.internals.isRequestAnimationFrameThrottled() became true
-PASS testFrame.contentWindow.internals.isRequestAnimationFrameThrottled() is true
-Show subframe again
-testFrame.style.display = 'block';
-PASS testFrame.contentWindow.internals.isRequestAnimationFrameThrottled() became false
</del><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastanimationrequestanimationframethrottlesubframedisplaynonehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none.html (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none.html        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-display-none.html        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -3,42 +3,21 @@
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;script&gt;
</span><del>-description(&quot;Tests that requestAnimationFrame is throttled in subframes that are display:none&quot;);
</del><ins>+description(&quot;Tests that requestAnimationFrame is not throttled in subframes that are display:none&quot;);
</ins><span class="cx"> window.jsTestIsAsync = true;
</span><span class="cx"> 
</span><del>-function checkSubframeThrottled()
</del><ins>+function runTest()
</ins><span class="cx"> {
</span><del>-    shouldBeTrue(&quot;testFrame.contentWindow.internals.isRequestAnimationFrameThrottled()&quot;);
</del><ins>+    testFrame = document.getElementById(&quot;testFrame&quot;);
</ins><span class="cx"> 
</span><del>-    debug(&quot;Show subframe again&quot;);
-    evalAndLog(&quot;testFrame.style.display = 'block';&quot;);
</del><ins>+    // Force layout.
+    document.body.offsetTop;
</ins><span class="cx"> 
</span><del>-    shouldBecomeEqual(&quot;testFrame.contentWindow.internals.isRequestAnimationFrameThrottled()&quot;, &quot;false&quot;, finishJSTest);
-}
-
-function hideFrame()
-{
</del><span class="cx">     shouldBeFalse(&quot;testFrame.contentWindow.internals.isRequestAnimationFrameThrottled()&quot;);
</span><del>-
-    debug(&quot;Hiding subframe.&quot;);
-    evalAndLog(&quot;testFrame.style.display = 'none';&quot;);
-
-    shouldBecomeEqual(&quot;testFrame.contentWindow.internals.isRequestAnimationFrameThrottled()&quot;, &quot;true&quot;, checkSubframeThrottled);
</del><ins>+    finishJSTest();
</ins><span class="cx"> }
</span><del>-
-function runTest()
-{
-    testFrame = document.getElementById(&quot;testFrame&quot;);
-    debug(&quot;Frame is initially visibile so requestAnimationFrame should not be throttled&quot;);
-    shouldBecomeEqual(&quot;testFrame.contentWindow.internals.isRequestAnimationFrameThrottled()&quot;, &quot;false&quot;, hideFrame);
-}
-
-var i = 0;
-requestAnimationFrame(function() {
-    i++;
-});
</del><span class="cx"> &lt;/script&gt;
</span><del>-&lt;iframe id=&quot;testFrame&quot; src=&quot;resources/requestAnimationFrame-frame.html&quot; onload=&quot;runTest()&quot;&gt;&lt;/iframe&gt;
</del><ins>+&lt;iframe id=&quot;testFrame&quot; style=&quot;position: absolute; top: 800px; display: none;&quot; src=&quot;resources/requestAnimationFrame-frame.html&quot; onload=&quot;runTest()&quot;&gt;&lt;/iframe&gt;
</ins><span class="cx"> &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastanimationrequestanimationframethrottlesubframezerosizeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size-expected.txt (0 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size-expected.txt        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Tests that requestAnimationFrame is not throttled in zero-sized subframes
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS testFrame.contentWindow.internals.isRequestAnimationFrameThrottled() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastanimationrequestanimationframethrottlesubframezerosizehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size.html (0 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size.html                                (rev 0)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-throttle-subframe-zero-size.html        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Tests that requestAnimationFrame is not throttled in zero-sized subframes&quot;);
+window.jsTestIsAsync = true;
+
+function runTest()
+{
+    testFrame = document.getElementById(&quot;testFrame&quot;);
+
+    // Force layout.
+    document.body.offsetTop;
+
+    shouldBeFalse(&quot;testFrame.contentWindow.internals.isRequestAnimationFrameThrottled()&quot;);
+    finishJSTest();
+}
+&lt;/script&gt;
+&lt;iframe id=&quot;testFrame&quot; style=&quot;position: absolute; top: 800px; left: 0; height: 0;&quot; src=&quot;resources/requestAnimationFrame-frame.html&quot; onload=&quot;runTest()&quot;&gt;&lt;/iframe&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="trunkLayoutTestsfastanimationresourcesrequestAnimationFrameframe2html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame-2.html (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame-2.html        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame-2.html        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -3,9 +3,13 @@
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> var i = 0;
</span><del>-requestAnimationFrame(function() {
</del><ins>+function step()
+{
</ins><span class="cx">   i++;
</span><del>-});
</del><ins>+  requestAnimationFrame(step);
+}
+
+requestAnimationFrame(step);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastanimationresourcesrequestAnimationFrameframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame.html (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame.html        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/LayoutTests/fast/animation/resources/requestAnimationFrame-frame.html        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -3,10 +3,15 @@
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;iframe id=&quot;grandChildFrame&quot; src=&quot;requestAnimationFrame-frame-2.html&quot;&gt;&lt;/iframe&gt;
</span><span class="cx"> &lt;script&gt;
</span><ins>+
</ins><span class="cx"> var i = 0;
</span><del>-requestAnimationFrame(function() {
</del><ins>+function step()
+{
</ins><span class="cx">   i++;
</span><del>-});
</del><ins>+  requestAnimationFrame(step);
+}
+
+requestAnimationFrame(step);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/Source/WebCore/ChangeLog        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-07-01  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Regression(183998): Disqus comments take a very long time to load
+        https://bugs.webkit.org/show_bug.cgi?id=146522
+        &lt;rdar://problem/21590601&gt;
+
+        Reviewed by Simon Fraser.
+
+        Stop throttling requestAnimationFrame() in iframes that are not visible
+        due to them being zero-sized or display:none. Those are usually utility
+        iframes and throttling them is risky.
+
+        Se still throttle requestAnimationFrame() in iframes that would be
+        visible in theory but are currently not noticeable because they are
+        outside the viewport.
+
+        Test:
+        - fast/animation/request-animation-frame-throttle-subframe.html
+        - fast/animation/request-animation-frame-throttle-subframe-display-none.html
+        - fast/animation/request-animation-frame-throttle-subframe-zero-size.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
+
</ins><span class="cx"> 2015-06-30  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r179168): Characters overlap after resizing the font on the copy-pasted Japanese text
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (186194 => 186195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-07-01 21:34:58 UTC (rev 186194)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-07-01 21:52:07 UTC (rev 186195)
</span><span class="lines">@@ -2171,9 +2171,8 @@
</span><span class="cx">     if (!document)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: This doesn't work for subframes of a &quot;display: none&quot; frame because
-    // they have a non-null ownerRenderer.
-    bool shouldThrottle = !frame().ownerRenderer() || visibleRect.isEmpty();
</del><ins>+    // We don't throttle zero-size or display:none frames because those are usually utility frames.
+    bool shouldThrottle = visibleRect.isEmpty() &amp;&amp; !m_size.isEmpty() &amp;&amp; frame().ownerRenderer();
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(REQUEST_ANIMATION_FRAME)
</span><span class="cx">     if (auto* scriptedAnimationController = document-&gt;scriptedAnimationController())
</span></span></pre>
</div>
</div>

</body>
</html>