Change WebPage, WebPageProxy, WebPageCreationParameters to use ViewState
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2013 18:05:25 +0000 (18:05 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2013 18:05:25 +0000 (18:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123379

Reviewed by Darin Adler.

Visibility state of the Page should be stored and communicated consistently.

Remove individual visibility flags from WebPageProxy, WebPageCreationParameters,
and replace them with a ViewState, and add a ViewState member to WebPage.
Merge together all messages that convey and individual aspect of the ViewState.

Restructure WebPageProxy::viewStateDidChange to break the operation down into
three steps: 1) update m_viewState, 2) send the new ViewState to the WebProcess,
and 3) perform any further work necessary in the UIProcess.

This patch fixes a problem that if the web process crashes m_isVisible &
m_isInWindow in WebPageProxy were not updated, and could have held stale values
on reattach.

In WebPage, add a new message to update the entire ViewState - diff the prior
value against the new one to detect changes, call existing methods accordingly.

* Shared/ViewState.h:
    - Add constants 'Reset', 'AllFlags'
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
    - Removed boolean visibility flags, added viewState.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
    - Constructor calls updateViewState to initialize m_viewState.
(WebKit::WebPageProxy::reattachToWebProcess):
    - ViewStaet is not updated while detatched; recalculate.
(WebKit::WebPageProxy::initializeWebPage):
    - m_isVisible -> isViewVisible()
(WebKit::WebPageProxy::updateViewState):
    - Added, update m_viewState by querying the page client.
(WebKit::WebPageProxy::viewStateDidChange):
    - Restructured to use m_viewState, reordered to combine messages.
(WebKit::WebPageProxy::creationParameters):
    - Removed boolean visibility flags, added viewState.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isInWindow):
(WebKit::WebPageProxy::isViewVisible):
    - Removed boolean visibility flags, added viewState.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
    - initial state now passed as a ViewState.
(WebKit::WebPage::setIsInWindow):
    - Remove code to send reply (this is handled by setViewState).
(WebKit::WebPage::setViewState):
    - Set m_viewState - diff from prior & call methods to update.
* WebProcess/WebPage/WebPage.h:
    - Added setViewState, m_viewState.
* WebProcess/WebPage/WebPage.messages.in:
    - Add SetViewState, remove individual messages.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
    - initial state now passed as a ViewState.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158372 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/ViewState.h
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

index 85cbc43..d2ebec9 100644 (file)
@@ -1,3 +1,66 @@
+2013-10-31  Gavin Barraclough  <barraclough@apple.com>
+
+        Change WebPage, WebPageProxy, WebPageCreationParameters to use ViewState
+        https://bugs.webkit.org/show_bug.cgi?id=123379
+
+        Reviewed by Darin Adler.
+
+        Visibility state of the Page should be stored and communicated consistently.
+
+        Remove individual visibility flags from WebPageProxy, WebPageCreationParameters,
+        and replace them with a ViewState, and add a ViewState member to WebPage.
+        Merge together all messages that convey and individual aspect of the ViewState.
+
+        Restructure WebPageProxy::viewStateDidChange to break the operation down into
+        three steps: 1) update m_viewState, 2) send the new ViewState to the WebProcess,
+        and 3) perform any further work necessary in the UIProcess.
+
+        This patch fixes a problem that if the web process crashes m_isVisible &
+        m_isInWindow in WebPageProxy were not updated, and could have held stale values
+        on reattach.
+
+        In WebPage, add a new message to update the entire ViewState - diff the prior
+        value against the new one to detect changes, call existing methods accordingly.
+
+        * Shared/ViewState.h:
+            - Add constants 'Reset', 'AllFlags'
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+            - Removed boolean visibility flags, added viewState.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+            - Constructor calls updateViewState to initialize m_viewState.
+        (WebKit::WebPageProxy::reattachToWebProcess):
+            - ViewStaet is not updated while detatched; recalculate.
+        (WebKit::WebPageProxy::initializeWebPage):
+            - m_isVisible -> isViewVisible()
+        (WebKit::WebPageProxy::updateViewState):
+            - Added, update m_viewState by querying the page client.
+        (WebKit::WebPageProxy::viewStateDidChange):
+            - Restructured to use m_viewState, reordered to combine messages.
+        (WebKit::WebPageProxy::creationParameters):
+            - Removed boolean visibility flags, added viewState.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::isInWindow):
+        (WebKit::WebPageProxy::isViewVisible):
+            - Removed boolean visibility flags, added viewState.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+            - initial state now passed as a ViewState.
+        (WebKit::WebPage::setIsInWindow):
+            - Remove code to send reply (this is handled by setViewState).
+        (WebKit::WebPage::setViewState):
+            - Set m_viewState - diff from prior & call methods to update.
+        * WebProcess/WebPage/WebPage.h:
+            - Added setViewState, m_viewState.
+        * WebProcess/WebPage/WebPage.messages.in:
+            - Add SetViewState, remove individual messages.
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+            - initial state now passed as a ViewState.
+
 2013-10-30  Gavin Barraclough  <barraclough@apple.com>
 
         WebPageCreationParameters should be consistent in Window.open
index bb24bf1..19fb379 100644 (file)
@@ -36,7 +36,11 @@ struct ViewState {
         IsInWindow = 1 << 3,
         WindowIsVisible = 1 << 4
     };
+
     typedef unsigned Flags;
+
+    static const Flags NoFlags = 0;
+    static const Flags AllFlags = WindowIsActive | IsFocused | IsVisible | IsInWindow | WindowIsVisible;
 };
 
 } // namespace WebKit
index 859e7de..1dbf95b 100644 (file)
@@ -33,10 +33,7 @@ namespace WebKit {
 void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const
 {
     encoder << viewSize;
-    encoder << isActive;
-    encoder << isFocused;
-    encoder << isVisible;
-    encoder << isInWindow;
+    encoder << viewState;
 
     encoder << store;
     encoder.encodeEnum(drawingAreaType);
@@ -73,13 +70,7 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder& decoder, WebPag
 {
     if (!decoder.decode(parameters.viewSize))
         return false;
-    if (!decoder.decode(parameters.isActive))
-        return false;
-    if (!decoder.decode(parameters.isFocused))
-        return false;
-    if (!decoder.decode(parameters.isVisible))
-        return false;
-    if (!decoder.decode(parameters.isInWindow))
+    if (!decoder.decode(parameters.viewState))
         return false;
     if (!decoder.decode(parameters.store))
         return false;
index e3696d6..cfb0f39 100644 (file)
@@ -29,6 +29,7 @@
 #include "DrawingAreaInfo.h"
 #include "LayerTreeContext.h"
 #include "SessionState.h"
+#include "ViewState.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebPageGroupData.h"
 #include "WebPreferencesStore.h"
@@ -55,10 +56,7 @@ struct WebPageCreationParameters {
 
     WebCore::IntSize viewSize;
 
-    bool isActive;
-    bool isFocused;
-    bool isVisible;
-    bool isInWindow;
+    ViewState::Flags viewState;
     
     WebPreferencesStore store;
     DrawingAreaType drawingAreaType;
index 1d39fec..72c6d51 100644 (file)
@@ -238,8 +238,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_geolocationPermissionRequestManager(this)
     , m_notificationPermissionRequestManager(this)
     , m_estimatedProgress(0)
-    , m_isInWindow(m_pageClient->isViewInWindow())
-    , m_isVisible(m_pageClient->isViewVisible())
+    , m_viewState(ViewState::NoFlags)
     , m_backForwardList(WebBackForwardList::create(this))
     , m_loadStateAtProcessExit(WebFrameProxy::LoadStateFinished)
     , m_temporarilyClosedComposition(false)
@@ -319,10 +318,12 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
 #endif
     , m_scrollPinningBehavior(DoNotPin)
 {
+    updateViewState();
+
     platformInitialize();
 
 #if ENABLE(PAGE_VISIBILITY_API)
-    if (!m_isVisible)
+    if (isViewVisible())
         m_visibilityState = PageVisibilityStateHidden;
 #endif
 #ifndef NDEBUG
@@ -470,6 +471,8 @@ void WebPageProxy::reattachToWebProcess()
     ASSERT(!m_process->isValid());
     ASSERT(!m_process->isLaunching());
 
+    updateViewState();
+
     m_isValid = true;
 
     if (m_process->context()->processModel() == ProcessModelSharedSecondaryProcess)
@@ -528,7 +531,7 @@ void WebPageProxy::initializeWebPage()
 #if ENABLE(PAGE_VISIBILITY_API)
     m_process->send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
 #elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
-    m_process->send(Messages::WebPage::SetVisibilityState(m_isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID);
+    m_process->send(Messages::WebPage::SetVisibilityState(isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID);
 #endif
 
 #if PLATFORM(MAC)
@@ -965,59 +968,56 @@ void WebPageProxy::scrollView(const IntRect& scrollRect, const IntSize& scrollOf
     m_pageClient->scrollView(scrollRect, scrollOffset);
 }
 
-void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsReplyOrNot wantsReply)
+void WebPageProxy::updateViewState(ViewState::Flags flagsToUpdate)
 {
-    // Wants reply currently only applies to the IsInWindow flag, so check only this is set.
-    ASSERT(wantsReply == WantsReplyOrNot::DoesNotWantReply || mayHaveChanged == ViewState::IsInWindow);
+    m_viewState &= ~flagsToUpdate;
+    if (flagsToUpdate & ViewState::WindowIsVisible && m_pageClient->isWindowVisible())
+        m_viewState |= ViewState::WindowIsVisible;
+    if (flagsToUpdate & ViewState::IsFocused && m_pageClient->isViewFocused())
+        m_viewState |= ViewState::IsFocused;
+    if (flagsToUpdate & ViewState::WindowIsActive && m_pageClient->isViewWindowActive())
+        m_viewState |= ViewState::WindowIsActive;
+    if (flagsToUpdate & ViewState::IsVisible && m_pageClient->isViewVisible())
+        m_viewState |= ViewState::IsVisible;
+    if (flagsToUpdate & ViewState::IsInWindow && m_pageClient->isViewInWindow())
+        m_viewState |= ViewState::IsInWindow;
+}
 
+void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsReplyOrNot wantsReply)
+{
     if (!isValid())
         return;
 
-    if (mayHaveChanged & ViewState::WindowIsVisible)
-        process()->send(Messages::WebPage::SetWindowIsVisible(m_pageClient->isWindowVisible()), m_pageID);
+    // Record the prior view state, update the flags that may have changed,
+    // and check which flags have actually changed.
+    ViewState::Flags previousViewState = m_viewState;
+    updateViewState(mayHaveChanged);
+    ViewState::Flags changed = m_viewState ^ previousViewState;
 
-    if (mayHaveChanged & ViewState::IsFocused)
-        m_process->send(Messages::WebPage::SetFocused(m_pageClient->isViewFocused()), m_pageID);
+    if (changed)
+        m_process->send(Messages::WebPage::SetViewState(m_viewState, wantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
 
-    // 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).
-    bool viewWasVisible = m_isVisible;
-    
-    if (mayHaveChanged & ViewState::WindowIsActive && !viewWasVisible)
-        m_process->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
-
-    if (mayHaveChanged & ViewState::IsVisible) {
-        bool isVisible = m_pageClient->isViewVisible();
-        if (isVisible != m_isVisible) {
-            m_isVisible = isVisible;
-            m_process->pageVisibilityChanged(this);
-            m_process->send(Messages::WebPage::SetViewIsVisible(isVisible), m_pageID);
-
-            if (!m_isVisible) {
-                // If we've started the responsiveness timer as part of telling the web process to update the backing store
-                // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
-                // stop the unresponsiveness timer here.
-                m_process->responsivenessTimer()->stop();
-            }
+    if (changed & ViewState::IsVisible) {
+        m_process->pageVisibilityChanged(this);
 
-#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) && !ENABLE(PAGE_VISIBILITY_API)
-            PageVisibilityState visibilityState = m_isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden;
-            m_process->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
-#endif
+        if (!isViewVisible()) {
+            // If we've started the responsiveness timer as part of telling the web process to update the backing store
+            // state, it might not send back a reply (since it won't paint anything if the web page is hidden) so we
+            // stop the unresponsiveness timer here.
+            m_process->responsivenessTimer()->stop();
         }
-    }
 
-    if (mayHaveChanged & ViewState::WindowIsActive && viewWasVisible)
-        m_process->send(Messages::WebPage::SetActive(m_pageClient->isViewWindowActive()), m_pageID);
+#if ENABLE(PAGE_VISIBILITY_API)
+        m_visibilityState = isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden;
+        m_process->send(Messages::WebPage::SetVisibilityState(m_visibilityState, false), m_pageID);
+#elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
+        PageVisibilityState visibilityState = isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden;
+        m_process->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
+#endif
+    }
 
     if (mayHaveChanged & ViewState::IsInWindow) {
-        bool isInWindow = m_pageClient->isViewInWindow();
-        if (m_isInWindow != isInWindow) {
-            m_isInWindow = isInWindow;
-            m_process->send(Messages::WebPage::SetIsInWindow(isInWindow, wantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
-        }
-
-        if (isInWindow) {
+        if (m_viewState & ViewState::IsInWindow) {
             LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
             if (m_layerHostingMode != layerHostingMode) {
                 m_layerHostingMode = layerHostingMode;
@@ -1033,18 +1033,6 @@ void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, WantsRepl
 #endif
     }
 
-#if ENABLE(PAGE_VISIBILITY_API)
-    PageVisibilityState visibilityState = PageVisibilityStateHidden;
-
-    if (m_isVisible)
-        visibilityState = PageVisibilityStateVisible;
-
-    if (visibilityState != m_visibilityState) {
-        m_visibilityState = visibilityState;
-        m_process->send(Messages::WebPage::SetVisibilityState(visibilityState, false), m_pageID);
-    }
-#endif
-
     updateBackingStoreDiscardableState();
 }
 
@@ -3836,10 +3824,7 @@ void WebPageProxy::resetStateAfterProcessExited()
 void WebPageProxy::initializeCreationParameters()
 {
     m_creationParameters.viewSize = m_pageClient->viewSize();
-    m_creationParameters.isActive = m_pageClient->isViewWindowActive();
-    m_creationParameters.isFocused = m_pageClient->isViewFocused();
-    m_creationParameters.isVisible = m_pageClient->isViewVisible();
-    m_creationParameters.isInWindow = m_pageClient->isViewInWindow();
+    m_creationParameters.viewState = m_viewState;
     m_creationParameters.drawingAreaType = m_drawingArea->type();
     m_creationParameters.store = m_pageGroup->preferences()->store();
     m_creationParameters.pageGroupData = m_pageGroup->data();
index 54fbed3..6911a32 100644 (file)
@@ -326,11 +326,11 @@ public:
 
     enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
     void viewStateDidChange(ViewState::Flags mayHaveChanged, WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
-    bool isInWindow() const { return m_isInWindow; }
+    bool isInWindow() const { return m_viewState & ViewState::IsInWindow; }
     void waitForDidUpdateInWindowState();
 
     WebCore::IntSize viewSize() const;
-    bool isViewVisible() const { return m_isVisible; }
+    bool isViewVisible() const { return m_viewState & ViewState::IsVisible; }
     bool isViewWindowActive() const;
 
     void executeEditCommand(const String& commandName);
@@ -756,6 +756,8 @@ private:
     void platformInitialize();
     void initializeCreationParameters();
 
+    void updateViewState(ViewState::Flags flagsToUpdate = ViewState::AllFlags);
+
     void resetState();
     void resetStateAfterProcessExited();
 
@@ -1088,11 +1090,7 @@ private:
 
     double m_estimatedProgress;
 
-    // Whether the web page is contained in a top-level window.
-    bool m_isInWindow;
-
-    // Whether the page is visible; if the backing view is visible and inserted into a window.
-    bool m_isVisible;
+    ViewState::Flags m_viewState;
 
     bool m_canGoBack;
     bool m_canGoForward;
index 218b353..1ed4c35 100644 (file)
@@ -60,7 +60,7 @@ CoordinatedDrawingArea::CoordinatedDrawingArea(WebPage* webPage, const WebPageCr
     , m_compositingAccordingToProxyMessages(false)
     , m_layerTreeStateIsFrozen(false)
     , m_wantsToExitAcceleratedCompositingMode(false)
-    , m_isPaintingSuspended(!parameters.isVisible)
+    , m_isPaintingSuspended(!(parameters.viewState & ViewState::IsVisible))
     , m_displayTimer(RunLoop::main(), this, &CoordinatedDrawingArea::displayTimerFired)
     , m_exitCompositingTimer(RunLoop::main(), this, &CoordinatedDrawingArea::exitAcceleratedCompositingMode)
 {
index 3722bf3..0abead9 100644 (file)
@@ -57,7 +57,7 @@ DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParamete
     , m_compositingAccordingToProxyMessages(false)
     , m_layerTreeStateIsFrozen(false)
     , m_wantsToExitAcceleratedCompositingMode(false)
-    , m_isPaintingSuspended(!parameters.isVisible)
+    , m_isPaintingSuspended(!(parameters.viewState & ViewState::IsVisible))
     , m_alwaysUseCompositing(false)
     , m_displayTimer(RunLoop::main(), this, &DrawingAreaImpl::displayTimerFired)
     , m_exitCompositingTimer(RunLoop::main(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
index 2c4a677..465d773 100644 (file)
@@ -281,6 +281,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     , m_maximumRenderingSuppressionToken(0)
     , m_scrollPinningBehavior(DoNotPin)
     , m_useThreadedScrolling(false)
+    , m_viewState(parameters.viewState)
 {
     ASSERT(m_pageID);
     // FIXME: This is a non-ideal location for this Setting and
@@ -364,16 +365,17 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 
     setMemoryCacheMessagesEnabled(parameters.areMemoryCacheClientCallsEnabled);
 
-    setActive(parameters.isActive);
-    setFocused(parameters.isFocused);
+    setActive(parameters.viewState & ViewState::WindowIsActive);
+    setFocused(parameters.viewState & ViewState::IsFocused);
 
     // Page defaults to in-window, but setIsInWindow depends on it being a valid indicator of actually having been put into a window.
-    if (!parameters.isInWindow)
+    bool isInWindow = parameters.viewState & ViewState::IsInWindow;
+    if (!isInWindow)
         m_page->setIsInWindow(false);
     else
         WebProcess::shared().pageDidEnterWindow(m_pageID);
 
-    setIsInWindow(parameters.isInWindow);
+    setIsInWindow(isInWindow);
 
     setMinimumLayoutSize(parameters.minimumLayoutSize);
     setAutoSizingShouldExpandToViewHeight(parameters.autoSizingShouldExpandToViewHeight);
@@ -1983,7 +1985,7 @@ inline bool WebPage::canHandleUserEvents() const
     return true;
 }
 
-void WebPage::setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState)
+void WebPage::setIsInWindow(bool isInWindow)
 {
     bool pageWasInWindow = m_page->isInWindow();
     
@@ -2011,8 +2013,30 @@ void WebPage::setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowStat
 
     if (isInWindow)
         layoutIfNeeded();
+}
+
+void WebPage::setViewState(ViewState::Flags viewState, bool wantsDidUpdateInWindowState)
+{
+    ViewState::Flags changed = m_viewState ^ viewState;
+
+    // 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::WindowIsVisible)
+        setWindowIsVisible(viewState & ViewState::WindowIsVisible);
+    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);
+
+    m_viewState = viewState;
 
-    if (wantsDidUpdateViewInWindowState)
+    if (wantsDidUpdateInWindowState)
         m_sendDidUpdateInWindowStateTimer.startOneShot(0);
 }
 
index 2df01e7..a1f8b64 100644 (file)
@@ -49,6 +49,7 @@
 #include "Plugin.h"
 #include "SandboxExtension.h"
 #include "ShareableBitmap.h"
+#include "ViewState.h"
 #include "WebUndoStep.h"
 #include <WebCore/DictationAlternative.h>
 #include <WebCore/DragData.h>
@@ -683,7 +684,8 @@ private:
     void setWindowIsVisible(bool);
     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
     void setWindowResizerSize(const WebCore::IntSize&);
-    void setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState = false);
+    void setIsInWindow(bool);
+    void setViewState(ViewState::Flags, bool wantsDidUpdateInWindowState);
     void validateCommand(const String&, uint64_t);
     void executeEditCommand(const String&);
 
@@ -991,6 +993,8 @@ private:
     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
 
     bool m_useThreadedScrolling;
+
+    ViewState::Flags m_viewState;
 };
 
 } // namespace WebKit
index a06e4fd..867750f 100644 (file)
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> WebPage LegacyReceiver {
-    SetActive(bool active)
-    SetFocused(bool focused)
-    SetViewIsVisible(bool visible)
     SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event)
-    SetIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState)
+    SetViewState(unsigned viewState, bool wantsDidUpdateInWindowState)
 
     SetDrawsBackground(bool drawsBackground)
     SetDrawsTransparentBackground(bool drawsTransparentBackground)
@@ -245,8 +242,6 @@ messages -> WebPage LegacyReceiver {
     CancelComposition()
 #endif
 
-    SetWindowIsVisible(bool windowIsVisible)
-
 #if PLATFORM(MAC)
     # Complex text input support for plug-ins.
     SendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, String textInput)
index 0f564b1..e85e257 100644 (file)
@@ -64,7 +64,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c
     : DrawingArea(DrawingAreaTypeTiledCoreAnimation, webPage)
     , m_layerTreeStateIsFrozen(false)
     , m_layerFlushScheduler(this)
-    , m_isPaintingSuspended(!parameters.isVisible)
+    , m_isPaintingSuspended(!(parameters.viewState & ViewState::IsVisible))
     , m_clipsToExposedRect(false)
     , m_updateIntrinsicContentSizeTimer(this, &TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeTimerFired)
 {