Changeset 123786 in webkit


Ignore:
Timestamp:
Jul 26, 2012 1:15:53 PM (12 years ago)
Author:
zeno.albisser@nokia.com
Message:

[Qt] requestAnimationFrame should only trigger when a new frame can be displayed.
https://bugs.webkit.org/show_bug.cgi?id=88638

Source/WebKit/qt:

Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
the servicing of scripted animations to the renderNextFrame call for WK2.
For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.

Reviewed by Jocelyn Turcotte.

  • WebCoreSupport/ChromeClientQt.cpp:

(RefreshAnimation):

Add a RefreshAnimation that is based on QAbstractAnimation
and drives the servicing of the scripted animations for WK1.

(WebCore::RefreshAnimation::RefreshAnimation):
(WebCore::RefreshAnimation::duration):
(WebCore::RefreshAnimation::scheduleAnimation):

Set m_animationScheduled to true and start the animation
timer in case it is not running yet.

(WebCore::RefreshAnimation::updateCurrentTime):

Call serviceScriptedAnimations if m_animationScheduled is true.
If this is not the case, the animation timer can be stopped,
because no animation needs to be scheduled anymore.

(WebCore):
(WebCore::ChromeClientQt::scheduleAnimation):

Create and start the RefreshAnimation instance with the
first call to scheduleAnimation.

  • WebCoreSupport/ChromeClientQt.h:

(WebCore):
(ChromeClientQt):

Source/WebKit2:

Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
the servicing of scripted animations to layer syncing for WK2.
For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.

Reviewed by Jocelyn Turcotte.

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit):
(WebKit::WebChromeClient::scheduleAnimation):

  • WebProcess/WebCoreSupport/WebChromeClient.h:

(WebChromeClient):

  • WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp:

(WebKit::LayerTreeCoordinator::performScheduledLayerFlush):
(WebKit::LayerTreeCoordinator::scheduleAnimation):
(WebKit):

  • WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h:

(LayerTreeCoordinator):

  • WebProcess/WebPage/LayerTreeHost.h:

(LayerTreeHost):

Source/WTF:

Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
the servicing of scripted animations to layer syncing for WK2.
For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.

Reviewed by Jocelyn Turcotte.

  • wtf/Platform.h:
Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r123744 r123786  
     12012-07-26  Zeno Albisser  <zeno@webkit.org>
     2
     3        [Qt] requestAnimationFrame should only trigger when a new frame can be displayed.
     4        https://bugs.webkit.org/show_bug.cgi?id=88638
     5
     6        Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
     7        the servicing of scripted animations to layer syncing for WK2.
     8        For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.
     9
     10        Reviewed by Jocelyn Turcotte.
     11
     12        * wtf/Platform.h:
     13
    1142012-07-26  Yury Semikhatsky  <yurys@chromium.org>
    215
  • trunk/Source/WTF/wtf/Platform.h

    r123590 r123786  
    11061106#endif
    11071107
    1108 #if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(QT) || PLATFORM(BLACKBERRY)
     1108#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(BLACKBERRY)
    11091109#define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1
    11101110#endif
  • trunk/Source/WebKit/qt/ChangeLog

    r123711 r123786  
     12012-07-26  Zeno Albisser  <zeno@webkit.org>
     2
     3        [Qt] requestAnimationFrame should only trigger when a new frame can be displayed.
     4        https://bugs.webkit.org/show_bug.cgi?id=88638
     5
     6        Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
     7        the servicing of scripted animations to the renderNextFrame call for WK2.
     8        For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.
     9
     10        Reviewed by Jocelyn Turcotte.
     11
     12        * WebCoreSupport/ChromeClientQt.cpp:
     13        (RefreshAnimation):
     14            Add a RefreshAnimation that is based on QAbstractAnimation
     15            and drives the servicing of the scripted animations for WK1.
     16        (WebCore::RefreshAnimation::RefreshAnimation):
     17        (WebCore::RefreshAnimation::duration):
     18        (WebCore::RefreshAnimation::scheduleAnimation):
     19            Set m_animationScheduled to true and start the animation
     20            timer in case it is not running yet.
     21        (WebCore::RefreshAnimation::updateCurrentTime):
     22            Call serviceScriptedAnimations if m_animationScheduled is true.
     23            If this is not the case, the animation timer can be stopped,
     24            because no animation needs to be scheduled anymore.
     25        (WebCore):
     26        (WebCore::ChromeClientQt::scheduleAnimation):
     27            Create and start the RefreshAnimation instance with the
     28            first call to scheduleAnimation.
     29        * WebCoreSupport/ChromeClientQt.h:
     30        (WebCore):
     31        (ChromeClientQt):
     32
    1332012-07-26  Kaustubh Atrawalkar  <kaustubh@motorola.com>
    234
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r123458 r123786  
    7171#include "qwebsecurityorigin_p.h"
    7272#include "qwebview.h"
     73#include <qabstractanimation.h>
    7374#include <qdebug.h>
    7475#include <qeventloop.h>
     
    8889
    8990namespace WebCore {
     91
     92class RefreshAnimation : public QAbstractAnimation {
     93public:
     94    RefreshAnimation(ChromeClientQt* chromeClient)
     95        : QAbstractAnimation()
     96        , m_chromeClient(chromeClient)
     97        , m_animationScheduled(false)
     98    { }
     99
     100    virtual int duration() const { return -1; }
     101
     102    void scheduleAnimation()
     103    {
     104        m_animationScheduled = true;
     105        if (state() != QAbstractAnimation::Running)
     106            start();
     107    }
     108
     109protected:
     110    virtual void updateCurrentTime(int currentTime)
     111    {
     112        UNUSED_PARAM(currentTime);
     113        if (m_animationScheduled) {
     114            m_animationScheduled = false;
     115            m_chromeClient->serviceScriptedAnimations();
     116        } else
     117            stop();
     118    }
     119private:
     120    ChromeClientQt* m_chromeClient;
     121    bool m_animationScheduled;
     122};
    90123
    91124bool ChromeClientQt::dumpVisitedLinksCallbacks = false;
     
    619652}
    620653
     654void ChromeClientQt::scheduleAnimation()
     655{
     656    if (!m_refreshAnimation)
     657        m_refreshAnimation = adoptPtr(new RefreshAnimation(this));
     658    m_refreshAnimation->scheduleAnimation();
     659}
     660
     661void ChromeClientQt::serviceScriptedAnimations()
     662{
     663    m_webPage->mainFrame()->d->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
     664}
    621665
    622666#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r123354 r123786  
    5050class FloatRect;
    5151class Page;
     52class RefreshAnimation;
    5253struct FrameLoadRequest;
    5354class QtAbstractWebPopup;
     
    177178    virtual void setCursorHiddenUntilMouseMoves(bool) { }
    178179
     180    virtual void scheduleAnimation();
     181    virtual void serviceScriptedAnimations();
     182
    179183    virtual void scrollRectIntoView(const LayoutRect) const { }
    180184
     
    202206    bool menuBarVisible;
    203207    QEventLoop* m_eventLoop;
     208    OwnPtr<RefreshAnimation> m_refreshAnimation;
    204209
    205210#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT))
  • trunk/Source/WebKit2/ChangeLog

    r123782 r123786  
     12012-07-26  Zeno Albisser  <zeno@webkit.org>
     2
     3        [Qt] requestAnimationFrame should only trigger when a new frame can be displayed.
     4        https://bugs.webkit.org/show_bug.cgi?id=88638
     5
     6        Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
     7        the servicing of scripted animations to layer syncing for WK2.
     8        For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.
     9
     10        Reviewed by Jocelyn Turcotte.
     11
     12        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     13        (WebKit):
     14        (WebKit::WebChromeClient::scheduleAnimation):
     15        * WebProcess/WebCoreSupport/WebChromeClient.h:
     16        (WebChromeClient):
     17        * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp:
     18        (WebKit::LayerTreeCoordinator::performScheduledLayerFlush):
     19        (WebKit::LayerTreeCoordinator::scheduleAnimation):
     20        (WebKit):
     21        * WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h:
     22        (LayerTreeCoordinator):
     23        * WebProcess/WebPage/LayerTreeHost.h:
     24        (LayerTreeHost):
     25
    1262012-07-26  Jer Noble  <jer.noble@apple.com>
    227
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r123778 r123786  
    636636}
    637637
     638#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
     639void WebChromeClient::scheduleAnimation()
     640{
     641#if USE(UI_SIDE_COMPOSITING)
     642    m_page->drawingArea()->layerTreeHost()->scheduleAnimation();
     643#endif
     644}
     645#endif
     646
    638647void WebChromeClient::formStateDidChange(const Node*)
    639648{
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r123778 r123786  
    163163    virtual void setCursor(const WebCore::Cursor&) OVERRIDE;
    164164    virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE;
     165#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
     166    virtual void scheduleAnimation() OVERRIDE;
     167#endif
    165168
    166169    // Notification that the given form element has changed. This function
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.cpp

    r122720 r123786  
    357357    if (m_isSuspended || m_waitingForUIProcess)
    358358        return;
     359#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     360    // Make sure that any previously registered animation callbacks are being executed before we flush the layers.
     361    m_webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
     362#endif
    359363
    360364    m_webPage->layoutIfNeeded();
     
    543547    if (contentsRectDidChange)
    544548        m_shouldSendScrollPositionUpdate = true;
     549}
     550
     551void LayerTreeCoordinator::scheduleAnimation()
     552{
     553    scheduleLayerFlush();
    545554}
    546555
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeCoordinator/LayerTreeCoordinator.h

    r122340 r123786  
    8787
    8888    virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, ShareableSurface::Handle&, WebCore::IntPoint&);
     89    virtual void scheduleAnimation() OVERRIDE;
    8990
    9091protected:
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h

    r122676 r123786  
    106106#endif
    107107
     108#if USE(UI_SIDE_COMPOSITING)
     109    virtual void scheduleAnimation() = 0;
     110#endif
     111
    108112protected:
    109113    explicit LayerTreeHost(WebPage*);
Note: See TracChangeset for help on using the changeset viewer.