Title: [157967] trunk/Source/WebKit2
Revision
157967
Author
[email protected]
Date
2013-10-24 17:42:04 -0700 (Thu, 24 Oct 2013)

Log Message

SetIsVisible message should be sent to WebPage
https://bugs.webkit.org/show_bug.cgi?id=123296

Reviewed by Tim Horton.

* UIProcess/DrawingAreaProxy.h:
    - remove visibilityDidChange - WebPageProxy now mesages WebPage.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewStateDidChange):
    - Send view visibility updates to the WebPage, not the drawing area.
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
    - remove visibilityDidChange - WebPageProxy now mesages WebPage.
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::suspendPainting):
(WebKit::DrawingArea::resumePainting):
* WebProcess/WebPage/DrawingArea.messages.in:
    - Instead of suspendPainting/resumePainting being private in the WebProcess but avaialble to the UIProcess,
      make them private to the WebProcess but accessible from WebPage.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setViewIsVisible):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
    - Added SetViewIsVisible message.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
    - Instead of suspendPainting/resumePainting being private in the WebProcess but avaialble to the UIProcess,
      make them private to the WebProcess but accessible from WebPage.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::suspendPainting):
(WebKit::TiledCoreAnimationDrawingArea::resumePainting):
    - Moved animation suspend code out to WebPage.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (157966 => 157967)


--- trunk/Source/WebKit2/ChangeLog	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/ChangeLog	2013-10-25 00:42:04 UTC (rev 157967)
@@ -1,3 +1,37 @@
+2013-10-24  Gavin Barraclough  <[email protected]>
+
+        SetIsVisible message should be sent to WebPage
+        https://bugs.webkit.org/show_bug.cgi?id=123296
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/DrawingAreaProxy.h:
+            - remove visibilityDidChange - WebPageProxy now mesages WebPage.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::viewStateDidChange):
+            - Send view visibility updates to the WebPage, not the drawing area.
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+            - remove visibilityDidChange - WebPageProxy now mesages WebPage.
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::suspendPainting):
+        (WebKit::DrawingArea::resumePainting):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+            - Instead of suspendPainting/resumePainting being private in the WebProcess but avaialble to the UIProcess,
+              make them private to the WebProcess but accessible from WebPage.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setViewIsVisible):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+            - Added SetViewIsVisible message.
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+            - Instead of suspendPainting/resumePainting being private in the WebProcess but avaialble to the UIProcess,
+              make them private to the WebProcess but accessible from WebPage.
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::suspendPainting):
+        (WebKit::TiledCoreAnimationDrawingArea::resumePainting):
+            - Moved animation suspend code out to WebPage.
+
 2013-10-24  Dan Bernstein  <[email protected]>
 
         Tried to fix the Mountain Lion build.

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (157966 => 157967)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2013-10-25 00:42:04 UTC (rev 157967)
@@ -53,7 +53,6 @@
     virtual void deviceScaleFactorDidChange() = 0;
 
     // FIXME: These should be pure virtual.
-    virtual void visibilityDidChange() { }
     virtual void layerHostingModeDidChange() { }
 
     virtual void setBackingStoreIsDiscardable(bool) { }

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (157966 => 157967)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-10-25 00:42:04 UTC (rev 157967)
@@ -1007,7 +1007,7 @@
         if (isVisible != m_isVisible) {
             m_isVisible = isVisible;
             m_process->pageVisibilityChanged(this);
-            m_drawingArea->visibilityDidChange();
+            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

Modified: trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h (157966 => 157967)


--- trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h	2013-10-25 00:42:04 UTC (rev 157967)
@@ -39,7 +39,6 @@
     // DrawingAreaProxy
     virtual void deviceScaleFactorDidChange() OVERRIDE;
     virtual void layerHostingModeDidChange() OVERRIDE;
-    virtual void visibilityDidChange() OVERRIDE;
     virtual void sizeDidChange() OVERRIDE;
     virtual void waitForPossibleGeometryUpdate(double timeout = didUpdateBackingStoreStateTimeout) OVERRIDE;
     virtual void colorSpaceDidChange() OVERRIDE;

Modified: trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm (157966 => 157967)


--- trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm	2013-10-25 00:42:04 UTC (rev 157967)
@@ -52,14 +52,6 @@
     m_webPageProxy->process()->send(Messages::DrawingArea::SetDeviceScaleFactor(m_webPageProxy->deviceScaleFactor()), m_webPageProxy->pageID());
 }
 
-void TiledCoreAnimationDrawingAreaProxy::visibilityDidChange()
-{
-    if (!m_webPageProxy->isViewVisible())
-        m_webPageProxy->process()->send(Messages::DrawingArea::SuspendPainting(), m_webPageProxy->pageID());
-    else
-        m_webPageProxy->process()->send(Messages::DrawingArea::ResumePainting(), m_webPageProxy->pageID());
-}
-
 void TiledCoreAnimationDrawingAreaProxy::layerHostingModeDidChange()
 {
     m_webPageProxy->process()->send(Messages::DrawingArea::SetLayerHostingMode(m_webPageProxy->layerHostingMode()), m_webPageProxy->pageID());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2013-10-25 00:42:04 UTC (rev 157967)
@@ -104,6 +104,9 @@
 
     virtual void dispatchAfterEnsuringUpdatedScrollPosition(const Function<void ()>&);
 
+    virtual void suspendPainting() { }
+    virtual void resumePainting() { }
+
 protected:
     DrawingArea(DrawingAreaType, WebPage*);
 
@@ -116,8 +119,6 @@
     virtual void updateBackingStoreState(uint64_t /*backingStoreStateID*/, bool /*respondImmediately*/, float /*deviceScaleFactor*/, const WebCore::IntSize& /*size*/, 
                                          const WebCore::IntSize& /*scrollOffset*/) { }
     virtual void didUpdate() { }
-    virtual void suspendPainting() { }
-    virtual void resumePainting() { }
     virtual void setLayerHostingMode(uint32_t) { }
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2013-10-25 00:42:04 UTC (rev 157967)
@@ -23,8 +23,6 @@
 messages -> DrawingArea LegacyReceiver {
     UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, WebCore::IntSize size, WebCore::IntSize scrollOffset)
     DidUpdate()
-    SuspendPainting()
-    ResumePainting()
     SetLayerHostingMode(uint32_t layerHostingMode)
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-10-25 00:42:04 UTC (rev 157967)
@@ -1851,6 +1851,22 @@
 #endif
 }
 
+void WebPage::setViewIsVisible(bool isVisible)
+{
+    if (!isVisible) {
+        m_drawingArea->suspendPainting();
+        m_page->suspendScriptedAnimations();
+    } else {
+        m_drawingArea->resumePainting();
+        // FIXME: this seems redundant; for the view to be visible the window must be visible too!
+        // refactoring for now, will change the logic later.
+        if (m_windowIsVisible) {
+            m_page->resumeScriptedAnimations();
+            m_page->resumeAnimatingImages();
+        }
+    }
+}
+
 void WebPage::setDrawsBackground(bool drawsBackground)
 {
     if (m_drawsBackground == drawsBackground)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-10-25 00:42:04 UTC (rev 157967)
@@ -678,6 +678,7 @@
     void tryRestoreScrollPosition();
     void setActive(bool);
     void setFocused(bool);
+    void setViewIsVisible(bool);
     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
     void setWindowResizerSize(const WebCore::IntSize&);
     void setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState = false);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-10-25 00:42:04 UTC (rev 157967)
@@ -23,6 +23,7 @@
 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)
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2013-10-25 00:42:04 UTC (rev 157967)
@@ -53,6 +53,9 @@
     TiledCoreAnimationDrawingArea(WebPage*, const WebPageCreationParameters&);
     virtual ~TiledCoreAnimationDrawingArea();
 
+    virtual void suspendPainting() OVERRIDE;
+    virtual void resumePainting() OVERRIDE;
+
 private:
     // DrawingArea
     virtual void setNeedsDisplay() OVERRIDE;
@@ -94,8 +97,6 @@
     virtual bool flushLayers() OVERRIDE;
 
     // Message handlers.
-    virtual void suspendPainting() OVERRIDE;
-    virtual void resumePainting() OVERRIDE;
     virtual void updateGeometry(const WebCore::IntSize& viewSize, const WebCore::IntSize& layerPosition) OVERRIDE;
     virtual void setDeviceScaleFactor(float) OVERRIDE;
     virtual void setLayerHostingMode(uint32_t) OVERRIDE;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (157966 => 157967)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2013-10-25 00:15:38 UTC (rev 157966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2013-10-25 00:42:04 UTC (rev 157967)
@@ -388,8 +388,6 @@
 
     [m_rootLayer.get() setValue:(id)kCFBooleanTrue forKey:@"NSCAViewRenderPaused"];
     [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidPauseNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:m_rootLayer.get() forKey:@"layer"]];
-
-    m_webPage->corePage()->suspendScriptedAnimations();
 }
 
 void TiledCoreAnimationDrawingArea::resumePainting()
@@ -403,11 +401,6 @@
 
     [m_rootLayer.get() setValue:(id)kCFBooleanFalse forKey:@"NSCAViewRenderPaused"];
     [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidResumeNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:m_rootLayer.get() forKey:@"layer"]];
-
-    if (m_webPage->windowIsVisible()) {
-        m_webPage->corePage()->resumeScriptedAnimations();
-        m_webPage->corePage()->resumeAnimatingImages();
-    }
 }
 
 void TiledCoreAnimationDrawingArea::setExposedRect(const FloatRect& exposedRect)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to