<!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>[162107] trunk/Source</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/162107">162107</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2014-01-15 18:18:43 -0800 (Wed, 15 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Change Page, FocusController to use ViewState
https://bugs.webkit.org/show_bug.cgi?id=126533
Unreviewed rollout, this caused a regression.
Source/WebCore:
* WebCore.exp.in:
* page/FocusController.cpp:
(WebCore::FocusController::FocusController):
(WebCore::FocusController::setFocused):
(WebCore::FocusController::setActive):
(WebCore::FocusController::setContentIsVisible):
* page/FocusController.h:
(WebCore::FocusController::isActive):
(WebCore::FocusController::isFocused):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setIsInWindow):
(WebCore::Page::setIsVisuallyIdle):
(WebCore::Page::setIsVisible):
(WebCore::Page::visibilityState):
(WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
* page/Page.h:
(WebCore::Page::isVisible):
(WebCore::Page::isInWindow):
Source/WebKit2:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::setActive):
(WebKit::WebPage::setViewIsVisible):
(WebKit::WebPage::setFocused):
(WebKit::WebPage::setIsInWindow):
(WebKit::WebPage::setViewStateInternal):
(WebKit::WebPage::setIsVisuallyIdle):
* WebProcess/WebPage/WebPage.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllercpp">trunk/Source/WebCore/page/FocusController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllerh">trunk/Source/WebCore/page/FocusController.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebCore/ChangeLog        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Change Page, FocusController to use ViewState
+ https://bugs.webkit.org/show_bug.cgi?id=126533
+
+ Unreviewed rollout, this caused a regression.
+
+ * WebCore.exp.in:
+ * page/FocusController.cpp:
+ (WebCore::FocusController::FocusController):
+ (WebCore::FocusController::setFocused):
+ (WebCore::FocusController::setActive):
+ (WebCore::FocusController::setContentIsVisible):
+ * page/FocusController.h:
+ (WebCore::FocusController::isActive):
+ (WebCore::FocusController::isFocused):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ (WebCore::Page::setIsInWindow):
+ (WebCore::Page::setIsVisuallyIdle):
+ (WebCore::Page::setIsVisible):
+ (WebCore::Page::visibilityState):
+ (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
+ * page/Page.h:
+ (WebCore::Page::isVisible):
+ (WebCore::Page::isInWindow):
+
</ins><span class="cx"> 2014-01-15 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebGL] Resizing and entering/exiting full screen draws garbage
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -974,7 +974,6 @@
</span><span class="cx"> __ZN7WebCore4Page11PageClientsD1Ev
</span><span class="cx"> __ZN7WebCore4Page12setGroupNameERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore4Page12setIsVisibleEbb
</span><del>-__ZN7WebCore4Page12setViewStateEjb
</del><span class="cx"> __ZN7WebCore4Page13rangeOfStringERKN3WTF6StringEPNS_5RangeEj
</span><span class="cx"> __ZN7WebCore4Page13setIsInWindowEb
</span><span class="cx"> __ZN7WebCore4Page13setPaginationERKNS_10PaginationE
</span><span class="lines">@@ -984,6 +983,7 @@
</span><span class="cx"> __ZN7WebCore4Page16countFindMatchesERKN3WTF6StringEjj
</span><span class="cx"> __ZN7WebCore4Page16setCanStartMediaEb
</span><span class="cx"> __ZN7WebCore4Page16setDefersLoadingEb
</span><ins>+__ZN7WebCore4Page17setIsVisuallyIdleEb
</ins><span class="cx"> __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS1_12SchedulePairEEE
</span><span class="cx"> __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
</span><span class="cx"> #if ENABLE(RUBBER_BANDING)
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.cpp (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.cpp        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebCore/page/FocusController.cpp        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -158,10 +158,12 @@
</span><span class="cx"> return element.isKeyboardFocusable(&event) || isNonFocusableShadowHost(element, event);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-FocusController::FocusController(Page& page, ViewState::Flags viewState)
</del><ins>+FocusController::FocusController(Page& page)
</ins><span class="cx"> : m_page(page)
</span><ins>+ , m_isActive(false)
+ , m_isFocused(false)
</ins><span class="cx"> , m_isChangingFocusedFrame(false)
</span><del>- , m_viewState(viewState)
</del><ins>+ , m_contentIsVisible(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -203,12 +205,12 @@
</span><span class="cx">
</span><span class="cx"> void FocusController::setFocused(bool focused)
</span><span class="cx"> {
</span><del>- setViewState(focused ? m_viewState | ViewState::IsFocused : m_viewState & ~ViewState::IsFocused);
-}
</del><ins>+ if (isFocused() == focused)
+ return;
+
+ m_isFocused = focused;
</ins><span class="cx">
</span><del>-void FocusController::setFocusedInternal(bool focused)
-{
- if (!isFocused())
</del><ins>+ if (!m_isFocused)
</ins><span class="cx"> focusedOrMainFrame().eventHandler().stopAutoscrollTimer();
</span><span class="cx">
</span><span class="cx"> if (!m_focusedFrame)
</span><span class="lines">@@ -633,26 +635,13 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void FocusController::setViewState(ViewState::Flags viewState)
-{
- ViewState::Flags changed = m_viewState ^ viewState;
- m_viewState = viewState;
-
- if (changed & ViewState::IsFocused)
- setFocusedInternal(viewState & ViewState::IsFocused);
- if (changed & ViewState::WindowIsActive)
- setActiveInternal(viewState & ViewState::WindowIsActive);
- if (changed & ViewState::IsVisible)
- setContentIsVisibleInternal(viewState & ViewState::IsVisible);
-}
-
</del><span class="cx"> void FocusController::setActive(bool active)
</span><span class="cx"> {
</span><del>- setViewState(active ? m_viewState | ViewState::WindowIsActive : m_viewState & ~ViewState::WindowIsActive);
-}
</del><ins>+ if (m_isActive == active)
+ return;
</ins><span class="cx">
</span><del>-void FocusController::setActiveInternal(bool active)
-{
</del><ins>+ m_isActive = active;
+
</ins><span class="cx"> if (FrameView* view = m_page.mainFrame().view()) {
</span><span class="cx"> if (!view->platformWidget()) {
</span><span class="cx"> view->updateLayoutAndStyleIfNeededRecursive();
</span><span class="lines">@@ -676,11 +665,11 @@
</span><span class="cx">
</span><span class="cx"> void FocusController::setContentIsVisible(bool contentIsVisible)
</span><span class="cx"> {
</span><del>- setViewState(contentIsVisible ? m_viewState | ViewState::IsVisible : m_viewState & ~ViewState::IsVisible);
-}
</del><ins>+ if (m_contentIsVisible == contentIsVisible)
+ return;
</ins><span class="cx">
</span><del>-void FocusController::setContentIsVisibleInternal(bool contentIsVisible)
-{
</del><ins>+ m_contentIsVisible = contentIsVisible;
+
</ins><span class="cx"> FrameView* view = m_page.mainFrame().view();
</span><span class="cx"> if (!view)
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.h (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.h        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebCore/page/FocusController.h        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx">
</span><span class="cx"> #include "FocusDirection.h"
</span><span class="cx"> #include "LayoutRect.h"
</span><del>-#include "ViewState.h"
</del><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="lines">@@ -63,7 +62,7 @@
</span><span class="cx"> class FocusController {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- explicit FocusController(Page&, ViewState::Flags);
</del><ins>+ explicit FocusController(Page&);
</ins><span class="cx">
</span><span class="cx"> void setFocusedFrame(PassRefPtr<Frame>);
</span><span class="cx"> Frame* focusedFrame() const { return m_focusedFrame.get(); }
</span><span class="lines">@@ -74,26 +73,19 @@
</span><span class="cx">
</span><span class="cx"> bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone);
</span><span class="cx">
</span><del>- void setViewState(ViewState::Flags);
-
</del><span class="cx"> void setActive(bool);
</span><del>- bool isActive() const { return m_viewState & ViewState::WindowIsActive; }
</del><ins>+ bool isActive() const { return m_isActive; }
</ins><span class="cx">
</span><span class="cx"> void setFocused(bool);
</span><del>- bool isFocused() const { return m_viewState & ViewState::IsFocused; }
</del><ins>+ bool isFocused() const { return m_isFocused; }
</ins><span class="cx">
</span><span class="cx"> void setContentIsVisible(bool);
</span><del>- bool contentIsVisible() const { return m_viewState & ViewState::IsVisible; }
</del><span class="cx">
</span><span class="cx"> // These methods are used in WebCore/bindings/objc/DOM.mm.
</span><span class="cx"> Element* nextFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
</span><span class="cx"> Element* previousFocusableElement(FocusNavigationScope, Node* start, KeyboardEvent*);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- void setActiveInternal(bool);
- void setFocusedInternal(bool);
- void setContentIsVisibleInternal(bool);
-
</del><span class="cx"> bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*);
</span><span class="cx"> bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
</span><span class="cx">
</span><span class="lines">@@ -119,8 +111,11 @@
</span><span class="cx">
</span><span class="cx"> Page& m_page;
</span><span class="cx"> RefPtr<Frame> m_focusedFrame;
</span><ins>+ bool m_isActive;
+ bool m_isFocused;
</ins><span class="cx"> bool m_isChangingFocusedFrame;
</span><del>- ViewState::Flags m_viewState;
</del><ins>+ bool m_contentIsVisible;
+
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebCore/page/Page.cpp        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -123,15 +123,13 @@
</span><span class="cx"> return page->deviceScaleFactor();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static const ViewState::Flags PageInitialViewState = ViewState::IsVisible | ViewState::IsInWindow;
-
</del><span class="cx"> Page::Page(PageClients& pageClients)
</span><span class="cx"> : m_chrome(std::make_unique<Chrome>(*this, *pageClients.chromeClient))
</span><span class="cx"> , m_dragCaretController(std::make_unique<DragCaretController>())
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> , m_dragController(std::make_unique<DragController>(*this, *pageClients.dragClient))
</span><span class="cx"> #endif
</span><del>- , m_focusController(std::make_unique<FocusController>(*this, PageInitialViewState))
</del><ins>+ , m_focusController(std::make_unique<FocusController>(*this))
</ins><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx"> , m_contextMenuController(std::make_unique<ContextMenuController>(*this, *pageClients.contextMenuClient))
</span><span class="cx"> #endif
</span><span class="lines">@@ -173,8 +171,9 @@
</span><span class="cx"> , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval())
</span><span class="cx"> , m_timerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval())
</span><span class="cx"> , m_isEditable(false)
</span><ins>+ , m_isInWindow(true)
+ , m_isVisible(true)
</ins><span class="cx"> , m_isPrerender(false)
</span><del>- , m_viewState(PageInitialViewState)
</del><span class="cx"> , m_requestedLayoutMilestones(0)
</span><span class="cx"> , m_headerHeight(0)
</span><span class="cx"> , m_footerHeight(0)
</span><span class="lines">@@ -878,11 +877,11 @@
</span><span class="cx">
</span><span class="cx"> void Page::setIsInWindow(bool isInWindow)
</span><span class="cx"> {
</span><del>- setViewState(isInWindow ? m_viewState | ViewState::IsInWindow : m_viewState & ~ViewState::IsInWindow);
-}
</del><ins>+ if (m_isInWindow == isInWindow)
+ return;
</ins><span class="cx">
</span><del>-void Page::setIsInWindowInternal(bool isInWindow)
-{
</del><ins>+ m_isInWindow = isInWindow;
+
</ins><span class="cx"> for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
</span><span class="cx"> if (FrameView* frameView = frame->view())
</span><span class="cx"> frameView->setIsInWindow(isInWindow);
</span><span class="lines">@@ -910,7 +909,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Page::setIsVisuallyIdleInternal(bool isVisuallyIdle)
</del><ins>+void Page::setIsVisuallyIdle(bool isVisuallyIdle)
</ins><span class="cx"> {
</span><span class="cx"> m_pageThrottler->setIsVisuallyIdle(isVisuallyIdle);
</span><span class="cx"> }
</span><span class="lines">@@ -1213,37 +1212,15 @@
</span><span class="cx"> CachedImage::resumeAnimatingImagesForLoader(frame->document()->cachedResourceLoader());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void Page::setViewState(ViewState::Flags viewState, bool isInitialState)
-{
- ViewState::Flags changed = m_viewState ^ viewState;
- m_viewState = viewState;
-
- // We want to make sure to update the active state while hidden, so if the view is going
- // to be visible then update the focus controller first (it may currently still be hidden).
- if (changed && (m_viewState & ViewState::IsVisible))
- m_focusController->setViewState(viewState);
-
- if (changed & ViewState::IsVisible)
- setIsVisibleInternal(viewState & ViewState::IsVisible, isInitialState);
- if (changed & ViewState::IsInWindow)
- setIsInWindowInternal(viewState & ViewState::IsInWindow);
- if (changed & ViewState::IsVisuallyIdle)
- setIsVisuallyIdleInternal(viewState & ViewState::IsVisuallyIdle);
-
- if (changed && !(m_viewState & ViewState::IsVisible))
- m_focusController->setViewState(viewState);
-}
-
</del><span class="cx"> void Page::setIsVisible(bool isVisible, bool isInitialState)
</span><span class="cx"> {
</span><del>- setViewState(isVisible ? m_viewState | ViewState::IsVisible : m_viewState & ~ViewState::IsVisible, isInitialState);
-}
-
-void Page::setIsVisibleInternal(bool isVisible, bool isInitialState)
-{
</del><span class="cx"> // FIXME: The visibility state should be stored on the top-level document.
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=116769
</span><span class="cx">
</span><ins>+ if (m_isVisible == isVisible)
+ return;
+ m_isVisible = isVisible;
+
</ins><span class="cx"> if (isVisible) {
</span><span class="cx"> m_isPrerender = false;
</span><span class="cx">
</span><span class="lines">@@ -1305,7 +1282,7 @@
</span><span class="cx"> #if ENABLE(PAGE_VISIBILITY_API)
</span><span class="cx"> PageVisibilityState Page::visibilityState() const
</span><span class="cx"> {
</span><del>- if (isVisible())
</del><ins>+ if (m_isVisible)
</ins><span class="cx"> return PageVisibilityStateVisible;
</span><span class="cx"> if (m_isPrerender)
</span><span class="cx"> return PageVisibilityStatePrerender;
</span><span class="lines">@@ -1567,7 +1544,7 @@
</span><span class="cx"> #if (ENABLE_PAGE_VISIBILITY_API)
</span><span class="cx"> void Page::hiddenPageCSSAnimationSuspensionStateChanged()
</span><span class="cx"> {
</span><del>- if (!isVisible()) {
</del><ins>+ if (!m_isVisible) {
</ins><span class="cx"> if (m_settings->hiddenPageCSSAnimationSuspensionEnabled())
</span><span class="cx"> mainFrame().animation().suspendAnimations();
</span><span class="cx"> else
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebCore/page/Page.h        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "PlatformScreen.h"
</span><span class="cx"> #include "Region.h"
</span><span class="cx"> #include "Supplementable.h"
</span><del>-#include "ViewState.h"
</del><span class="cx"> #include "ViewportArguments.h"
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="lines">@@ -297,18 +296,18 @@
</span><span class="cx"> unsigned pageCount() const;
</span><span class="cx">
</span><span class="cx"> // Notifications when the Page starts and stops being presented via a native window.
</span><del>- void setViewState(ViewState::Flags, bool isInitial = false);
</del><span class="cx"> void setIsVisible(bool isVisible, bool isInitial);
</span><span class="cx"> void setIsPrerender();
</span><del>- bool isVisible() const { return m_viewState & ViewState::IsVisible; }
</del><ins>+ bool isVisible() const { return m_isVisible; }
</ins><span class="cx">
</span><span class="cx"> // Notification that this Page was moved into or out of a native window.
</span><span class="cx"> void setIsInWindow(bool);
</span><del>- bool isInWindow() const { return m_viewState & ViewState::IsInWindow; }
</del><ins>+ bool isInWindow() const { return m_isInWindow; }
</ins><span class="cx">
</span><span class="cx"> void suspendScriptedAnimations();
</span><span class="cx"> void resumeScriptedAnimations();
</span><span class="cx"> bool scriptedAnimationsSuspended() const { return m_scriptedAnimationsSuspended; }
</span><ins>+ void setIsVisuallyIdle(bool);
</ins><span class="cx">
</span><span class="cx"> void userStyleSheetLocationChanged();
</span><span class="cx"> const String& userStyleSheet() const;
</span><span class="lines">@@ -422,10 +421,6 @@
</span><span class="cx"> private:
</span><span class="cx"> void initGroup();
</span><span class="cx">
</span><del>- void setIsInWindowInternal(bool);
- void setIsVisibleInternal(bool isVisible, bool isInitial);
- void setIsVisuallyIdleInternal(bool);
-
</del><span class="cx"> #if ASSERT_DISABLED
</span><span class="cx"> void checkSubframeCountConsistency() const { }
</span><span class="cx"> #else
</span><span class="lines">@@ -529,8 +524,9 @@
</span><span class="cx"> double m_timerAlignmentInterval;
</span><span class="cx">
</span><span class="cx"> bool m_isEditable;
</span><ins>+ bool m_isInWindow;
+ bool m_isVisible;
</ins><span class="cx"> bool m_isPrerender;
</span><del>- ViewState::Flags m_viewState;
</del><span class="cx">
</span><span class="cx"> LayoutMilestones m_requestedLayoutMilestones;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-01-15 Gavin Barraclough <barraclough@apple.com>
+
+ Change Page, FocusController to use ViewState
+ https://bugs.webkit.org/show_bug.cgi?id=126533
+
+ Unreviewed rollout, this caused a regression.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::setActive):
+ (WebKit::WebPage::setViewIsVisible):
+ (WebKit::WebPage::setFocused):
+ (WebKit::WebPage::setIsInWindow):
+ (WebKit::WebPage::setViewStateInternal):
+ (WebKit::WebPage::setIsVisuallyIdle):
+ * WebProcess/WebPage/WebPage.h:
+
</ins><span class="cx"> 2014-01-15 Yongjun Zhang <yongjun_zhang@apple.com>
</span><span class="cx">
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=127072
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -373,9 +373,18 @@
</span><span class="cx">
</span><span class="cx"> setMemoryCacheMessagesEnabled(parameters.areMemoryCacheClientCallsEnabled);
</span><span class="cx">
</span><del>- m_page->setViewState(m_viewState, true);
- updateIsInWindow(true);
</del><ins>+ setActive(parameters.viewState & ViewState::WindowIsActive);
+ setFocused(parameters.viewState & ViewState::IsFocused);
</ins><span class="cx">
</span><ins>+ // Page defaults to in-window, but setIsInWindow depends on it being a valid indicator of actually having been put into a window.
+ bool isInWindow = parameters.viewState & ViewState::IsInWindow;
+ if (!isInWindow)
+ m_page->setIsInWindow(false);
+ else
+ WebProcess::shared().pageDidEnterWindow(m_pageID);
+
+ setIsInWindow(isInWindow);
+
</ins><span class="cx"> setMinimumLayoutSize(parameters.minimumLayoutSize);
</span><span class="cx"> setAutoSizingShouldExpandToViewHeight(parameters.autoSizingShouldExpandToViewHeight);
</span><span class="cx">
</span><span class="lines">@@ -418,6 +427,9 @@
</span><span class="cx"> if (m_useAsyncScrolling)
</span><span class="cx"> WebProcess::shared().eventDispatcher().addScrollingTreeForPage(this);
</span><span class="cx"> #endif
</span><ins>+
+ m_page->setIsVisible(m_viewState & ViewState::IsVisible, true);
+ setIsVisuallyIdle(m_viewState & ViewState::IsVisuallyIdle);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPage::reinitializeWebPage(const WebPageCreationParameters& parameters)
</span><span class="lines">@@ -1900,6 +1912,18 @@
</span><span class="cx"> m_findController.showFindIndicatorInSelection();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebPage::setActive(bool isActive)
+{
+ m_page->focusController().setActive(isActive);
+}
+
+void WebPage::setViewIsVisible(bool isVisible)
+{
+ corePage()->focusController().setContentIsVisible(isVisible);
+
+ m_page->setIsVisible(m_viewState & ViewState::IsVisible, false);
+}
+
</ins><span class="cx"> void WebPage::setDrawsBackground(bool drawsBackground)
</span><span class="cx"> {
</span><span class="cx"> if (m_drawsBackground == drawsBackground)
</span><span class="lines">@@ -1955,6 +1979,11 @@
</span><span class="cx"> view->willEndLiveResize();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebPage::setFocused(bool isFocused)
+{
+ m_page->focusController().setFocused(isFocused);
+}
+
</ins><span class="cx"> void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event)
</span><span class="cx"> {
</span><span class="cx"> if (!m_page)
</span><span class="lines">@@ -2009,16 +2038,15 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPage::updateIsInWindow(bool isInitialState)
</del><ins>+void WebPage::setIsInWindow(bool isInWindow)
</ins><span class="cx"> {
</span><del>- bool isInWindow = m_viewState & WebCore::ViewState::IsInWindow;
-
</del><ins>+ bool pageWasInWindow = m_page->isInWindow();
+
</ins><span class="cx"> if (!isInWindow) {
</span><span class="cx"> m_setCanStartMediaTimer.stop();
</span><span class="cx"> m_page->setCanStartMedia(false);
</span><span class="cx">
</span><del>- // The WebProcess does not yet know about this page; no need to tell it we're leaving the window.
- if (!isInitialState)
</del><ins>+ if (pageWasInWindow)
</ins><span class="cx"> WebProcess::shared().pageWillLeaveWindow(m_pageID);
</span><span class="cx"> } else {
</span><span class="cx"> // Defer the call to Page::setCanStartMedia() since it ends up sending a synchronous message to the UI process
</span><span class="lines">@@ -2027,9 +2055,12 @@
</span><span class="cx"> if (m_mayStartMediaWhenInWindow)
</span><span class="cx"> m_setCanStartMediaTimer.startOneShot(0);
</span><span class="cx">
</span><del>- WebProcess::shared().pageDidEnterWindow(m_pageID);
</del><ins>+ if (!pageWasInWindow)
+ WebProcess::shared().pageDidEnterWindow(m_pageID);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ m_page->setIsInWindow(isInWindow);
+
</ins><span class="cx"> if (isInWindow)
</span><span class="cx"> layoutIfNeeded();
</span><span class="cx"> }
</span><span class="lines">@@ -2048,12 +2079,24 @@
</span><span class="cx"> m_viewState = viewState;
</span><span class="cx">
</span><span class="cx"> m_drawingArea->viewStateDidChange(changed);
</span><del>- m_page->setViewState(viewState, isInitialState);
</del><ins>+
+ // We want to make sure to update the active state while hidden, so if the view is hidden then update the active state
+ // early (in case it becomes visible), and if the view was visible then update active state later (in case it hides).
+ if (changed & ViewState::IsFocused)
+ setFocused(viewState & ViewState::IsFocused);
+ if (changed & ViewState::WindowIsActive && !(m_viewState & ViewState::IsVisible))
+ setActive(viewState & ViewState::WindowIsActive);
+ if (changed & ViewState::IsVisible)
+ setViewIsVisible(viewState & ViewState::IsVisible);
+ if (changed & ViewState::WindowIsActive && m_viewState & ViewState::IsVisible)
+ setActive(viewState & ViewState::WindowIsActive);
+ if (changed & ViewState::IsInWindow)
+ setIsInWindow(viewState & ViewState::IsInWindow);
+ if (changed & ViewState::IsVisuallyIdle)
+ setIsVisuallyIdle(viewState & ViewState::IsVisuallyIdle);
+
</ins><span class="cx"> for (auto* pluginView : m_pluginViews)
</span><span class="cx"> pluginView->viewStateDidChange(changed);
</span><del>-
- if (changed & ViewState::IsInWindow)
- updateIsInWindow();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPage::setLayerHostingMode(unsigned layerHostingMode)
</span><span class="lines">@@ -3657,6 +3700,11 @@
</span><span class="cx"> m_page->setIsPrerender();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebPage::setIsVisuallyIdle(bool isVisuallyIdle)
+{
+ m_page->setIsVisuallyIdle(isVisuallyIdle);
+}
+
</ins><span class="cx"> void WebPage::setScrollingPerformanceLoggingEnabled(bool enabled)
</span><span class="cx"> {
</span><span class="cx"> m_scrollingPerformanceLoggingEnabled = enabled;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (162106 => 162107)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-16 02:04:25 UTC (rev 162106)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-16 02:18:43 UTC (rev 162107)
</span><span class="lines">@@ -733,7 +733,8 @@
</span><span class="cx"> void setViewIsVisible(bool);
</span><span class="cx"> void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
</span><span class="cx"> void setWindowResizerSize(const WebCore::IntSize&);
</span><del>- void updateIsInWindow(bool isInitialState = false);
</del><ins>+ void setIsInWindow(bool);
+ void setIsVisuallyIdle(bool);
</ins><span class="cx"> void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState);
</span><span class="cx"> void setViewStateInternal(WebCore::ViewState::Flags, bool isInitialState);
</span><span class="cx"> void validateCommand(const String&, uint64_t);
</span></span></pre>
</div>
</div>
</body>
</html>