Changeset 116422 in webkit


Ignore:
Timestamp:
May 8, 2012 7:59:58 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[WK2] Integrate Page Visibility state change and WK2 Suspend/Resume API
https://bugs.webkit.org/show_bug.cgi?id=85650

Patch by Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> on 2012-05-08
Reviewed by Kenneth Rohde Christiansen.

This patch uses state changes of the Page Visibility API to trigger the
automatic suspension/resume of animations on the WebPage and its main frame,
in the same fashion of what is used by the Suspend/Resume API of WebKit2.
By telling the WebPage it will move off/on the screen and the FrameView to
hide/show, this patch is suspending/resuming animations (animated painting)
but not timers and other active DOM objects.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setVisibilityState):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r116420 r116422  
     12012-05-08  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
     2
     3        [WK2] Integrate Page Visibility state change and WK2 Suspend/Resume API
     4        https://bugs.webkit.org/show_bug.cgi?id=85650
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        This patch uses state changes of the Page Visibility API to trigger the
     9        automatic suspension/resume of animations on the WebPage and its main frame,
     10        in the same fashion of what is used by the Suspend/Resume API of WebKit2.
     11        By telling the WebPage it will move off/on the screen and the FrameView to
     12        hide/show, this patch is suspending/resuming animations (animated painting)
     13        but not timers and other active DOM objects.
     14
     15        * WebProcess/WebPage/WebPage.cpp:
     16        (WebKit::WebPage::setVisibilityState):
     17
    1182012-05-08  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    219
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r116230 r116422  
    225225    , m_gestureReachedScrollingLimit(false)
    226226#endif
     227#if ENABLE(PAGE_VISIBILITY_API)
     228    , m_visibilityState(WebCore::PageVisibilityStateVisible)
     229#endif
    227230{
    228231    ASSERT(m_pageID);
     
    31583161    if (!m_page)
    31593162        return;
    3160     m_page->setVisibilityState(static_cast<WebCore::PageVisibilityState>(visibilityState), isInitialState);
     3163
     3164    WebCore::PageVisibilityState state = static_cast<WebCore::PageVisibilityState>(visibilityState);
     3165
     3166    if (m_visibilityState == state)
     3167        return;
     3168
     3169    FrameView* view = m_page->mainFrame() ? m_page->mainFrame()->view() : 0;
     3170
     3171    if (state == WebCore::PageVisibilityStateVisible) {
     3172        m_page->didMoveOnscreen();
     3173        if (view)
     3174            view->show();
     3175    }
     3176
     3177    m_page->setVisibilityState(state, isInitialState);
     3178    m_visibilityState = state;
     3179
     3180    if (state == WebCore::PageVisibilityStateHidden) {
     3181        m_page->willMoveOffscreen();
     3182        if (view)
     3183            view->hide();
     3184    }
    31613185}
    31623186#endif
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r115145 r116422  
    5353#include <WebCore/FrameLoaderTypes.h>
    5454#include <WebCore/IntRect.h>
     55#if ENABLE(PAGE_VISIBILITY_API)
     56#include <WebCore/PageVisibilityState.h>
     57#endif
    5558#include <WebCore/PlatformScreen.h>
    5659#include <WebCore/ScrollTypes.h>
     
    829832    HashMap<String, QtNetworkReply*> m_applicationSchemeReplies;
    830833#endif
     834#if ENABLE(PAGE_VISIBILITY_API)
     835    WebCore::PageVisibilityState m_visibilityState;
     836#endif
    831837};
    832838
Note: See TracChangeset for help on using the changeset viewer.