<!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>[169439] trunk/Source/WebKit2</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/169439">169439</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2014-05-28 18:41:22 -0700 (Wed, 28 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>viewStateDidChange should always fully update ViewState
https://bugs.webkit.org/show_bug.cgi?id=133159

Reviewed by Anders Carlson.

Currently WebPageProxy::viewStateDidChange is passed a mask of bits to update.

This has the following negative consequences:
 – WKWebView implicitly requires more detailed knowledge of the internal implementation of the PageClient.
 – Updates may unnecessarily be split over multiple IPC messages.
 – In order to support partial updates we make multiple virtual function calls to PageClient, which then makes duplicate objc calls.

Better to just always update the entire ViewState.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView didMoveToWindow]):
    - removed argument to viewStateDidChange.
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::viewState):
(WebKit::PageClientImpl::isViewWindowActive): Deleted.
(WebKit::PageClientImpl::isViewFocused): Deleted.
(WebKit::PageClientImpl::isViewVisible): Deleted.
(WebKit::PageClientImpl::isViewInWindow): Deleted.
* UIProcess/API/gtk/PageClientImpl.h:
    - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
* UIProcess/API/mac/WKView.mm:
(-[WKView becomeFirstResponder]):
(-[WKView resignFirstResponder]):
(-[WKView viewDidMoveToWindow]):
(-[WKView _windowDidBecomeKey:]):
(-[WKView _windowDidResignKey:]):
(-[WKView _windowDidMiniaturize:]):
(-[WKView _windowDidDeminiaturize:]):
(-[WKView _windowDidOrderOffScreen:]):
(-[WKView _windowDidOrderOnScreen:]):
(-[WKView _windowDidChangeOcclusionState:]):
(-[WKView viewDidHide]):
(-[WKView viewDidUnhide]):
(-[WKView _activeSpaceDidChange:]):
(-[WKView _setThumbnailView:]):
(-[WKView endDeferringViewInWindowChanges]):
(-[WKView endDeferringViewInWindowChangesSync]):
    - removed argument to viewStateDidChange.
* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::viewState):
(WebKit::WebView::isViewWindowActive): Deleted.
(WebKit::WebView::isViewFocused): Deleted.
(WebKit::WebView::isViewVisible): Deleted.
(WebKit::WebView::isViewInWindow): Deleted.
* UIProcess/CoordinatedGraphics/WebView.h:
    - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
* UIProcess/PageClient.h:
(WebKit::PageClient::isViewVisibleOrOccluded): Deleted.
(WebKit::PageClient::isVisuallyIdle): Deleted.
    - merged isViewVisibleOrOccluded/isVisuallyIdle to subclass viewState methods.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::reattachToWebProcess):
    - updateViewState -&gt; PageClient::viewState
(WebKit::WebPageProxy::viewStateDidChange):
    - argument removed; updateViewState -&gt; PageClient::viewState.
(WebKit::WebPageProxy::setCursor):
    - call isViewWindowActive on WebPageProxy, rather than PageClient.
(WebKit::WebPageProxy::updateBackingStoreDiscardableState):
    - call isViewWindowActive on WebPageProxy, rather than PageClient.
(WebKit::WebPageProxy::updateViewState): Deleted.
    - removed - viewState method moved to PageClient.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isViewWindowActive):
    - added missing implementation.
(WebKit::WebPageProxy::isViewVisible):
    - removed argument to viewStateDidChange.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::windowServerConnectionStateChanged):
    - removed argument to viewStateDidChange.
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::viewState):
(WebKit::PageClientImpl::isViewWindowActive): Deleted.
(WebKit::PageClientImpl::isViewFocused): Deleted.
(WebKit::PageClientImpl::isViewVisible): Deleted.
(WebKit::PageClientImpl::isViewInWindow): Deleted.
(WebKit::PageClientImpl::isViewVisibleOrOccluded): Deleted.
(WebKit::PageClientImpl::isVisuallyIdle): Deleted.
    - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didMoveToWindow]):
(-[WKContentView _applicationDidEnterBackground:]):
(-[WKContentView _applicationWillEnterForeground:]):
    - removed argument to viewStateDidChange.
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::viewState):
(WebKit::PageClientImpl::showCorrectionPanel):
(WebKit::PageClientImpl::showDictationAlternativeUI):
(WebKit::PageClientImpl::isViewWindowActive): Deleted.
(WebKit::PageClientImpl::isViewFocused): Deleted.
(WebKit::PageClientImpl::isViewVisibleOrOccluded): Deleted.
(WebKit::PageClientImpl::isVisuallyIdle): Deleted.
    - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkPageClientImplcpp">trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkPageClientImplh">trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsWebViewcpp">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsWebViewh">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -1,3 +1,106 @@
</span><ins>+2014-05-28  Gavin Barraclough  &lt;baraclough@apple.com&gt;
+
+        viewStateDidChange should always fully update ViewState
+        https://bugs.webkit.org/show_bug.cgi?id=133159
+
+        Reviewed by Anders Carlson.
+
+        Currently WebPageProxy::viewStateDidChange is passed a mask of bits to update.
+
+        This has the following negative consequences:
+         – WKWebView implicitly requires more detailed knowledge of the internal implementation of the PageClient.
+         – Updates may unnecessarily be split over multiple IPC messages.
+         – In order to support partial updates we make multiple virtual function calls to PageClient, which then makes duplicate objc calls.
+
+        Better to just always update the entire ViewState.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView didMoveToWindow]):
+            - removed argument to viewStateDidChange.
+        * UIProcess/API/gtk/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::viewState):
+        (WebKit::PageClientImpl::isViewWindowActive): Deleted.
+        (WebKit::PageClientImpl::isViewFocused): Deleted.
+        (WebKit::PageClientImpl::isViewVisible): Deleted.
+        (WebKit::PageClientImpl::isViewInWindow): Deleted.
+        * UIProcess/API/gtk/PageClientImpl.h:
+            - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView becomeFirstResponder]):
+        (-[WKView resignFirstResponder]):
+        (-[WKView viewDidMoveToWindow]):
+        (-[WKView _windowDidBecomeKey:]):
+        (-[WKView _windowDidResignKey:]):
+        (-[WKView _windowDidMiniaturize:]):
+        (-[WKView _windowDidDeminiaturize:]):
+        (-[WKView _windowDidOrderOffScreen:]):
+        (-[WKView _windowDidOrderOnScreen:]):
+        (-[WKView _windowDidChangeOcclusionState:]):
+        (-[WKView viewDidHide]):
+        (-[WKView viewDidUnhide]):
+        (-[WKView _activeSpaceDidChange:]):
+        (-[WKView _setThumbnailView:]):
+        (-[WKView endDeferringViewInWindowChanges]):
+        (-[WKView endDeferringViewInWindowChangesSync]):
+            - removed argument to viewStateDidChange.
+        * UIProcess/CoordinatedGraphics/WebView.cpp:
+        (WebKit::WebView::viewState):
+        (WebKit::WebView::isViewWindowActive): Deleted.
+        (WebKit::WebView::isViewFocused): Deleted.
+        (WebKit::WebView::isViewVisible): Deleted.
+        (WebKit::WebView::isViewInWindow): Deleted.
+        * UIProcess/CoordinatedGraphics/WebView.h:
+            - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
+        * UIProcess/PageClient.h:
+        (WebKit::PageClient::isViewVisibleOrOccluded): Deleted.
+        (WebKit::PageClient::isVisuallyIdle): Deleted.
+            - merged isViewVisibleOrOccluded/isVisuallyIdle to subclass viewState methods.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::reattachToWebProcess):
+            - updateViewState -&gt; PageClient::viewState
+        (WebKit::WebPageProxy::viewStateDidChange):
+            - argument removed; updateViewState -&gt; PageClient::viewState.
+        (WebKit::WebPageProxy::setCursor):
+            - call isViewWindowActive on WebPageProxy, rather than PageClient.
+        (WebKit::WebPageProxy::updateBackingStoreDiscardableState):
+            - call isViewWindowActive on WebPageProxy, rather than PageClient.
+        (WebKit::WebPageProxy::updateViewState): Deleted.
+            - removed - viewState method moved to PageClient.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isViewWindowActive):
+            - added missing implementation.
+        (WebKit::WebPageProxy::isViewVisible):
+            - removed argument to viewStateDidChange.
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::windowServerConnectionStateChanged):
+            - removed argument to viewStateDidChange.
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::viewState):
+        (WebKit::PageClientImpl::isViewWindowActive): Deleted.
+        (WebKit::PageClientImpl::isViewFocused): Deleted.
+        (WebKit::PageClientImpl::isViewVisible): Deleted.
+        (WebKit::PageClientImpl::isViewInWindow): Deleted.
+        (WebKit::PageClientImpl::isViewVisibleOrOccluded): Deleted.
+        (WebKit::PageClientImpl::isVisuallyIdle): Deleted.
+            - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didMoveToWindow]):
+        (-[WKContentView _applicationDidEnterBackground:]):
+        (-[WKContentView _applicationWillEnterForeground:]):
+            - removed argument to viewStateDidChange.
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::viewState):
+        (WebKit::PageClientImpl::showCorrectionPanel):
+        (WebKit::PageClientImpl::showDictationAlternativeUI):
+        (WebKit::PageClientImpl::isViewWindowActive): Deleted.
+        (WebKit::PageClientImpl::isViewFocused): Deleted.
+        (WebKit::PageClientImpl::isViewVisibleOrOccluded): Deleted.
+        (WebKit::PageClientImpl::isVisuallyIdle): Deleted.
+            - merged isViewWindowActive/isViewFocused/isViewVisible/isViewInWindow to viewState.
+
</ins><span class="cx"> 2014-05-28  Jeffrey Pfau  &lt;jpfau@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add Obj-C API for cache partitioned URL schemes
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -918,7 +918,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)didMoveToWindow
</span><span class="cx"> {
</span><del>-    _page-&gt;viewStateDidChange(WebCore::ViewState::IsInWindow);
</del><ins>+    _page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #pragma mark - UIScrollViewDelegate
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkPageClientImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -97,26 +97,25 @@
</span><span class="cx">     return IntSize(allocation.width, allocation.height);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PageClientImpl::isViewWindowActive()
</del><ins>+ViewState::Flags PageClientImpl::viewState()
</ins><span class="cx"> {
</span><del>-    return webkitWebViewBaseIsInWindowActive(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
</del><ins>+    WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(m_viewWidget);
+    ViewState::Flags viewState = ViewState::NoFlags;
+    
+    if (webkitWebViewBaseIsFocused(webView))
+        viewState |= ViewState::IsFocused;
+    if (webkitWebViewBaseIsInWindowActive(webView))
+        viewState |= ViewState::WindowIsActive;
+    if (webkitWebViewBaseIsInWindow(webView))
+        viewState |= ViewState::IsInWindow;
+    if (webkitWebViewBaseIsVisible(webView))
+        viewState |= (ViewState::IsVisible | ViewState::IsVisibleOrOccluded);
+    else
+        viewState |= ViewState::IsVisuallyIdle;
+    
+    return viewState;
</ins><span class="cx"> }
</span><del>-
-bool PageClientImpl::isViewFocused()
-{
-    return webkitWebViewBaseIsFocused(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
-}
-
-bool PageClientImpl::isViewVisible()
-{
-    return webkitWebViewBaseIsVisible(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
-}
-
-bool PageClientImpl::isViewInWindow()
-{
-    return webkitWebViewBaseIsInWindow(WEBKIT_WEB_VIEW_BASE(m_viewWidget));
-}
-
</del><ins>+    
</ins><span class="cx"> void PageClientImpl::PageClientImpl::processDidExit()
</span><span class="cx"> {
</span><span class="cx">     notImplemented();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -67,10 +67,7 @@
</span><span class="cx">     virtual void scrollView(const WebCore::IntRect&amp; scrollRect, const WebCore::IntSize&amp; scrollOffset) override;
</span><span class="cx">     virtual void requestScroll(const WebCore::FloatPoint&amp; scrollPosition, bool isProgrammaticScroll) override;
</span><span class="cx">     virtual WebCore::IntSize viewSize() override;
</span><del>-    virtual bool isViewWindowActive() override;
-    virtual bool isViewFocused() override;
-    virtual bool isViewVisible() override;
-    virtual bool isViewInWindow() override;
</del><ins>+    virtual WebCore::ViewState::Flags viewState() override;
</ins><span class="cx">     virtual void processDidExit() override;
</span><span class="cx">     virtual void didRelaunchProcess() override;
</span><span class="cx">     virtual void pageClosed() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webViewBase-&gt;priv;
</span><span class="cx">     if (!priv-&gt;isInWindowActive) {
</span><span class="cx">         priv-&gt;isInWindowActive = true;
</span><del>-        priv-&gt;pageProxy-&gt;viewStateDidChange(ViewState::WindowIsActive);
</del><ins>+        priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return FALSE;
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webViewBase-&gt;priv;
</span><span class="cx">     if (priv-&gt;isInWindowActive) {
</span><span class="cx">         priv-&gt;isInWindowActive = false;
</span><del>-        priv-&gt;pageProxy-&gt;viewStateDidChange(ViewState::WindowIsActive);
</del><ins>+        priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return FALSE;
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx">     bool isWindowVisible = visibilityEvent-&gt;state != GDK_VISIBILITY_FULLY_OBSCURED;
</span><span class="cx">     if (priv-&gt;isWindowVisible != isWindowVisible) {
</span><span class="cx">         priv-&gt;isWindowVisible = isWindowVisible;
</span><del>-        priv-&gt;pageProxy-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+        priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return FALSE;
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     priv-&gt;toplevelOnScreenWindow = window;
</span><del>-    priv-&gt;pageProxy-&gt;viewStateDidChange(ViewState::IsInWindow);
</del><ins>+    priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx">     if (!priv-&gt;toplevelOnScreenWindow)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -564,7 +564,7 @@
</span><span class="cx">     WebKitWebViewBasePrivate* priv = webViewBase-&gt;priv;
</span><span class="cx">     if (!priv-&gt;isVisible) {
</span><span class="cx">         priv-&gt;isVisible = true;
</span><del>-        priv-&gt;pageProxy-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+        priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!priv-&gt;needsResizeOnMap)
</span><span class="lines">@@ -583,7 +583,7 @@
</span><span class="cx">     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)-&gt;priv;
</span><span class="cx">     if (priv-&gt;isVisible) {
</span><span class="cx">         priv-&gt;isVisible = false;
</span><del>-        priv-&gt;pageProxy-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+        priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1124,7 +1124,6 @@
</span><span class="cx">     if (priv-&gt;isFocused == focused)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned viewStateFlags = ViewState::IsFocused;
</del><span class="cx">     priv-&gt;isFocused = focused;
</span><span class="cx"> 
</span><span class="cx">     // If the view has received the focus and the window is not active
</span><span class="lines">@@ -1132,11 +1131,9 @@
</span><span class="cx">     // toplevel window is a GTK_WINDOW_POPUP and the focus has been
</span><span class="cx">     // set programatically like WebKitTestRunner does, because POPUP
</span><span class="cx">     // can't be focused.
</span><del>-    if (priv-&gt;isFocused &amp;&amp; !priv-&gt;isInWindowActive) {
</del><ins>+    if (priv-&gt;isFocused &amp;&amp; !priv-&gt;isInWindowActive)
</ins><span class="cx">         priv-&gt;isInWindowActive = true;
</span><del>-        viewStateFlags |= ViewState::WindowIsActive;
-    }
-    priv-&gt;pageProxy-&gt;viewStateDidChange(viewStateFlags);
</del><ins>+    priv-&gt;pageProxy-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool webkitWebViewBaseIsInWindowActive(WebKitWebViewBase* webViewBase)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -353,7 +353,7 @@
</span><span class="cx">     _data-&gt;_inBecomeFirstResponder = true;
</span><span class="cx">     
</span><span class="cx">     [self _updateSecureInputState];
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsFocused);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> 
</span><span class="cx">     _data-&gt;_inBecomeFirstResponder = false;
</span><span class="cx">     
</span><span class="lines">@@ -385,7 +385,7 @@
</span><span class="cx">     if (!_data-&gt;_page-&gt;maintainsInactiveSelection())
</span><span class="cx">         _data-&gt;_page-&gt;clearSelection();
</span><span class="cx">     
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsFocused);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> 
</span><span class="cx">     _data-&gt;_inResignFirstResponder = false;
</span><span class="cx"> 
</span><span class="lines">@@ -2448,12 +2448,9 @@
</span><span class="cx">     if ([self window]) {
</span><span class="cx">         [self doWindowDidChangeScreen];
</span><span class="cx"> 
</span><del>-        ViewState::Flags viewStateChanges = ViewState::WindowIsActive | ViewState::IsVisible;
</del><span class="cx">         if ([self isDeferringViewInWindowChanges])
</span><span class="cx">             _data-&gt;_viewInWindowChangeWasDeferred = YES;
</span><del>-        else
-            viewStateChanges |= ViewState::IsInWindow;
-        _data-&gt;_page-&gt;viewStateDidChange(viewStateChanges);
</del><ins>+        _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> 
</span><span class="cx">         [self _updateWindowAndViewFrames];
</span><span class="cx"> 
</span><span class="lines">@@ -2466,12 +2463,9 @@
</span><span class="cx"> 
</span><span class="cx">         [self _accessibilityRegisterUIProcessTokens];
</span><span class="cx">     } else {
</span><del>-        ViewState::Flags viewStateChanges = ViewState::WindowIsActive | ViewState::IsVisible;
</del><span class="cx">         if ([self isDeferringViewInWindowChanges])
</span><span class="cx">             _data-&gt;_viewInWindowChangeWasDeferred = YES;
</span><del>-        else
-            viewStateChanges |= ViewState::IsInWindow;
-        _data-&gt;_page-&gt;viewStateDidChange(viewStateChanges);
</del><ins>+        _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> 
</span><span class="cx">         [NSEvent removeMonitor:_data-&gt;_flagsChangedEventMonitor];
</span><span class="cx">         _data-&gt;_flagsChangedEventMonitor = nil;
</span><span class="lines">@@ -2492,7 +2486,7 @@
</span><span class="cx">     NSWindow *keyWindow = [notification object];
</span><span class="cx">     if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) {
</span><span class="cx">         [self _updateSecureInputState];
</span><del>-        _data-&gt;_page-&gt;viewStateDidChange(ViewState::WindowIsActive);
</del><ins>+        _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2511,18 +2505,18 @@
</span><span class="cx">     NSWindow *formerKeyWindow = [notification object];
</span><span class="cx">     if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) {
</span><span class="cx">         [self _updateSecureInputState];
</span><del>-        _data-&gt;_page-&gt;viewStateDidChange(ViewState::WindowIsActive);
</del><ins>+        _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_windowDidMiniaturize:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_windowDidDeminiaturize:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_windowDidMove:(NSNotification *)notification
</span><span class="lines">@@ -2537,12 +2531,12 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_windowDidOrderOffScreen:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible | ViewState::WindowIsActive);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_windowDidOrderOnScreen:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible | ViewState::WindowIsActive);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_windowDidChangeBackingProperties:(NSNotification *)notification
</span><span class="lines">@@ -2558,7 +2552,7 @@
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx"> - (void)_windowDidChangeOcclusionState:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -2582,12 +2576,12 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)viewDidHide
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)viewDidUnhide
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)viewDidChangeBackingProperties
</span><span class="lines">@@ -2603,7 +2597,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_activeSpaceDidChange:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_accessibilityRegisterUIProcessTokens
</span><span class="lines">@@ -3490,7 +3484,7 @@
</span><span class="cx">     else
</span><span class="cx">         [self _setAcceleratedCompositingModeRootLayer:_data-&gt;_rootLayer.get()];
</span><span class="cx"> 
</span><del>-    _data-&gt;_page-&gt;viewStateDidChange(ViewState::WindowIsActive | ViewState::IsInWindow | ViewState::IsVisible);
</del><ins>+    _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (_WKThumbnailView *)_thumbnailView
</span><span class="lines">@@ -3748,7 +3742,7 @@
</span><span class="cx">     _data-&gt;_shouldDeferViewInWindowChanges = NO;
</span><span class="cx"> 
</span><span class="cx">     if (_data-&gt;_viewInWindowChangeWasDeferred) {
</span><del>-        _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsInWindow);
</del><ins>+        _data-&gt;_page-&gt;viewStateDidChange();
</ins><span class="cx">         _data-&gt;_viewInWindowChangeWasDeferred = NO;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -3766,7 +3760,7 @@
</span><span class="cx">     _data-&gt;_shouldDeferViewInWindowChanges = NO;
</span><span class="cx"> 
</span><span class="cx">     if (_data-&gt;_viewInWindowChangeWasDeferred) {
</span><del>-        _data-&gt;_page-&gt;viewStateDidChange(ViewState::IsInWindow, hasPendingViewInWindowChange ? WebPageProxy::WantsReplyOrNot::DoesWantReply : WebPageProxy::WantsReplyOrNot::DoesNotWantReply);
</del><ins>+        _data-&gt;_page-&gt;viewStateDidChange(hasPendingViewInWindowChange ? WebPageProxy::WantsReplyOrNot::DoesWantReply : WebPageProxy::WantsReplyOrNot::DoesNotWantReply);
</ins><span class="cx">         _data-&gt;_viewInWindowChangeWasDeferred = NO;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     scene-&gt;setActive(active);
</span><del>-    m_page-&gt;viewStateDidChange(ViewState::WindowIsActive);
</del><ins>+    m_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebView::setSize(const WebCore::IntSize&amp; size)
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_focused = focused;
</span><del>-    m_page-&gt;viewStateDidChange(ViewState::IsFocused | ViewState::WindowIsActive);
</del><ins>+    m_page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebView::setVisible(bool visible)
</span><span class="lines">@@ -120,12 +120,27 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_visible = visible;
</span><del>-    m_page-&gt;viewStateDidChange(ViewState::IsVisible);
</del><ins>+    m_page-&gt;viewStateDidChange();
</ins><span class="cx"> 
</span><span class="cx">     if (CoordinatedDrawingAreaProxy* drawingArea = static_cast&lt;CoordinatedDrawingAreaProxy*&gt;(page()-&gt;drawingArea()))
</span><span class="cx">         drawingArea-&gt;visibilityDidChange();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ViewState::Flags WebView::viewState()
+{
+    ViewState::Flags viewState = ViewState::IsInWindow | ViewState::WindowIsActive;
+    
+    if (isFocused())
+        viewState |= ViewState::IsFocused;
+    
+    if (isVisible())
+        viewState |= (ViewState::IsVisible | ViewState::IsVisibleOrOccluded);
+    else
+        viewState |= ViewState::IsVisuallyIdle;
+    
+    return viewState;
+}
+    
</ins><span class="cx"> void WebView::setUserViewportTranslation(double tx, double ty)
</span><span class="cx"> {
</span><span class="cx">     m_userViewportTransform = TransformationMatrix().translate(tx, ty);
</span><span class="lines">@@ -323,28 +338,6 @@
</span><span class="cx">     return scene-&gt;isActive();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool WebView::isViewWindowActive()
-{
-    notImplemented();
-    return true;
-}
-
-bool WebView::isViewFocused()
-{
-    return isFocused();
-}
-
-bool WebView::isViewVisible()
-{
-    return isVisible();
-}
-
-bool WebView::isViewInWindow()
-{
-    notImplemented();
-    return true;
-}
-
</del><span class="cx"> void WebView::processDidExit()
</span><span class="cx"> {
</span><span class="cx">     m_client.webProcessCrashed(this, m_page-&gt;urlAtProcessExit());
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -135,10 +135,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual WebCore::IntSize viewSize() override;
</span><span class="cx"> 
</span><del>-    virtual bool isViewWindowActive() override;
-    virtual bool isViewFocused() override;
-    virtual bool isViewVisible() override;
-    virtual bool isViewInWindow() override;
</del><ins>+    virtual WebCore::ViewState::Flags viewState() override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void processDidExit() override;
</span><span class="cx">     virtual void didRelaunchProcess() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;WebPopupMenuProxy.h&quot;
</span><span class="cx"> #include &lt;WebCore/AlternativeTextClient.h&gt;
</span><span class="cx"> #include &lt;WebCore/EditorClient.h&gt;
</span><ins>+#include &lt;WebCore/ViewState.h&gt;
</ins><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -100,23 +101,12 @@
</span><span class="cx">     // Return the size of the view the page is associated with.
</span><span class="cx">     virtual WebCore::IntSize viewSize() = 0;
</span><span class="cx"> 
</span><del>-    // Return whether the view's containing window is active.
-    virtual bool isViewWindowActive() = 0;
-
-    // Return whether the view is focused.
-    virtual bool isViewFocused() = 0;
-
-    // Return whether the view is visible.
-    virtual bool isViewVisible() = 0;
-
-    // Return whether the view is visible, or occluded by another window.
-    virtual bool isViewVisibleOrOccluded() { return isViewVisible(); }
-
</del><ins>+#if PLATFORM(MAC)
</ins><span class="cx">     // Return whether the view is in a window.
</span><span class="cx">     virtual bool isViewInWindow() = 0;
</span><ins>+#endif
</ins><span class="cx"> 
</span><del>-    // Return whether the view is visually idle.
-    virtual bool isVisuallyIdle() { return !isViewVisible(); }
</del><ins>+    virtual WebCore::ViewState::Flags viewState() = 0;
</ins><span class="cx"> 
</span><span class="cx">     // Return the layer hosting mode for the view.
</span><span class="cx">     virtual LayerHostingMode viewLayerHostingMode() { return LayerHostingMode::InProcess; }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -270,7 +270,7 @@
</span><span class="cx">     , m_userAgent(standardUserAgent())
</span><span class="cx">     , m_geolocationPermissionRequestManager(*this)
</span><span class="cx">     , m_notificationPermissionRequestManager(*this)
</span><del>-    , m_viewState(ViewState::NoFlags)
</del><ins>+    , m_viewState(m_pageClient.viewState())
</ins><span class="cx">     , m_backForwardList(WebBackForwardList::create(*this))
</span><span class="cx">     , m_loadStateAtProcessExit(FrameLoadState::State::Finished)
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; !USE(ASYNC_NSTEXTINPUTCLIENT)
</span><span class="lines">@@ -362,8 +362,7 @@
</span><span class="cx">             m_userContentController-&gt;addProcess(m_process.get());
</span><span class="cx">         m_visitedLinkProvider-&gt;addProcess(m_process.get());
</span><span class="cx">     }
</span><del>-
-    updateViewState();
</del><ins>+    
</ins><span class="cx">     updateActivityToken();
</span><span class="cx">     
</span><span class="cx"> #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
</span><span class="lines">@@ -530,7 +529,7 @@
</span><span class="cx">     m_process-&gt;addExistingWebPage(this, m_pageID);
</span><span class="cx">     m_process-&gt;addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
</span><span class="cx"> 
</span><del>-    updateViewState();
</del><ins>+    m_viewState = m_pageClient.viewState();
</ins><span class="cx">     updateActivityToken();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INSPECTOR)
</span><span class="lines">@@ -1050,36 +1049,15 @@
</span><span class="cx">     m_pageClient.requestScroll(scrollPosition, isProgrammaticScroll);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::updateViewState(ViewState::Flags flagsToUpdate)
</del><ins>+void WebPageProxy::viewStateDidChange(WantsReplyOrNot wantsReply)
</ins><span class="cx"> {
</span><del>-    m_viewState &amp;= ~flagsToUpdate;
-    if (flagsToUpdate &amp; ViewState::IsFocused &amp;&amp; m_pageClient.isViewFocused())
-        m_viewState |= ViewState::IsFocused;
-    if (flagsToUpdate &amp; ViewState::WindowIsActive &amp;&amp; m_pageClient.isViewWindowActive())
-        m_viewState |= ViewState::WindowIsActive;
-    if (flagsToUpdate &amp; ViewState::IsVisible &amp;&amp; m_pageClient.isViewVisible())
-        m_viewState |= ViewState::IsVisible;
-    if (flagsToUpdate &amp; ViewState::IsVisibleOrOccluded &amp;&amp; m_pageClient.isViewVisibleOrOccluded())
-        m_viewState |= ViewState::IsVisibleOrOccluded;
-    if (flagsToUpdate &amp; ViewState::IsInWindow &amp;&amp; m_pageClient.isViewInWindow())
-        m_viewState |= ViewState::IsInWindow;
-    if (flagsToUpdate &amp; ViewState::IsVisuallyIdle &amp;&amp; m_pageClient.isVisuallyIdle())
-        m_viewState |= ViewState::IsVisuallyIdle;
-}
-
-void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsReplyOrNot wantsReply)
-{
</del><span class="cx">     if (!isValid())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // If the visibility state may have changed, then so may the visually idle &amp; occluded agnostic state.
-    if (mayHaveChanged &amp; ViewState::IsVisible)
-        mayHaveChanged |= ViewState::IsVisibleOrOccluded | ViewState::IsVisuallyIdle;
-
</del><span class="cx">     // Record the prior view state, update the flags that may have changed,
</span><span class="cx">     // and check which flags have actually changed.
</span><span class="cx">     ViewState::Flags previousViewState = m_viewState;
</span><del>-    updateViewState(mayHaveChanged);
</del><ins>+    m_viewState = m_pageClient.viewState();
</ins><span class="cx">     ViewState::Flags changed = m_viewState ^ previousViewState;
</span><span class="cx"> 
</span><span class="cx">     if (changed)
</span><span class="lines">@@ -1097,7 +1075,7 @@
</span><span class="cx">     if ((changed &amp; ViewState::IsVisible) &amp;&amp; !isViewVisible())
</span><span class="cx">         m_process-&gt;responsivenessTimer()-&gt;stop();
</span><span class="cx"> 
</span><del>-    if ((mayHaveChanged &amp; ViewState::IsInWindow) &amp;&amp; (m_viewState &amp; ViewState::IsInWindow)) {
</del><ins>+    if ((changed &amp; ViewState::IsInWindow) &amp;&amp; (m_viewState &amp; ViewState::IsInWindow)) {
</ins><span class="cx">         LayerHostingMode layerHostingMode = m_pageClient.viewLayerHostingMode();
</span><span class="cx">         if (m_layerHostingMode != layerHostingMode) {
</span><span class="cx">             m_layerHostingMode = layerHostingMode;
</span><span class="lines">@@ -1105,7 +1083,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if ((mayHaveChanged &amp; ViewState::IsInWindow) &amp;&amp; !(m_viewState &amp; ViewState::IsInWindow)) {
</del><ins>+    if ((changed &amp; ViewState::IsInWindow) &amp;&amp; !(m_viewState &amp; ViewState::IsInWindow)) {
</ins><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR_POPOVER)
</span><span class="cx">         // When leaving the current page, close the popover color well.
</span><span class="cx">         if (m_colorPicker)
</span><span class="lines">@@ -3801,7 +3779,7 @@
</span><span class="cx"> {
</span><span class="cx">     // The Web process may have asked to change the cursor when the view was in an active window, but
</span><span class="cx">     // if it is no longer in a window or the window is not active, then the cursor should not change.
</span><del>-    if (m_pageClient.isViewWindowActive())
</del><ins>+    if (isViewWindowActive())
</ins><span class="cx">         m_pageClient.setCursor(cursor);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4689,7 +4667,7 @@
</span><span class="cx">     if (!m_process-&gt;responsivenessTimer()-&gt;isResponsive())
</span><span class="cx">         isDiscardable = false;
</span><span class="cx">     else
</span><del>-        isDiscardable = !m_pageClient.isViewWindowActive() || !isViewVisible();
</del><ins>+        isDiscardable = !isViewWindowActive() || !isViewVisible();
</ins><span class="cx"> 
</span><span class="cx">     m_drawingArea-&gt;setBackingStoreIsDiscardable(isDiscardable);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -568,15 +568,15 @@
</span><span class="cx">     bool delegatesScrolling() const { return m_delegatesScrolling; }
</span><span class="cx"> 
</span><span class="cx">     enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
</span><del>-    void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged, WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
</del><ins>+    void viewStateDidChange(WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
</ins><span class="cx">     bool isInWindow() const { return m_viewState &amp; WebCore::ViewState::IsInWindow; }
</span><span class="cx">     void waitForDidUpdateViewState();
</span><span class="cx"> 
</span><span class="cx">     void layerHostingModeDidChange();
</span><span class="cx"> 
</span><span class="cx">     WebCore::IntSize viewSize() const;
</span><ins>+    bool isViewWindowActive() const { return m_viewState &amp; WebCore::ViewState::WindowIsActive; }
</ins><span class="cx">     bool isViewVisible() const { return m_viewState &amp; WebCore::ViewState::IsVisible; }
</span><del>-    bool isViewWindowActive() const;
</del><span class="cx">     bool isProcessSuppressible() const;
</span><span class="cx"> 
</span><span class="cx">     void addMIMETypeWithCustomContentProvider(const String&amp; mimeType);
</span><span class="lines">@@ -1102,7 +1102,6 @@
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, const WebPageConfiguration&amp;);
</span><span class="cx">     void platformInitialize();
</span><span class="cx"> 
</span><del>-    void updateViewState(WebCore::ViewState::Flags flagsToUpdate = WebCore::ViewState::AllFlags);
</del><span class="cx">     void updateActivityToken();
</span><span class="cx">         
</span><span class="cx">     void resetState();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -669,7 +669,7 @@
</span><span class="cx"> void WebProcessProxy::windowServerConnectionStateChanged()
</span><span class="cx"> {
</span><span class="cx">     for (const auto&amp; page : m_pageMap.values())
</span><del>-        page-&gt;viewStateDidChange(ViewState::IsVisuallyIdle);
</del><ins>+        page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcessProxy::requestTermination()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -55,12 +55,8 @@
</span><span class="cx">     virtual void scrollView(const WebCore::IntRect&amp; scrollRect, const WebCore::IntSize&amp; scrollOffset) override;
</span><span class="cx">     virtual void requestScroll(const WebCore::FloatPoint&amp; scrollPosition, bool isProgrammaticScroll) override;
</span><span class="cx">     virtual WebCore::IntSize viewSize() override;
</span><del>-    virtual bool isViewWindowActive() override;
-    virtual bool isViewFocused() override;
-    virtual bool isViewVisible() override;
-    virtual bool isViewInWindow() override;
-    virtual bool isViewVisibleOrOccluded() override;
-    virtual bool isVisuallyIdle() override;
</del><ins>+    virtual WebCore::ViewState::Flags viewState() override;
+        
</ins><span class="cx">     virtual void processDidExit() override;
</span><span class="cx">     virtual void didRelaunchProcess() override;
</span><span class="cx">     virtual void pageClosed() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -110,38 +110,25 @@
</span><span class="cx">     return IntSize(m_contentView.bounds.size);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PageClientImpl::isViewWindowActive()
</del><ins>+// FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
+ViewState::Flags PageClientImpl::viewState()
</ins><span class="cx"> {
</span><del>-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
-    return isViewVisible();
</del><ins>+    ViewState::Flags viewState = ViewState::NoFlags;
+    
+    bool isInWindow = [m_webView window];
+    bool isVisible = isInWindow &amp;&amp; [UIApplication sharedApplication].applicationState != UIApplicationStateBackground;
+    
+    if (isInWindow)
+        viewState |= ViewState::IsInWindow;
+    
+    if (isVisible)
+        viewState |= ViewState::WindowIsActive | ViewState::IsFocused | ViewState::IsVisible | ViewState::IsVisibleOrOccluded;
+    else
+        viewState |= ViewState::IsVisuallyIdle;
+    
+    return viewState;
</ins><span class="cx"> }
</span><del>-
-bool PageClientImpl::isViewFocused()
-{
-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=133098
-    return isViewWindowActive();
-}
-
-bool PageClientImpl::isViewVisible()
-{
-    return [m_webView window] &amp;&amp; [UIApplication sharedApplication].applicationState != UIApplicationStateBackground;
-}
-
-bool PageClientImpl::isViewInWindow()
-{
-    return [m_webView window];
-}
-
-bool PageClientImpl::isViewVisibleOrOccluded()
-{
-    return isViewVisible();
-}
-
-bool PageClientImpl::isVisuallyIdle()
-{
-    return !isViewVisible();
-}
-
</del><ins>+    
</ins><span class="cx"> void PageClientImpl::processDidExit()
</span><span class="cx"> {
</span><span class="cx">     [m_contentView _processDidExit];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -250,7 +250,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (self.window)
</span><span class="cx">         [self _updateForScreen:self.window.screen];
</span><del>-    _page-&gt;viewStateDidChange(ViewState::AllFlags);
</del><ins>+    _page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (WKBrowsingContextController *)browsingContextController
</span><span class="lines">@@ -451,13 +451,13 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_applicationDidEnterBackground:(NSNotification*)notification
</span><span class="cx"> {
</span><del>-    _page-&gt;viewStateDidChange(ViewState::AllFlags &amp; ~ViewState::IsInWindow);
</del><ins>+    _page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_applicationWillEnterForeground:(NSNotification*)notification
</span><span class="cx"> {
</span><span class="cx">     _page-&gt;applicationWillEnterForeground();
</span><del>-    _page-&gt;viewStateDidChange(ViewState::AllFlags &amp; ~ViewState::IsInWindow);
</del><ins>+    _page-&gt;viewStateDidChange();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_applicationDidBecomeActive:(NSNotification*)notification
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -65,12 +65,10 @@
</span><span class="cx">     virtual void requestScroll(const WebCore::FloatPoint&amp; scrollPosition, bool isProgrammaticScroll);
</span><span class="cx"> 
</span><span class="cx">     virtual WebCore::IntSize viewSize();
</span><del>-    virtual bool isViewWindowActive();
-    virtual bool isViewFocused();
-    virtual bool isViewVisible();
-    virtual bool isViewVisibleOrOccluded();
</del><ins>+    bool isViewVisible();
</ins><span class="cx">     virtual bool isViewInWindow();
</span><del>-    virtual bool isVisuallyIdle();
</del><ins>+    virtual WebCore::ViewState::Flags viewState() override;
+        
</ins><span class="cx">     virtual LayerHostingMode viewLayerHostingMode() override;
</span><span class="cx">     virtual ColorSpaceData colorSpace() override;
</span><span class="cx">     virtual void setAcceleratedCompositingRootLayer(LayerOrView *) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (169438 => 169439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-05-28 23:26:09 UTC (rev 169438)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-05-29 01:41:22 UTC (rev 169439)
</span><span class="lines">@@ -190,17 +190,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PageClientImpl::isViewWindowActive()
-{
-    NSWindow *activeViewWindow = activeView().window;
-    return activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow;
-}
-
-bool PageClientImpl::isViewFocused()
-{
-    return [m_wkView _isFocused];
-}
-
</del><span class="cx"> void PageClientImpl::makeFirstResponder()
</span><span class="cx"> {
</span><span class="cx">      [[m_wkView window] makeFirstResponder:m_wkView];
</span><span class="lines">@@ -235,21 +224,34 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PageClientImpl::isViewVisibleOrOccluded()
-{
-    return activeView().window.isVisible;
-}
-
</del><span class="cx"> bool PageClientImpl::isViewInWindow()
</span><span class="cx"> {
</span><span class="cx">     return activeView().window;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PageClientImpl::isVisuallyIdle()
</del><ins>+ViewState::Flags PageClientImpl::viewState()
</ins><span class="cx"> {
</span><del>-    return WindowServerConnection::shared().applicationWindowModificationsHaveStopped() || !isViewVisible();
</del><ins>+    ViewState::Flags viewState = ViewState::NoFlags;
+    
+    NSWindow *activeViewWindow = activeView().window;
+    bool isVisible = isViewVisible();
+    
+    if (activeViewWindow)
+        viewState |= ViewState::IsInWindow;
+    if (activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow)
+        viewState |= ViewState::WindowIsActive;
+    if ([m_wkView _isFocused])
+        viewState |= ViewState::IsFocused;
+    if (isVisible)
+        viewState |= ViewState::IsVisible;
+    if (activeViewWindow.isVisible)
+        viewState |= ViewState::IsVisibleOrOccluded;
+    if (!isVisible || WindowServerConnection::shared().applicationWindowModificationsHaveStopped())
+        viewState |= ViewState::IsVisuallyIdle;
+    
+    return viewState;
</ins><span class="cx"> }
</span><del>-
</del><ins>+    
</ins><span class="cx"> LayerHostingMode PageClientImpl::viewLayerHostingMode()
</span><span class="cx"> {
</span><span class="cx"> #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
</span><span class="lines">@@ -540,8 +542,9 @@
</span><span class="cx"> void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRect&amp; boundingBoxOfReplacedString, const String&amp; replacedString, const String&amp; replacementString, const Vector&lt;String&gt;&amp; alternativeReplacementStrings)
</span><span class="cx"> {
</span><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><del>-    if (!isViewVisible() || !isViewInWindow())
</del><ins>+    if (!isViewVisible())
</ins><span class="cx">         return;
</span><ins>+    ASSERT(isViewInWindow());
</ins><span class="cx">     m_correctionPanel.show(m_wkView, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="lines">@@ -620,8 +623,9 @@
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect&amp; boundingBoxOfDictatedText, uint64_t dictationContext)
</span><span class="cx"> {
</span><del>-    if (!isViewVisible() || !isViewInWindow())
</del><ins>+    if (!isViewVisible())
</ins><span class="cx">         return;
</span><ins>+    ASSERT(isViewInWindow());
</ins><span class="cx">     m_alternativeTextUIController-&gt;showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){
</span><span class="cx">         [m_wkView handleAcceptedAlternativeText:acceptedAlternative];
</span><span class="cx">     });
</span></span></pre>
</div>
</div>

</body>
</html>