<!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>[185012] 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/185012">185012</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-05-29 16:02:36 -0700 (Fri, 29 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Consider throttling DOM timers in iframes outside the viewport
https://bugs.webkit.org/show_bug.cgi?id=145465
<rdar://problem/20768957>
Reviewed by Darin Adler.
Source/WebCore:
Throttle DOM timers in iframes that are outside the viewport to decrease
CPU usage, improve performance and reduce power use.
The approach is similar to what we already did for requestAnimationFrame
in <a href="http://trac.webkit.org/projects/webkit/changeset/183998">r183998</a>.
We already has support for throttling DOM timers at:
- Page level: for backgound pages
- DOM timer level: for timers changing the style of an element outside
the viewport or drawing on a canvas outside the viewport.
This patch adds support for throttling DOM timers at Document level so
we can throttle all timers inside a specific iframe / Document. It relies
on the same timerAlignmentInterval that is used for throttling at Page
level with tweaks so that different Documents inside the same Page can
have a different timerAlignmentInterval.
Test: fast/dom/timer-throttling-subframe.html
* dom/Document.cpp:
(WebCore::Document::setTimerThrottlingEnabled):
(WebCore::Document::timerAlignmentInterval):
* dom/Document.h:
(WebCore::Document::isTimerThrottlingEnabled):
* page/DOMTimer.cpp:
(WebCore::DOMTimer::alignedFireTime):
The previous code was not throttling the timer if its fireTime was in
the past. This was causing some aggressive timers on mashable.com to
not be throttled so I got rid of this behavior. I don't see any reason
why we would not throttle a timer simply because it is supposed to have
fired already.
* page/FrameView.cpp:
(WebCore::FrameView::viewportContentsChanged):
(WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
* page/FrameView.h:
* testing/Internals.cpp:
(WebCore::Internals::areTimersThrottled):
* testing/Internals.h:
* testing/Internals.idl:
Add API to facilitate layout testing of this functionality.
LayoutTests:
Add a layout test to check that DOM timers in iframes outside the
viewport get throttled.
* fast/dom/resources/timer-frame-2.html: Added.
* fast/dom/resources/timer-frame.html: Added.
* fast/dom/timer-throttling-subframe-expected.txt: Added.
* fast/dom/timer-throttling-subframe.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="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMTimercpp">trunk/Source/WebCore/page/DOMTimer.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</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="#trunkLayoutTestsfastdomresourcestimerframe2html">trunk/LayoutTests/fast/dom/resources/timer-frame-2.html</a></li>
<li><a href="#trunkLayoutTestsfastdomresourcestimerframehtml">trunk/LayoutTests/fast/dom/resources/timer-frame.html</a></li>
<li><a href="#trunkLayoutTestsfastdomtimerthrottlingsubframeexpectedtxt">trunk/LayoutTests/fast/dom/timer-throttling-subframe-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomtimerthrottlingsubframehtml">trunk/LayoutTests/fast/dom/timer-throttling-subframe.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/LayoutTests/ChangeLog        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-05-29 Chris Dumez <cdumez@apple.com>
+
+ Consider throttling DOM timers in iframes outside the viewport
+ https://bugs.webkit.org/show_bug.cgi?id=145465
+ <rdar://problem/20768957>
+
+ Reviewed by Darin Adler.
+
+ Add a layout test to check that DOM timers in iframes outside the
+ viewport get throttled.
+
+ * fast/dom/resources/timer-frame-2.html: Added.
+ * fast/dom/resources/timer-frame.html: Added.
+ * fast/dom/timer-throttling-subframe-expected.txt: Added.
+ * fast/dom/timer-throttling-subframe.html: Added.
+
</ins><span class="cx"> 2015-05-28 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Non-speculative Branch should be fast in the FTL
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomresourcestimerframe2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/resources/timer-frame-2.html (0 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/resources/timer-frame-2.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/timer-frame-2.html        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script>
+var i = 0;
+setInterval(function() {
+ i++;
+}, 100);
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomresourcestimerframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/resources/timer-frame.html (0 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/resources/timer-frame.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/timer-frame.html        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<iframe id="grandChildFrame" src="timer-frame-2.html"></iframe>
+<script>
+var i = 0;
+setInterval(function() {
+ i++;
+}, 100);
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomtimerthrottlingsubframeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/timer-throttling-subframe-expected.txt (0 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/timer-throttling-subframe-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/timer-throttling-subframe-expected.txt        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+Tests that timers are throttled in subframes that are outside the viewport
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Frame is initially outside the viewport so timers should be throttled
+PASS testFrame.contentWindow.internals.areTimersThrottled() became true
+PASS internals.areTimersThrottled() is false
+PASS testFrame.contentWindow.internals.areTimersThrottled() is true
+PASS grandChildFrame.contentWindow.internals.areTimersThrottled() is true
+Scrolling frame into view.
+Timers should no longer be throttled
+PASS internals.areTimersThrottled() is false
+PASS testFrame.contentWindow.internals.areTimersThrottled() is false
+PASS grandChildFrame.contentWindow.internals.areTimersThrottled() is false
+Scrolling frame out of view again.
+PASS internals.areTimersThrottled() is false
+PASS testFrame.contentWindow.internals.areTimersThrottled() became true
+PASS testFrame.contentWindow.internals.areTimersThrottled() is true
+PASS grandChildFrame.contentWindow.internals.areTimersThrottled() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomtimerthrottlingsubframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/timer-throttling-subframe.html (0 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/timer-throttling-subframe.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/timer-throttling-subframe.html        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+description("Tests that timers are throttled in subframes that are outside the viewport");
+window.jsTestIsAsync = true;
+
+function checkSubframesThrottled()
+{
+ shouldBeTrue("testFrame.contentWindow.internals.areTimersThrottled()");
+ shouldBeTrue("grandChildFrame.contentWindow.internals.areTimersThrottled()");
+
+ finishJSTest();
+}
+
+function scrollFrameOutOfView()
+{
+ debug("Scrolling frame out of view again.");
+ window.scroll(0, 0);
+
+ shouldBeFalse("internals.areTimersThrottled()");
+ shouldBecomeEqual("testFrame.contentWindow.internals.areTimersThrottled()", "true", checkSubframesThrottled);
+}
+
+function scrollFrameIntoView()
+{
+ shouldBeFalse("internals.areTimersThrottled()");
+ shouldBeTrue("testFrame.contentWindow.internals.areTimersThrottled()");
+ shouldBeTrue("grandChildFrame.contentWindow.internals.areTimersThrottled()");
+
+ debug("Scrolling frame into view.");
+ window.internals.scrollElementToRect(testFrame, 0, 0, 300, 300);
+
+ debug("Timers should no longer be throttled");
+ shouldBeFalse("internals.areTimersThrottled()");
+ shouldBeFalse("testFrame.contentWindow.internals.areTimersThrottled()");
+ shouldBeFalse("grandChildFrame.contentWindow.internals.areTimersThrottled()");
+
+ scrollFrameOutOfView();
+}
+
+function runTest()
+{
+ testFrame = document.getElementById("testFrame");
+ grandChildFrame = testFrame.contentDocument.getElementById("grandChildFrame");
+ debug("Frame is initially outside the viewport so timers should be throttled");
+ shouldBecomeEqual("testFrame.contentWindow.internals.areTimersThrottled()", "true", scrollFrameIntoView);
+}
+
+var i = 0;
+setInterval(function() {
+ i++;
+}, 100);
+</script>
+<div style="position: relative; width: 1600px; height: 2400px; background-color: green;">
+ <iframe id="testFrame" src="resources/timer-frame.html" style="position:absolute; left: 600px; top: 800px;" onload="runTest()"></iframe>
+</div>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/ChangeLog        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2015-05-29 Chris Dumez <cdumez@apple.com>
+
+ Consider throttling DOM timers in iframes outside the viewport
+ https://bugs.webkit.org/show_bug.cgi?id=145465
+ <rdar://problem/20768957>
+
+ Reviewed by Darin Adler.
+
+ Throttle DOM timers in iframes that are outside the viewport to decrease
+ CPU usage, improve performance and reduce power use.
+
+ The approach is similar to what we already did for requestAnimationFrame
+ in r183998.
+
+ We already has support for throttling DOM timers at:
+ - Page level: for backgound pages
+ - DOM timer level: for timers changing the style of an element outside
+ the viewport or drawing on a canvas outside the viewport.
+
+ This patch adds support for throttling DOM timers at Document level so
+ we can throttle all timers inside a specific iframe / Document. It relies
+ on the same timerAlignmentInterval that is used for throttling at Page
+ level with tweaks so that different Documents inside the same Page can
+ have a different timerAlignmentInterval.
+
+ Test: fast/dom/timer-throttling-subframe.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::setTimerThrottlingEnabled):
+ (WebCore::Document::timerAlignmentInterval):
+ * dom/Document.h:
+ (WebCore::Document::isTimerThrottlingEnabled):
+ * page/DOMTimer.cpp:
+ (WebCore::DOMTimer::alignedFireTime):
+ The previous code was not throttling the timer if its fireTime was in
+ the past. This was causing some aggressive timers on mashable.com to
+ not be throttled so I got rid of this behavior. I don't see any reason
+ why we would not throttle a timer simply because it is supposed to have
+ fired already.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::viewportContentsChanged):
+ (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
+ * page/FrameView.h:
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::areTimersThrottled):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ Add API to facilitate layout testing of this functionality.
+
</ins><span class="cx"> 2015-05-29 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> NavigationAction constructor cleanup.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -2750,8 +2750,24 @@
</span><span class="cx"> return page->settings().minimumDOMTimerInterval();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Document::setTimerThrottlingEnabled(bool shouldThrottle)
+{
+ if (m_isTimerThrottlingEnabled == shouldThrottle)
+ return;
+
+ double previousInterval = timerAlignmentInterval();
+
+ m_isTimerThrottlingEnabled = shouldThrottle;
+
+ if (previousInterval != timerAlignmentInterval())
+ didChangeTimerAlignmentInterval();
+}
+
</ins><span class="cx"> double Document::timerAlignmentInterval() const
</span><span class="cx"> {
</span><ins>+ if (m_isTimerThrottlingEnabled)
+ return DOMTimer::hiddenPageAlignmentInterval();
+
</ins><span class="cx"> Page* page = this->page();
</span><span class="cx"> if (!page)
</span><span class="cx"> return ScriptExecutionContext::timerAlignmentInterval();
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/dom/Document.h        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -431,6 +431,9 @@
</span><span class="cx"> String visibilityState() const;
</span><span class="cx"> bool hidden() const;
</span><span class="cx">
</span><ins>+ void setTimerThrottlingEnabled(bool);
+ bool isTimerThrottlingEnabled() const { return m_isTimerThrottlingEnabled; }
+
</ins><span class="cx"> #if ENABLE(CSP_NEXT)
</span><span class="cx"> DOMSecurityPolicy& securityPolicy();
</span><span class="cx"> #endif
</span><span class="lines">@@ -1688,6 +1691,7 @@
</span><span class="cx"> bool m_hasPreparedForDestruction;
</span><span class="cx">
</span><span class="cx"> bool m_hasStyleWithViewportUnits;
</span><ins>+ bool m_isTimerThrottlingEnabled { false };
</ins><span class="cx">
</span><span class="cx"> HashSet<MediaProducer*> m_audioProducers;
</span><span class="cx"> MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMTimercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMTimer.cpp (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMTimer.cpp        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/page/DOMTimer.cpp        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -507,16 +507,9 @@
</span><span class="cx">
</span><span class="cx"> double DOMTimer::alignedFireTime(double fireTime) const
</span><span class="cx"> {
</span><del>- double alignmentInterval = scriptExecutionContext()->timerAlignmentInterval();
- if (alignmentInterval) {
- double currentTime = monotonicallyIncreasingTime();
- if (fireTime <= currentTime)
- return fireTime;
</del><ins>+ if (double alignmentInterval = scriptExecutionContext()->timerAlignmentInterval())
+ return ceil(fireTime / alignmentInterval) * alignmentInterval;
</ins><span class="cx">
</span><del>- double alignedTime = ceil(fireTime / alignmentInterval) * alignmentInterval;
- return alignedTime;
- }
-
</del><span class="cx"> return fireTime;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -1807,7 +1807,7 @@
</span><span class="cx"> applyRecursivelyWithVisibleRect([] (FrameView& frameView, const IntRect& visibleRect) {
</span><span class="cx"> frameView.resumeVisibleImageAnimations(visibleRect);
</span><span class="cx"> frameView.updateThrottledDOMTimersState(visibleRect);
</span><del>- frameView.updateScriptedAnimationsThrottlingState(visibleRect);
</del><ins>+ frameView.updateScriptedAnimationsAndTimersThrottlingState(visibleRect);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2168,9 +2168,8 @@
</span><span class="cx"> renderView->resumePausedImageAnimationsIfNeeded(visibleRect);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void FrameView::updateScriptedAnimationsThrottlingState(const IntRect& visibleRect)
</del><ins>+void FrameView::updateScriptedAnimationsAndTimersThrottlingState(const IntRect& visibleRect)
</ins><span class="cx"> {
</span><del>-#if ENABLE(REQUEST_ANIMATION_FRAME)
</del><span class="cx"> if (frame().isMainFrame())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -2178,17 +2177,16 @@
</span><span class="cx"> if (!document)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- auto* scriptedAnimationController = document->scriptedAnimationController();
- if (!scriptedAnimationController)
- return;
-
</del><span class="cx"> // FIXME: This doesn't work for subframes of a "display: none" frame because
</span><span class="cx"> // they have a non-null ownerRenderer.
</span><span class="cx"> bool shouldThrottle = !frame().ownerRenderer() || visibleRect.isEmpty();
</span><del>- scriptedAnimationController->setThrottled(shouldThrottle);
-#else
- UNUSED_PARAM(visibleRect);
</del><ins>+
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ if (auto* scriptedAnimationController = document->scriptedAnimationController())
+ scriptedAnimationController->setThrottled(shouldThrottle);
</ins><span class="cx"> #endif
</span><ins>+
+ document->setTimerThrottlingEnabled(shouldThrottle);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/page/FrameView.h        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -606,7 +606,7 @@
</span><span class="cx"> void applyRecursivelyWithVisibleRect(const std::function<void (FrameView& frameView, const IntRect& visibleRect)>&);
</span><span class="cx"> void updateThrottledDOMTimersState(const IntRect& visibleRect);
</span><span class="cx"> void resumeVisibleImageAnimations(const IntRect& visibleRect);
</span><del>- void updateScriptedAnimationsThrottlingState(const IntRect& visibleRect);
</del><ins>+ void updateScriptedAnimationsAndTimersThrottlingState(const IntRect& visibleRect);
</ins><span class="cx">
</span><span class="cx"> void updateLayerFlushThrottling();
</span><span class="cx"> WEBCORE_EXPORT void adjustTiledBackingCoverage();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -799,6 +799,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool Internals::areTimersThrottled() const
+{
+ return contextDocument()->isTimerThrottlingEnabled();
+}
+
</ins><span class="cx"> String Internals::visiblePlaceholder(Element* element)
</span><span class="cx"> {
</span><span class="cx"> if (is<HTMLTextFormControlElement>(element)) {
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/testing/Internals.h        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> // DOMTimers throttling testing.
</span><span class="cx"> bool isTimerThrottled(int timeoutId, ExceptionCode&);
</span><span class="cx"> bool isRequestAnimationFrameThrottled() const;
</span><ins>+ bool areTimersThrottled() const;
</ins><span class="cx">
</span><span class="cx"> // Spatial Navigation testing.
</span><span class="cx"> unsigned lastSpatialNavigationCandidateCount(ExceptionCode&) const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (185011 => 185012)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2015-05-29 23:01:37 UTC (rev 185011)
+++ trunk/Source/WebCore/testing/Internals.idl        2015-05-29 23:02:36 UTC (rev 185012)
</span><span class="lines">@@ -285,6 +285,7 @@
</span><span class="cx"> [RaisesException] boolean isTimerThrottled(long timerHandle);
</span><span class="cx">
</span><span class="cx"> boolean isRequestAnimationFrameThrottled();
</span><ins>+ boolean areTimersThrottled();
</ins><span class="cx">
</span><span class="cx"> [RaisesException] void startTrackingStyleRecalcs();
</span><span class="cx"> [RaisesException] unsigned long styleRecalcCount();
</span></span></pre>
</div>
</div>
</body>
</html>