<!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>[215070] 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/215070">215070</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2017-04-06 17:04:10 -0700 (Thu, 06 Apr 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Throttle requestAnimationFrame in cross-origin iframes to 30fps
https://bugs.webkit.org/show_bug.cgi?id=170534

Reviewed by Dan Bates.

Source/WebCore:

Add a throttling reason to ScriptedAnimationController which is NonInteractedCrossOriginFrame,
set on cross-origin iframes whose documents have never seen a user interaction. It's cleared
as soon as an interaction on this frame or a child frame is detected.

Move the initialization of the LowPowerMode throttling reason to Document::requestAnimationFrame(),
since it's more appropriate to compute NonInteractedCrossOriginFrame here than down in ScriptedAnimationController,
and best to do both in the same place.

Tests: http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html

* dom/Document.cpp:
(WebCore::Document::requestAnimationFrame):
(WebCore::Document::updateLastHandledUserGestureTimestamp):
* dom/Document.h:
(WebCore::Document::hasHadUserInteraction):
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::ScriptedAnimationController):
(WebCore::throttlingReasonToString):
(WebCore::ScriptedAnimationController::interval):
* dom/ScriptedAnimationController.h:
* loader/FrameLoader.cpp:
(WebCore::shouldAskForNavigationConfirmation):

LayoutTests:

* http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe-expected.txt: Added.
* http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html: Added.
* http/tests/frame-throttling/resources/requestAnimationFrame-frame.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="#trunkSourceWebCoredomScriptedAnimationControllercpp">trunk/Source/WebCore/dom/ScriptedAnimationController.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptedAnimationControllerh">trunk/Source/WebCore/dom/ScriptedAnimationController.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/http/tests/frame-throttling/</li>
<li><a href="#trunkLayoutTestshttptestsframethrottlingrafthrottleincrossoriginsubframeexpectedtxt">trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsframethrottlingrafthrottleincrossoriginsubframehtml">trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html</a></li>
<li>trunk/LayoutTests/http/tests/frame-throttling/resources/</li>
<li><a href="#trunkLayoutTestshttptestsframethrottlingresourcesrequestAnimationFrameframehtml">trunk/LayoutTests/http/tests/frame-throttling/resources/requestAnimationFrame-frame.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/LayoutTests/ChangeLog        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-04-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Throttle requestAnimationFrame in cross-origin iframes to 30fps
+        https://bugs.webkit.org/show_bug.cgi?id=170534
+
+        Reviewed by Dan Bates.
+
+        * http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe-expected.txt: Added.
+        * http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html: Added.
+        * http/tests/frame-throttling/resources/requestAnimationFrame-frame.html: Added.
+
</ins><span class="cx"> 2017-04-06  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r215041.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsframethrottlingrafthrottleincrossoriginsubframeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe-expected.txt (0 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe-expected.txt        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+Tests that requestAnimationFrame is throttled in subframes that are cross-origin, and not in same-origin frames
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Received message: frameload
+Received message: frameload
+Checking that requestAnimationFrame is throttled in cross origin frame
+Received message: throttled[cross]: true
+Received message: throttled[same]: false
+PASS throttledState['cross'] is &quot;true&quot;
+PASS throttledState['same'] is &quot;false&quot;
+Interacted with cross-origin frame
+Interacted with same-origin frame
+Received message: throttled[cross]: false
+Received message: throttled[same]: false
+PASS throttledState['cross'] is &quot;false&quot;
+PASS throttledState['same'] is &quot;false&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE

</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsframethrottlingrafthrottleincrossoriginsubframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html (0 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        iframe {
+            height: 200px;
+            width: 400px;
+        }
+    &lt;/style&gt;
+    &lt;script src=&quot;/js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;/js-test-resources/ui-helper.js&quot;&gt;&lt;/script&gt;
+    
+    &lt;script&gt;
+    description(&quot;Tests that requestAnimationFrame is throttled in subframes that are cross-origin, and not in same-origin frames&quot;);
+    window.jsTestIsAsync = true;
+    
+    var crossOriginFrame;
+    var sameOriginFrame
+
+    var throttledState = {
+        'cross' : undefined,
+        'same' : undefined,
+    }
+
+    var messageHandler;
+    var messagesReceived = 0;
+
+    function interactWithSubframes()
+    {
+        UIHelper.activateAt(crossOriginFrame.offsetLeft + 5, crossOriginFrame.offsetTop + 5).then(function() {
+            debug(&quot;Interacted with cross-origin frame&quot;);
+            UIHelper.activateAt(sameOriginFrame.offsetLeft + 5, sameOriginFrame.offsetTop + 5).then(function() {
+                debug(&quot;Interacted with same-origin frame&quot;);
+                messageHandler = checkUnthrottledAfterInteraction;
+                messagesReceived = 0;
+                crossOriginFrame.contentWindow.postMessage(&quot;report-throttle-cross&quot;, &quot;*&quot;);
+                sameOriginFrame.contentWindow.postMessage(&quot;report-throttle-same&quot;, &quot;*&quot;);
+            });
+        });
+    }
+
+    function runTest()
+    {
+        crossOriginFrame = document.getElementById(&quot;cross-origin-frame&quot;);
+        sameOriginFrame = document.getElementById(&quot;same-origin-frame&quot;);
+
+        debug(&quot;Checking that requestAnimationFrame is throttled in cross origin frame&quot;);
+        
+        messageHandler = checkInitiallyThrottled;
+        messagesReceived = 0;
+        crossOriginFrame.contentWindow.postMessage(&quot;report-throttle-cross&quot;, &quot;*&quot;);
+        sameOriginFrame.contentWindow.postMessage(&quot;report-throttle-same&quot;, &quot;*&quot;);
+    }
+
+    function checkInitiallyThrottled()
+    {
+        shouldBeEqualToString(&quot;throttledState['cross']&quot;, &quot;true&quot;);
+        shouldBeEqualToString(&quot;throttledState['same']&quot;, &quot;false&quot;);
+        interactWithSubframes();
+    }
+
+    function checkUnthrottledAfterInteraction()
+    {
+        shouldBeEqualToString(&quot;throttledState['cross']&quot;, &quot;false&quot;);
+        shouldBeEqualToString(&quot;throttledState['same']&quot;, &quot;false&quot;);
+        finishJSTest();
+    }
+
+    window.onmessage = function(message)
+    {
+        debug(&quot;Received message: &quot; + message.data);
+        if (message.data === &quot;frameload&quot;) {
+            if (++messagesReceived == 2)
+                runTest();
+            return;
+        }
+
+        var re = /throttled\[(\w+)\]: (true|false)/;
+        var match = re.exec(message.data);
+        if (match) {
+            frameID = match[1];
+            throttledState[frameID] = match[2];
+            if (++messagesReceived == 2)
+                messageHandler();
+            return;
+        }
+        
+        debug(&quot;Failed to handle message &quot; + message.data);
+    }
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;iframe id=&quot;cross-origin-frame&quot; src=&quot;http://localhost:8000/frame-throttling/resources/requestAnimationFrame-frame.html?dontcacheme&quot;&gt;&lt;/iframe&gt;
+    &lt;iframe id=&quot;same-origin-frame&quot; src=&quot;resources/requestAnimationFrame-frame.html?dontcacheme&quot;&gt;&lt;/iframe&gt;
+
+    &lt;script src=&quot;/js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsframethrottlingresourcesrequestAnimationFrameframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/frame-throttling/resources/requestAnimationFrame-frame.html (0 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/frame-throttling/resources/requestAnimationFrame-frame.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/frame-throttling/resources/requestAnimationFrame-frame.html        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script&gt;
+        var i = 0;
+        function step()
+        {
+            i++;
+            requestAnimationFrame(step);
+        }
+        step();
+
+        window.onmessage = function(message)
+        {
+            var re = /report-throttle-(cross|same)/;
+            var match = re.exec(message.data);
+
+            if (match) {
+                var frameId = match[1];
+                if (window.internals)
+                    parent.window.postMessage(&quot;throttled[&quot; + frameId + &quot;]: &quot; + internals.isRequestAnimationFrameThrottled(), &quot;*&quot;);
+            }
+        }
+
+        window.addEventListener(&quot;load&quot;, function() {
+            parent.window.postMessage(&quot;frameload&quot;, &quot;*&quot;);
+        }, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    Child frame.
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/Source/WebCore/ChangeLog        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -1,5 +1,35 @@
</span><span class="cx"> 2017-04-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Throttle requestAnimationFrame in cross-origin iframes to 30fps
+        https://bugs.webkit.org/show_bug.cgi?id=170534
+
+        Reviewed by Dan Bates.
+
+        Add a throttling reason to ScriptedAnimationController which is NonInteractedCrossOriginFrame,
+        set on cross-origin iframes whose documents have never seen a user interaction. It's cleared
+        as soon as an interaction on this frame or a child frame is detected.
+
+        Move the initialization of the LowPowerMode throttling reason to Document::requestAnimationFrame(),
+        since it's more appropriate to compute NonInteractedCrossOriginFrame here than down in ScriptedAnimationController,
+        and best to do both in the same place.
+
+        Tests: http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::requestAnimationFrame):
+        (WebCore::Document::updateLastHandledUserGestureTimestamp):
+        * dom/Document.h:
+        (WebCore::Document::hasHadUserInteraction):
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::ScriptedAnimationController):
+        (WebCore::throttlingReasonToString):
+        (WebCore::ScriptedAnimationController::interval):
+        * dom/ScriptedAnimationController.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::shouldAskForNavigationConfirmation):
+
+2017-04-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Use the Accelerate framework to optimize FEColorMatrix operations
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=170518
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/Source/WebCore/dom/Document.cpp        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -6011,6 +6011,12 @@
</span><span class="cx">         if (!page() || page()-&gt;scriptedAnimationsSuspended())
</span><span class="cx">             m_scriptedAnimationController-&gt;suspend();
</span><span class="cx"> 
</span><ins>+        if (page() &amp;&amp; page()-&gt;isLowPowerModeEnabled())
+            m_scriptedAnimationController-&gt;addThrottlingReason(ScriptedAnimationController::ThrottlingReason::LowPowerMode);
+
+        if (!topOrigin().canAccess(securityOrigin()) &amp;&amp; !hasHadUserInteraction())
+            m_scriptedAnimationController-&gt;addThrottlingReason(ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame);
+
</ins><span class="cx">         if (settings().shouldDispatchRequestAnimationFrameEvents()) {
</span><span class="cx">             if (!page())
</span><span class="cx">                 dispatchEvent(Event::create(&quot;raf-no-page&quot;, false, false));
</span><span class="lines">@@ -6315,6 +6321,11 @@
</span><span class="cx"> void Document::updateLastHandledUserGestureTimestamp(MonotonicTime time)
</span><span class="cx"> {
</span><span class="cx">     m_lastHandledUserGestureTimestamp = time;
</span><ins>+
+    if (static_cast&lt;bool&gt;(time) &amp;&amp; m_scriptedAnimationController) {
+        // It's OK to always remove NonInteractedCrossOriginFrame even if this frame isn't cross-origin.
+        m_scriptedAnimationController-&gt;removeThrottlingReason(ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame);
+    }
</ins><span class="cx">     
</span><span class="cx">     if (HTMLFrameOwnerElement* element = ownerElement())
</span><span class="cx">         element-&gt;document().updateLastHandledUserGestureTimestamp(time);
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/Source/WebCore/dom/Document.h        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -1144,6 +1144,7 @@
</span><span class="cx">     void didRemoveWheelEventHandler(Node&amp;, EventHandlerRemoval = EventHandlerRemoval::One);
</span><span class="cx"> 
</span><span class="cx">     MonotonicTime lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
</span><ins>+    bool hasHadUserInteraction() const { return static_cast&lt;bool&gt;(m_lastHandledUserGestureTimestamp); }
</ins><span class="cx">     void updateLastHandledUserGestureTimestamp(MonotonicTime);
</span><span class="cx"> 
</span><span class="cx">     // Used for testing. Count handlers in the main document, and one per frame which contains handlers.
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptedAnimationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -64,10 +64,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     windowScreenDidChange(displayID);
</span><del>-
-    auto* page = document.page();
-    if (page &amp;&amp; page-&gt;isLowPowerModeEnabled())
-        addThrottlingReason(ThrottlingReason::LowPowerMode);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScriptedAnimationController::~ScriptedAnimationController()
</span><span class="lines">@@ -110,6 +106,8 @@
</span><span class="cx">         return &quot;OutsideViewport&quot;;
</span><span class="cx">     case ScriptedAnimationController::ThrottlingReason::LowPowerMode:
</span><span class="cx">         return &quot;LowPowerMode&quot;;
</span><ins>+    case ScriptedAnimationController::ThrottlingReason::NonInteractedCrossOriginFrame:
+        return &quot;NonInteractiveCrossOriginFrame&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -268,8 +266,13 @@
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_TIMER) &amp;&amp; USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx">     if (m_throttlingReasons.contains(ThrottlingReason::VisuallyIdle) || m_throttlingReasons.contains(ThrottlingReason::OutsideViewport))
</span><span class="cx">         return aggressiveThrottlingAnimationInterval;
</span><ins>+
</ins><span class="cx">     if (m_throttlingReasons.contains(ThrottlingReason::LowPowerMode))
</span><span class="cx">         return halfSpeedThrottlingAnimationInterval;
</span><ins>+
+    if (m_throttlingReasons.contains(ThrottlingReason::NonInteractedCrossOriginFrame))
+        return halfSpeedThrottlingAnimationInterval;
+
</ins><span class="cx">     ASSERT(m_throttlingReasons.isEmpty());
</span><span class="cx"> #endif
</span><span class="cx">     return fullSpeedAnimationInterval;
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptedAnimationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptedAnimationController.h        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -73,9 +73,10 @@
</span><span class="cx">     void resume();
</span><span class="cx"> 
</span><span class="cx">     enum class ThrottlingReason {
</span><del>-        VisuallyIdle    = 1 &lt;&lt; 0,
-        OutsideViewport = 1 &lt;&lt; 1,
-        LowPowerMode    = 1 &lt;&lt; 2,
</del><ins>+        VisuallyIdle                    = 1 &lt;&lt; 0,
+        OutsideViewport                 = 1 &lt;&lt; 1,
+        LowPowerMode                    = 1 &lt;&lt; 2,
+        NonInteractedCrossOriginFrame   = 1 &lt;&lt; 3,
</ins><span class="cx">     };
</span><span class="cx">     void addThrottlingReason(ThrottlingReason);
</span><span class="cx">     void removeThrottlingReason(ThrottlingReason);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (215069 => 215070)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2017-04-07 00:01:29 UTC (rev 215069)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2017-04-07 00:04:10 UTC (rev 215070)
</span><span class="lines">@@ -3036,7 +3036,7 @@
</span><span class="cx"> 
</span><span class="cx"> static bool shouldAskForNavigationConfirmation(Document&amp; document, const BeforeUnloadEvent&amp; event)
</span><span class="cx"> {
</span><del>-    bool userDidInteractWithPage = static_cast&lt;bool&gt;(document.topDocument().lastHandledUserGestureTimestamp());
</del><ins>+    bool userDidInteractWithPage = document.topDocument().hasHadUserInteraction();
</ins><span class="cx">     // Web pages can request we ask for confirmation before navigating by:
</span><span class="cx">     // - Cancelling the BeforeUnloadEvent (modern way)
</span><span class="cx">     // - Setting the returnValue attribute on the BeforeUnloadEvent to a non-empty string.
</span></span></pre>
</div>
</div>

</body>
</html>