<!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>[193884] trunk/Source/WebCore</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/193884">193884</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-12-09 18:51:11 -0800 (Wed, 09 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unify iOS Frame::setTimersPaused() logic and Frame::{suspend, resume}ActiveDOMObjectsAndAnimations()
https://bugs.webkit.org/show_bug.cgi?id=152006
Reviewed by Simon Fraser.
Currently we have almost identical logic to suspend and resume a web page for iOS and non-iOS ports.
We should unify this logic instead of duplicating it.
* dom/ActiveDOMObject.h: Remove iOS-specific enumeration DocumentWillBePaused and standardize on
enumerator PageWillBeSuspended.
* dom/Document.cpp:
(WebCore::Document::didBecomeCurrentDocumentInFrame): Unify iOS and non-iOS-specific code.
(WebCore::Document::suspendScheduledTasks): Ignore subsequent calls to this function so long as the reason for
the first invocation was ActiveDOMObject::PageWillBeSuspended. Such a subsequent call may occur as part of
handling a scroll or zoom gesture.
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::suspendActiveDOMObjects): Ignore subsequent calls to this function
so long as the reason for the first invocation was ActiveDOMObject::PageWillBeSuspended. Such a subsequent
call may occur as part of the process of a page being added to the page cache.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::suspend): Remove case for ActiveDOMObject::DocumentWillBePaused as this
enumerator is being removed.
* page/DOMTimer.cpp:
(WebCore::DOMTimer::install): Write logic that used Frame::timersPaused() terms of
ScriptExecutionContext::activeDOMObjectsAreSuspended() as we are removing Frame::timersPaused().
(WebCore::DOMTimer::fired): Remove iOS-specific assertion with respect to Frame::timersPaused().
This function already asserts the equivalent condition that ScriptExecutionContext::activeDOMObjectsAreSuspended()
evaluates to false. Clean up iOS-specific code that depends on the ScriptExecutionContext being a
Document object by taking advantage of the fact that this assumption is true when shouldBeginObservingChanges
evaluates to true.
* page/Frame.cpp:
(WebCore::Frame::Frame): Remove instance variable m_timersPausedCount and unify the iOS and non-iOS logic.
(WebCore::Frame::suspendActiveDOMObjectsAndAnimations): Standardize on the iOS logic for suspending
DOM objects and animations because it is more comprehensive on what it suspends and works with the deferred
loading machinery (Page::setDefersLoading() - see remarks in Frame::resumeActiveDOMObjectsAndAnimations() for
more details). Specifically, make use of Frame::clearTimers() to suspend non-scripted animations (i.e. non-requestAnimationFrame()
animations), auto-scroll timer, and pending relayouts. And use Document::suspendScheduledTasks() to suspend
all other tasks, including WebSQL database callbacks, active DOM objects, scripted animations and execution of
<script async>/<script defer> JavaScript scripts.
(WebCore::Frame::resumeActiveDOMObjectsAndAnimations): Standardize on the iOS logic for resuming
DOM objects and animations for symmetry and because it works with the deferred loading machinery. We call
Document::resumeScheduledTasks() (which calls Document::resumeActiveDOMObjects()) instead of calling
Document::resumeActiveDOMObjects() directly because the former will ultimately process the queue of pending
tasks (Document::m_pendingTasks).
* page/Frame.h: Remove instance variable m_timersPausedCount.
(WebCore::Frame::timersPaused): Deleted.
* page/ios/FrameIOS.mm:
(WebCore::Frame::setTimersPaused): Write this function in terms of Page::{suspend, resume}ActiveDOMObjectsAndAnimations().
We need to keep this function for Legacy WebKit on iOS.
(WebCore::Frame::setTimersPausedInternal): Deleted.
* rendering/RenderElement.cpp:
(WebCore::shouldRepaintForImageAnimation): Remove iOS-specific code to early return when Frame::timersPaused()
evaluates to true. This function already has the equivalent code to early return when Document::activeDOMObjectsAreSuspended()
evaluates to true.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomActiveDOMObjecth">trunk/Source/WebCore/dom/ActiveDOMObject.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomScriptExecutionContextcpp">trunk/Source/WebCore/dom/ScriptExecutionContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMTimercpp">trunk/Source/WebCore/page/DOMTimer.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFramecpp">trunk/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameh">trunk/Source/WebCore/page/Frame.h</a></li>
<li><a href="#trunkSourceWebCorepageiosFrameIOSmm">trunk/Source/WebCore/page/ios/FrameIOS.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/ChangeLog        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2015-12-09 Daniel Bates <dabates@apple.com>
+
+ Unify iOS Frame::setTimersPaused() logic and Frame::{suspend, resume}ActiveDOMObjectsAndAnimations()
+ https://bugs.webkit.org/show_bug.cgi?id=152006
+
+ Reviewed by Simon Fraser.
+
+ Currently we have almost identical logic to suspend and resume a web page for iOS and non-iOS ports.
+ We should unify this logic instead of duplicating it.
+
+ * dom/ActiveDOMObject.h: Remove iOS-specific enumeration DocumentWillBePaused and standardize on
+ enumerator PageWillBeSuspended.
+ * dom/Document.cpp:
+ (WebCore::Document::didBecomeCurrentDocumentInFrame): Unify iOS and non-iOS-specific code.
+ (WebCore::Document::suspendScheduledTasks): Ignore subsequent calls to this function so long as the reason for
+ the first invocation was ActiveDOMObject::PageWillBeSuspended. Such a subsequent call may occur as part of
+ handling a scroll or zoom gesture.
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): Ignore subsequent calls to this function
+ so long as the reason for the first invocation was ActiveDOMObject::PageWillBeSuspended. Such a subsequent
+ call may occur as part of the process of a page being added to the page cache.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::suspend): Remove case for ActiveDOMObject::DocumentWillBePaused as this
+ enumerator is being removed.
+ * page/DOMTimer.cpp:
+ (WebCore::DOMTimer::install): Write logic that used Frame::timersPaused() terms of
+ ScriptExecutionContext::activeDOMObjectsAreSuspended() as we are removing Frame::timersPaused().
+ (WebCore::DOMTimer::fired): Remove iOS-specific assertion with respect to Frame::timersPaused().
+ This function already asserts the equivalent condition that ScriptExecutionContext::activeDOMObjectsAreSuspended()
+ evaluates to false. Clean up iOS-specific code that depends on the ScriptExecutionContext being a
+ Document object by taking advantage of the fact that this assumption is true when shouldBeginObservingChanges
+ evaluates to true.
+ * page/Frame.cpp:
+ (WebCore::Frame::Frame): Remove instance variable m_timersPausedCount and unify the iOS and non-iOS logic.
+ (WebCore::Frame::suspendActiveDOMObjectsAndAnimations): Standardize on the iOS logic for suspending
+ DOM objects and animations because it is more comprehensive on what it suspends and works with the deferred
+ loading machinery (Page::setDefersLoading() - see remarks in Frame::resumeActiveDOMObjectsAndAnimations() for
+ more details). Specifically, make use of Frame::clearTimers() to suspend non-scripted animations (i.e. non-requestAnimationFrame()
+ animations), auto-scroll timer, and pending relayouts. And use Document::suspendScheduledTasks() to suspend
+ all other tasks, including WebSQL database callbacks, active DOM objects, scripted animations and execution of
+ <script async>/<script defer> JavaScript scripts.
+ (WebCore::Frame::resumeActiveDOMObjectsAndAnimations): Standardize on the iOS logic for resuming
+ DOM objects and animations for symmetry and because it works with the deferred loading machinery. We call
+ Document::resumeScheduledTasks() (which calls Document::resumeActiveDOMObjects()) instead of calling
+ Document::resumeActiveDOMObjects() directly because the former will ultimately process the queue of pending
+ tasks (Document::m_pendingTasks).
+ * page/Frame.h: Remove instance variable m_timersPausedCount.
+ (WebCore::Frame::timersPaused): Deleted.
+ * page/ios/FrameIOS.mm:
+ (WebCore::Frame::setTimersPaused): Write this function in terms of Page::{suspend, resume}ActiveDOMObjectsAndAnimations().
+ We need to keep this function for Legacy WebKit on iOS.
+ (WebCore::Frame::setTimersPausedInternal): Deleted.
+ * rendering/RenderElement.cpp:
+ (WebCore::shouldRepaintForImageAnimation): Remove iOS-specific code to early return when Frame::timersPaused()
+ evaluates to true. This function already has the equivalent code to early return when Document::activeDOMObjectsAreSuspended()
+ evaluates to true.
+
</ins><span class="cx"> 2015-12-09 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Modern IDB: storage/indexeddb/metadata.html fails
</span></span></pre></div>
<a id="trunkSourceWebCoredomActiveDOMObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ActiveDOMObject.h (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ActiveDOMObject.h        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/dom/ActiveDOMObject.h        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -55,7 +55,6 @@
</span><span class="cx"> WillDeferLoading,
</span><span class="cx"> PageCache,
</span><span class="cx"> PageWillBeSuspended,
</span><del>- DocumentWillBePaused
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> virtual const char* activeDOMObjectName() const = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -2207,21 +2207,15 @@
</span><span class="cx"> page()->chrome().client().needTouchEvents(true);
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
- // Ensure that document scheduled task state matches frame timer state. It can be out of sync
- // if timers state changed while the document was not in the frame (possibly in page cache,
- // or simply newly created).
- // FIXME: How does this interact with cross-platform code below?
- if (m_frame->timersPaused())
- suspendScheduledTasks(ActiveDOMObject::DocumentWillBePaused);
- else
- resumeScheduledTasks(ActiveDOMObject::DocumentWillBePaused);
-#endif
-
</del><ins>+ // Ensure that the scheduled task state of the document matches the DOM suspension state of the frame. It can
+ // be out of sync if the DOM suspension state changed while the document was not in the frame (possibly in the
+ // page cache, or simply newly created).
</ins><span class="cx"> if (m_frame->activeDOMObjectsAndAnimationsSuspended()) {
</span><del>- suspendScriptedAnimationControllerCallbacks();
</del><span class="cx"> m_frame->animation().suspendAnimationsForDocument(this);
</span><del>- suspendActiveDOMObjects(ActiveDOMObject::PageWillBeSuspended);
</del><ins>+ suspendScheduledTasks(ActiveDOMObject::PageWillBeSuspended);
+ } else {
+ resumeScheduledTasks(ActiveDOMObject::PageWillBeSuspended);
+ m_frame->animation().resumeAnimationsForDocument(this);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -5267,15 +5261,14 @@
</span><span class="cx">
</span><span class="cx"> void Document::suspendScheduledTasks(ActiveDOMObject::ReasonForSuspension reason)
</span><span class="cx"> {
</span><del>-#if PLATFORM(IOS)
</del><span class="cx"> if (m_scheduledTasksAreSuspended) {
</span><del>- ASSERT(reasonForSuspendingActiveDOMObjects() == ActiveDOMObject::DocumentWillBePaused);
</del><ins>+ // A page may subsequently suspend DOM objects, say as part of handling a scroll or zoom gesture, after the
+ // embedding client requested the page be suspended. We ignore such requests so long as the embedding client
+ // requested the suspension first. See <rdar://problem/13754896> for more details.
+ ASSERT(reasonForSuspendingActiveDOMObjects() == ActiveDOMObject::PageWillBeSuspended);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx">
</span><del>- ASSERT(!m_scheduledTasksAreSuspended);
-
</del><span class="cx"> suspendScriptedAnimationControllerCallbacks();
</span><span class="cx"> suspendActiveDOMObjects(reason);
</span><span class="cx"> scriptRunner()->suspend();
</span></span></pre></div>
<a id="trunkSourceWebCoredomScriptExecutionContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -214,12 +214,13 @@
</span><span class="cx"> {
</span><span class="cx"> checkConsistency();
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
</del><span class="cx"> if (m_activeDOMObjectsAreSuspended) {
</span><del>- ASSERT(m_reasonForSuspendingActiveDOMObjects == ActiveDOMObject::DocumentWillBePaused);
</del><ins>+ // A page may subsequently suspend DOM objects, say as part of entering the page cache, after the embedding
+ // client requested the page be suspended. We ignore such requests so long as the embedding client requested
+ // the suspension first. See <rdar://problem/13754896> for more details.
+ ASSERT(m_reasonForSuspendingActiveDOMObjects == ActiveDOMObject::PageWillBeSuspended);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> m_activeDOMObjectAdditionForbidden = true;
</span><span class="cx"> #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -5049,7 +5049,6 @@
</span><span class="cx"> setShouldBufferData(false);
</span><span class="cx"> m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePageConsentToResumeMedia);
</span><span class="cx"> break;
</span><del>- case DocumentWillBePaused:
</del><span class="cx"> case JavaScriptDebuggerPaused:
</span><span class="cx"> case PageWillBeSuspended:
</span><span class="cx"> case WillDeferLoading:
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMTimercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMTimer.cpp (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMTimer.cpp        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/page/DOMTimer.cpp        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -202,8 +202,7 @@
</span><span class="cx"> DOMTimer* timer = new DOMTimer(context, WTF::move(action), timeout, singleShot);
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> if (is<Document>(context)) {
</span><del>- Document& document = downcast<Document>(context);
- bool didDeferTimeout = document.frame() && document.frame()->timersPaused();
</del><ins>+ bool didDeferTimeout = context.activeDOMObjectsAreSuspended();
</ins><span class="cx"> if (!didDeferTimeout && timeout <= 100 && singleShot) {
</span><span class="cx"> WKSetObservedContentChange(WKContentIndeterminateChange);
</span><span class="cx"> WebThreadAddObservedContentModifier(timer); // Will only take affect if not already visibility change.
</span><span class="lines">@@ -297,13 +296,6 @@
</span><span class="cx">
</span><span class="cx"> DOMTimerFireState fireState(context);
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
- Document* document = nullptr;
- if (is<Document>(context)) {
- document = &downcast<Document>(context);
- ASSERT(!document->frame()->timersPaused());
- }
-#endif
</del><span class="cx"> context.setTimerNestingLevel(std::min(m_nestingLevel + 1, maxTimerNestingLevel));
</span><span class="cx">
</span><span class="cx"> ASSERT(!isSuspended());
</span><span class="lines">@@ -334,7 +326,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> bool shouldReportLackOfChanges;
</span><span class="cx"> bool shouldBeginObservingChanges;
</span><del>- if (document) {
</del><ins>+ if (is<Document>(context)) {
</ins><span class="cx"> shouldReportLackOfChanges = WebThreadCountOfObservedContentModifiers() == 1;
</span><span class="cx"> shouldBeginObservingChanges = WebThreadContainsObservedContentModifier(this);
</span><span class="cx"> } else {
</span><span class="lines">@@ -359,9 +351,11 @@
</span><span class="cx"> if (shouldBeginObservingChanges) {
</span><span class="cx"> WKStopObservingContentChanges();
</span><span class="cx">
</span><del>- if (WKObservedContentChange() == WKContentVisibilityChange || shouldReportLackOfChanges)
- if (document && document->page())
- document->page()->chrome().client().observedContentChange(document->frame());
</del><ins>+ if (WKObservedContentChange() == WKContentVisibilityChange || shouldReportLackOfChanges) {
+ Document& document = downcast<Document>(context);
+ if (Page* page = document.page())
+ page->chrome().client().observedContentChange(document.frame());
+ }
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.cpp (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.cpp        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/page/Frame.cpp        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -165,7 +165,6 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> , m_overflowAutoScrollTimer(*this, &Frame::overflowAutoScrollTimerFired)
</span><span class="cx"> , m_selectionChangeCallbacksDisabled(false)
</span><del>- , m_timersPausedCount(0)
</del><span class="cx"> #endif
</span><span class="cx"> , m_pageZoomFactor(parentPageZoomFactor(this))
</span><span class="cx"> , m_textZoomFactor(parentTextZoomFactor(this))
</span><span class="lines">@@ -192,17 +191,10 @@
</span><span class="cx"> frameCounter.increment();
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- // FIXME: We should reconcile the iOS and OpenSource code below.
- Frame* parent = parentFromOwnerElement(ownerElement);
-#if PLATFORM(IOS)
- // Pause future timers if this frame is created when page is in pending state.
- if (parent && parent->timersPaused())
- setTimersPaused(true);
-#else
</del><span class="cx"> // Pause future ActiveDOMObjects if this frame is being created while the page is in a paused state.
</span><ins>+ Frame* parent = parentFromOwnerElement(ownerElement);
</ins><span class="cx"> if (parent && parent->activeDOMObjectsAndAnimationsSuspended())
</span><span class="cx"> suspendActiveDOMObjectsAndAnimations();
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Ref<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
</span><span class="lines">@@ -1012,27 +1004,31 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // FIXME: Suspend/resume calls will not match if the frame is navigated, and gets a new document.
</span><del>- if (document()) {
- document()->suspendScriptedAnimationControllerCallbacks();
- animation().suspendAnimationsForDocument(document());
- document()->suspendActiveDOMObjects(ActiveDOMObject::PageWillBeSuspended);
- }
</del><ins>+ clearTimers(); // Suspends animations and pending relayouts.
+ if (m_doc)
+ m_doc->suspendScheduledTasks(ActiveDOMObject::PageWillBeSuspended);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Frame::resumeActiveDOMObjectsAndAnimations()
</span><span class="cx"> {
</span><del>- ASSERT(activeDOMObjectsAndAnimationsSuspended());
</del><ins>+ if (!activeDOMObjectsAndAnimationsSuspended())
+ return;
</ins><span class="cx">
</span><span class="cx"> m_activeDOMObjectsAndAnimationsSuspendedCount--;
</span><span class="cx">
</span><span class="cx"> if (activeDOMObjectsAndAnimationsSuspended())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (document()) {
- document()->resumeActiveDOMObjects(ActiveDOMObject::PageWillBeSuspended);
- animation().resumeAnimationsForDocument(document());
- document()->resumeScriptedAnimationControllerCallbacks();
- }
</del><ins>+ if (!m_doc)
+ return;
+
+ // FIXME: Suspend/resume calls will not match if the frame is navigated, and gets a new document.
+ m_doc->resumeScheduledTasks(ActiveDOMObject::PageWillBeSuspended);
+
+ // Frame::clearTimers() suspended animations and pending relayouts.
+ animation().resumeAnimationsForDocument(m_doc.get());
+ if (m_view)
+ m_view->scheduleRelayout();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Frame::deviceOrPageScaleFactorChanged()
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.h (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.h        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/page/Frame.h        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -242,8 +242,10 @@
</span><span class="cx"> WEBCORE_EXPORT NSRect rectForScrollToVisible() const;
</span><span class="cx"> WEBCORE_EXPORT DOMCSSStyleDeclaration* styleAtSelectionStart() const;
</span><span class="cx"> WEBCORE_EXPORT unsigned formElementsCharacterCount() const;
</span><ins>+
+ // This function is used by Legacy WebKit.
</ins><span class="cx"> WEBCORE_EXPORT void setTimersPaused(bool);
</span><del>- bool timersPaused() const { return m_timersPausedCount; }
</del><ins>+
</ins><span class="cx"> WEBCORE_EXPORT void dispatchPageHideEventBeforePause();
</span><span class="cx"> WEBCORE_EXPORT void dispatchPageShowEventBeforeResume();
</span><span class="cx"> WEBCORE_EXPORT void setRangedSelectionBaseToCurrentSelection();
</span><span class="lines">@@ -306,7 +308,6 @@
</span><span class="cx"> IntPoint m_overflowAutoScrollPos;
</span><span class="cx"> ViewportArguments m_viewportArguments;
</span><span class="cx"> bool m_selectionChangeCallbacksDisabled;
</span><del>- int m_timersPausedCount;
</del><span class="cx"> VisibleSelection m_rangedSelectionBase;
</span><span class="cx"> VisibleSelection m_rangedSelectionInitialExtent;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorepageiosFrameIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ios/FrameIOS.mm        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -623,39 +623,15 @@
</span><span class="cx">
</span><span class="cx"> void Frame::setTimersPaused(bool paused)
</span><span class="cx"> {
</span><ins>+ if (!m_page)
+ return;
</ins><span class="cx"> JSLockHolder lock(JSDOMWindowBase::commonVM());
</span><del>- setTimersPausedInternal(paused);
</del><ins>+ if (paused)
+ m_page->suspendActiveDOMObjectsAndAnimations();
+ else
+ m_page->resumeActiveDOMObjectsAndAnimations();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void Frame::setTimersPausedInternal(bool paused)
-{
- if (paused) {
- ++m_timersPausedCount;
- if (m_timersPausedCount == 1) {
- clearTimers();
- if (document())
- document()->suspendScheduledTasks(ActiveDOMObject::DocumentWillBePaused);
- }
- } else {
- --m_timersPausedCount;
- ASSERT(m_timersPausedCount >= 0);
- if (m_timersPausedCount == 0) {
- if (document())
- document()->resumeScheduledTasks(ActiveDOMObject::DocumentWillBePaused);
-
- // clearTimers() suspended animations and pending relayouts, reschedule if needed.
- animation().resumeAnimationsForDocument(document());
-
- if (view())
- view()->scheduleRelayout();
- }
- }
-
- // We need to make sure all subframes' states are up to date.
- for (Frame* frame = tree().firstChild(); frame; frame = frame->tree().nextSibling())
- frame->setTimersPausedInternal(paused);
-}
-
</del><span class="cx"> void Frame::dispatchPageHideEventBeforePause()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainFrame());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (193883 => 193884)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2015-12-10 02:50:31 UTC (rev 193883)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2015-12-10 02:51:11 UTC (rev 193884)
</span><span class="lines">@@ -1435,10 +1435,6 @@
</span><span class="cx"> const Document& document = renderer.document();
</span><span class="cx"> if (document.inPageCache())
</span><span class="cx"> return false;
</span><del>-#if PLATFORM(IOS)
- if (document.frame()->timersPaused())
- return false;
-#endif
</del><span class="cx"> if (document.activeDOMObjectsAreSuspended())
</span><span class="cx"> return false;
</span><span class="cx"> if (renderer.style().visibility() != VISIBLE)
</span></span></pre>
</div>
</div>
</body>
</html>