Changeset 233140 in webkit


Ignore:
Timestamp:
Jun 25, 2018 2:54:34 AM (6 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Ensure animations are updated prior to requestAnimationFrame callbacks
https://bugs.webkit.org/show_bug.cgi?id=186997
<rdar://problem/41419414>

Reviewed by Dean Jackson.

LayoutTests/imported/mozilla:

Mark progressions in the Mozilla CSS Animations tests.

  • css-animations/test_animation-pausing-expected.txt:

Source/WebCore:

Some sub-tests of imported/mozilla/css-animations/test_animation-pausing.html clearly expect that animations
would be resolved prior to firing a requestAnimationFrame() callback, as the HTML5 event loop mandates. But until
now, both DocumentTimeline and ScriptedAnimationController would make calls to DisplayRefreshMonitorManager::scheduleAnimation()
that were not coordinated and so the order in which the DocumentTimeline and ScriptedAnimationController callbacks
were performed was not guaranteed.

In this patch we add a new DocumentAnimationScheduler class which is created by a Document to manage this specific
situation. Now DocumentTimeline and ScriptedAnimationController use this supporting object instead of being their
own DisplayRefreshMonitorClient and call scheduleWebAnimationsResolution() and scheduleScriptedAnimationResolution()
respectively to indicate the need to schedule an animation through the DisplayRefreshMonitorManager to serve the specific
needs of either, or both, classes. Then DocumentAnimationScheduler ensures that Web Animations resolution happens
prior to requestAnimationFrame callbacks when both are scheduled.

In the future we should be able to move more code from DocumentTimeline and ScriptedAnimationController over to
DocumentAnimationScheduler, such as support for throttling and using a timer-based fallback, but this patch provides
the minimal functionality required to provide a sounder foundation.

  • Modules/webvr/VRDisplay.cpp:

(WebCore::VRDisplay::requestAnimationFrame):

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • animation/DocumentAnimationScheduler.cpp: Added.

(WebCore::DocumentAnimationScheduler::create):
(WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler):
(WebCore::DocumentAnimationScheduler::detachFromDocument):
(WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution):
(WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution):
(WebCore::DocumentAnimationScheduler::displayRefreshFired):
(WebCore::DocumentAnimationScheduler::windowScreenDidChange):
(WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const):

  • animation/DocumentAnimationScheduler.h: Copied from Source/WebCore/animation/CSSAnimation.h.
  • animation/DocumentTimeline.cpp:

(WebCore::DocumentTimeline::create):
(WebCore::DocumentTimeline::DocumentTimeline):
(WebCore::DocumentTimeline::scheduleAnimationResolution):
(WebCore::DocumentTimeline::windowScreenDidChange): Deleted.
(WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Deleted.

  • animation/DocumentTimeline.h:
  • dom/Document.cpp:

(WebCore::Document::prepareForDestruction):
(WebCore::Document::windowScreenDidChange):
(WebCore::Document::requestAnimationFrame):
(WebCore::Document::animationScheduler):
(WebCore::Document::timeline):

  • dom/Document.h:
  • dom/ScriptedAnimationController.cpp:

(WebCore::ScriptedAnimationController::ScriptedAnimationController):
(WebCore::ScriptedAnimationController::scheduleAnimation):
(WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
(WebCore::ScriptedAnimationController::windowScreenDidChange): Deleted.
(WebCore::ScriptedAnimationController::displayRefreshFired): Deleted.
(WebCore::ScriptedAnimationController::createDisplayRefreshMonitor const): Deleted.

  • dom/ScriptedAnimationController.h:

(WebCore::ScriptedAnimationController::create):

Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/mozilla/ChangeLog

    r233051 r233140  
     12018-06-25  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Ensure animations are updated prior to requestAnimationFrame callbacks
     4        https://bugs.webkit.org/show_bug.cgi?id=186997
     5        <rdar://problem/41419414>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Mark progressions in the Mozilla CSS Animations tests.
     10
     11        * css-animations/test_animation-pausing-expected.txt:
     12
    1132018-06-20  Antoine Quint  <graouts@apple.com>
    214
  • trunk/LayoutTests/imported/mozilla/css-animations/test_animation-pausing-expected.txt

    r229864 r233140  
    11
    22PASS play() overrides animation-play-state
    3 FAIL pause() overrides animation-play-state undefined is not an object (evaluating 'animation.pause')
    4 FAIL play() is overridden by later setting "animation-play-state: paused" undefined is not an object (evaluating 'animation.play')
    5 FAIL play() flushes pending changes to animation-play-state first assert_greater_than: Playing value of margin-left is increasing expected a number greater than 0 but got 0
    6 FAIL pause() applies pending changes to animation-play-state first undefined is not an object (evaluating 'animation.pause')
    7 FAIL Setting the current time completes a pending pause assert_true: Animation is pause-pending expected true got false
     3FAIL pause() overrides animation-play-state assert_equals: Paused value of margin-left is zero expected 0 but got 0.03600386157631874
     4PASS play() is overridden by later setting "animation-play-state: paused"
     5PASS play() flushes pending changes to animation-play-state first
     6PASS pause() applies pending changes to animation-play-state first
     7PASS Setting the current time completes a pending pause
    88
  • trunk/Source/WebCore/ChangeLog

    r233138 r233140  
     12018-06-25  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Ensure animations are updated prior to requestAnimationFrame callbacks
     4        https://bugs.webkit.org/show_bug.cgi?id=186997
     5        <rdar://problem/41419414>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Some sub-tests of imported/mozilla/css-animations/test_animation-pausing.html clearly expect that animations
     10        would be resolved prior to firing a requestAnimationFrame() callback, as the HTML5 event loop mandates. But until
     11        now, both DocumentTimeline and ScriptedAnimationController would make calls to DisplayRefreshMonitorManager::scheduleAnimation()
     12        that were not coordinated and so the order in which the DocumentTimeline and ScriptedAnimationController callbacks
     13        were performed was not guaranteed.
     14
     15        In this patch we add a new DocumentAnimationScheduler class which is created by a Document to manage this specific
     16        situation. Now DocumentTimeline and ScriptedAnimationController use this supporting object instead of being their
     17        own DisplayRefreshMonitorClient and call scheduleWebAnimationsResolution() and scheduleScriptedAnimationResolution()
     18        respectively to indicate the need to schedule an animation through the DisplayRefreshMonitorManager to serve the specific
     19        needs of either, or both, classes. Then DocumentAnimationScheduler ensures that Web Animations resolution happens
     20        prior to requestAnimationFrame callbacks when both are scheduled.
     21
     22        In the future we should be able to move more code from DocumentTimeline and ScriptedAnimationController over to
     23        DocumentAnimationScheduler, such as support for throttling and using a timer-based fallback, but this patch provides
     24        the minimal functionality required to provide a sounder foundation.
     25
     26        * Modules/webvr/VRDisplay.cpp:
     27        (WebCore::VRDisplay::requestAnimationFrame):
     28        * Sources.txt:
     29        * WebCore.xcodeproj/project.pbxproj:
     30        * animation/DocumentAnimationScheduler.cpp: Added.
     31        (WebCore::DocumentAnimationScheduler::create):
     32        (WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler):
     33        (WebCore::DocumentAnimationScheduler::detachFromDocument):
     34        (WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution):
     35        (WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution):
     36        (WebCore::DocumentAnimationScheduler::displayRefreshFired):
     37        (WebCore::DocumentAnimationScheduler::windowScreenDidChange):
     38        (WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const):
     39        * animation/DocumentAnimationScheduler.h: Copied from Source/WebCore/animation/CSSAnimation.h.
     40        * animation/DocumentTimeline.cpp:
     41        (WebCore::DocumentTimeline::create):
     42        (WebCore::DocumentTimeline::DocumentTimeline):
     43        (WebCore::DocumentTimeline::scheduleAnimationResolution):
     44        (WebCore::DocumentTimeline::windowScreenDidChange): Deleted.
     45        (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Deleted.
     46        * animation/DocumentTimeline.h:
     47        * dom/Document.cpp:
     48        (WebCore::Document::prepareForDestruction):
     49        (WebCore::Document::windowScreenDidChange):
     50        (WebCore::Document::requestAnimationFrame):
     51        (WebCore::Document::animationScheduler):
     52        (WebCore::Document::timeline):
     53        * dom/Document.h:
     54        * dom/ScriptedAnimationController.cpp:
     55        (WebCore::ScriptedAnimationController::ScriptedAnimationController):
     56        (WebCore::ScriptedAnimationController::scheduleAnimation):
     57        (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
     58        (WebCore::ScriptedAnimationController::windowScreenDidChange): Deleted.
     59        (WebCore::ScriptedAnimationController::displayRefreshFired): Deleted.
     60        (WebCore::ScriptedAnimationController::createDisplayRefreshMonitor const): Deleted.
     61        * dom/ScriptedAnimationController.h:
     62        (WebCore::ScriptedAnimationController::create):
     63
    1642018-06-25  Zan Dobersek  <zdobersek@igalia.com>
    265
  • trunk/Source/WebCore/Modules/webvr/VRDisplay.cpp

    r233122 r233140  
    111111    if (!m_scriptedAnimationController) {
    112112        auto* document = downcast<Document>(scriptExecutionContext());
    113 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    114         // FIXME: Get the display id of the HMD as it should use the HMD native refresh rate.
    115         PlatformDisplayID displayID = document->page() ? document->page()->chrome().displayID() : 0;
    116         m_scriptedAnimationController = ScriptedAnimationController::create(*document, displayID);
    117 #else
    118         m_scriptedAnimationController = ScriptedAnimationController::create(*document, 0);
    119 #endif
     113        m_scriptedAnimationController = ScriptedAnimationController::create(*document);
    120114    }
    121115
  • trunk/Source/WebCore/Sources.txt

    r233053 r233140  
    340340animation/CSSTransition.cpp
    341341animation/DeclarativeAnimation.cpp
     342animation/DocumentAnimationScheduler.cpp
    342343animation/DocumentTimeline.cpp
    343344animation/KeyframeEffect.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r233116 r233140  
    20262026                715AD7202050513200D592DC /* DeclarativeAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 715AD71D2050512400D592DC /* DeclarativeAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20272027                715AD7212050513F00D592DC /* CSSTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 7123C186204739BA00789392 /* CSSTransition.h */; };
     2028                716E55B020DBABF100F0CF29 /* DocumentAnimationScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 716E55AD20DBABDC00F0CF29 /* DocumentAnimationScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
    20282029                71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
    20292030                71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; };
     
    90599060                716C8DF71E48B2B5005BD0DA /* volume-up-fullscreen@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "volume-up-fullscreen@1x.png"; sourceTree = "<group>"; };
    90609061                716C8DF81E48B2B5005BD0DA /* volume-up-fullscreen@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "volume-up-fullscreen@2x.png"; sourceTree = "<group>"; };
     9062                716E55AD20DBABDC00F0CF29 /* DocumentAnimationScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentAnimationScheduler.h; sourceTree = "<group>"; };
     9063                716E55AF20DBABDD00F0CF29 /* DocumentAnimationScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentAnimationScheduler.cpp; sourceTree = "<group>"; };
    90619064                716FA0D81DB26591007323CC /* airplay-button.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "airplay-button.css"; sourceTree = "<group>"; };
    90629065                716FA0D91DB26591007323CC /* airplay-button.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "airplay-button.js"; sourceTree = "<group>"; };
     
    1950819511                                715AD71F2050512400D592DC /* DeclarativeAnimation.cpp */,
    1950919512                                715AD71D2050512400D592DC /* DeclarativeAnimation.h */,
     19513                                716E55AF20DBABDD00F0CF29 /* DocumentAnimationScheduler.cpp */,
     19514                                716E55AD20DBABDC00F0CF29 /* DocumentAnimationScheduler.h */,
    1951019515                                71025EC41F99F096004A250C /* DocumentTimeline.cpp */,
    1951119516                                71025EC51F99F096004A250C /* DocumentTimeline.h */,
     
    2768127686                                7EE6846F12D26E3800E73215 /* DNSResolveQueueCFNet.h in Headers */,
    2768227687                                A8185F4009765766005826D9 /* Document.h in Headers */,
     27688                                716E55B020DBABF100F0CF29 /* DocumentAnimationScheduler.h in Headers */,
    2768327689                                A3BB59F41457A40D00AC56FE /* DocumentEventQueue.h in Headers */,
    2768427690                                A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */,
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r232185 r233140  
    2828
    2929#include "AnimationPlaybackEvent.h"
    30 #include "Chrome.h"
    31 #include "ChromeClient.h"
    3230#include "DOMWindow.h"
    3331#include "DeclarativeAnimation.h"
    34 #include "DisplayRefreshMonitor.h"
    35 #include "DisplayRefreshMonitorManager.h"
    3632#include "Document.h"
    3733#include "KeyframeEffect.h"
     
    4440namespace WebCore {
    4541
    46 Ref<DocumentTimeline> DocumentTimeline::create(Document& document, PlatformDisplayID displayID)
    47 {
    48     return adoptRef(*new DocumentTimeline(document, displayID));
    49 }
    50 
    51 DocumentTimeline::DocumentTimeline(Document& document, PlatformDisplayID displayID)
     42Ref<DocumentTimeline> DocumentTimeline::create(Document& document)
     43{
     44    return adoptRef(*new DocumentTimeline(document));
     45}
     46
     47DocumentTimeline::DocumentTimeline(Document& document)
    5248    : AnimationTimeline(DocumentTimelineClass)
    5349    , m_document(&document)
     
    5753#endif
    5854{
    59     windowScreenDidChange(displayID);
    6055}
    6156
     
    219214{
    220215#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    221     DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this);
     216    m_document->animationScheduler().scheduleWebAnimationsResolution();
    222217#else
    223218    // FIXME: We need to use the same logic as ScriptedAnimationController here,
     
    228223
    229224#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    230 void DocumentTimeline::displayRefreshFired()
     225void DocumentTimeline::documentAnimationSchedulerDidFire()
    231226#else
    232227void DocumentTimeline::animationResolutionTimerFired()
     
    393388}
    394389
    395 void DocumentTimeline::windowScreenDidChange(PlatformDisplayID displayID)
    396 {
    397 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    398     DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, *this);
    399 #else
    400     UNUSED_PARAM(displayID);
    401 #endif
    402 }
    403 
    404 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    405 RefPtr<DisplayRefreshMonitor> DocumentTimeline::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
    406 {
    407     if (!m_document || !m_document->page())
    408         return nullptr;
    409 
    410     if (auto monitor = m_document->page()->chrome().client().createDisplayRefreshMonitor(displayID))
    411         return monitor;
    412 
    413     return DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor(displayID);
    414 }
    415 #endif
    416 
    417390} // namespace WebCore
  • trunk/Source/WebCore/animation/DocumentTimeline.h

    r230581 r233140  
    2828#include "AnimationTimeline.h"
    2929#include "GenericTaskQueue.h"
    30 #include "PlatformScreen.h"
    3130#include "Timer.h"
    3231#include <wtf/Ref.h>
    33 
    34 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    35 #include "DisplayRefreshMonitorClient.h"
    36 #endif
    3732
    3833namespace WebCore {
     
    4237
    4338class DocumentTimeline final : public AnimationTimeline
    44 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    45     , public DisplayRefreshMonitorClient
    46 #endif
    4739{
    4840public:
    49     static Ref<DocumentTimeline> create(Document&, PlatformDisplayID);
     41    static Ref<DocumentTimeline> create(Document&);
    5042    ~DocumentTimeline();
    5143
     
    5648
    5749    void timingModelDidChange() override;
    58     void windowScreenDidChange(PlatformDisplayID);
    5950
    6051    // If possible, compute the visual extent of any transform animation on the given renderer
     
    7263    void enqueueAnimationPlaybackEvent(AnimationPlaybackEvent&);
    7364
     65#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     66    void documentAnimationSchedulerDidFire();
     67#endif
     68
    7469    void updateThrottlingState();
    7570    WEBCORE_EXPORT Seconds animationInterval() const;
     
    8075
    8176private:
    82     DocumentTimeline(Document&, PlatformDisplayID);
     77    DocumentTimeline(Document&);
    8378
    8479    void scheduleInvalidationTaskIfNeeded();
     
    10196    Vector<Ref<AnimationPlaybackEvent>> m_pendingAnimationEvents;
    10297
    103 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    104     // Override for DisplayRefreshMonitorClient
    105     void displayRefreshFired() override;
    106     RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
    107 #else
     98#if !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    10899    void animationResolutionTimerFired();
    109100    Timer m_animationResolutionTimer;
  • trunk/Source/WebCore/dom/Document.cpp

    r233122 r233140  
    5757#include "DateComponents.h"
    5858#include "DebugPageOverlays.h"
     59#include "DocumentAnimationScheduler.h"
    5960#include "DocumentLoader.h"
    6061#include "DocumentMarkerController.h"
     
    24442445    }
    24452446
     2447    if (m_animationScheduler) {
     2448        m_animationScheduler->detachFromDocument();
     2449        m_animationScheduler = nullptr;
     2450    }
     2451
    24462452    m_hasPreparedForDestruction = true;
    24472453
     
    59205926void Document::windowScreenDidChange(PlatformDisplayID displayID)
    59215927{
    5922     if (m_scriptedAnimationController)
    5923         m_scriptedAnimationController->windowScreenDidChange(displayID);
    5924 
    5925     if (m_timeline)
    5926         m_timeline->windowScreenDidChange(displayID);
     5928    if (m_animationScheduler)
     5929        m_animationScheduler->windowScreenDidChange(displayID);
    59275930
    59285931    if (RenderView* view = renderView()) {
     
    65276530{
    65286531    if (!m_scriptedAnimationController) {
    6529 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    6530         m_scriptedAnimationController = ScriptedAnimationController::create(*this, page() ? page()->chrome().displayID() : 0);
    6531 #else
    6532         m_scriptedAnimationController = ScriptedAnimationController::create(*this, 0);
    6533 #endif
     6532        m_scriptedAnimationController = ScriptedAnimationController::create(*this);
     6533
    65346534        // It's possible that the Page may have suspended scripted animations before
    65356535        // we were created. We need to make sure that we don't start up the animation
     
    77187718}
    77197719
     7720DocumentAnimationScheduler& Document::animationScheduler()
     7721{
     7722    if (!m_animationScheduler)
     7723        m_animationScheduler = DocumentAnimationScheduler::create(*this, page() ? page()->chrome().displayID() : 0);
     7724
     7725    return *m_animationScheduler;
     7726}
     7727
    77207728DocumentTimeline& Document::timeline()
    77217729{
    77227730    if (!m_timeline)
    7723         m_timeline = DocumentTimeline::create(*this, page() ? page()->chrome().displayID() : 0);
     7731        m_timeline = DocumentTimeline::create(*this);
    77247732
    77257733    return *m_timeline;
  • trunk/Source/WebCore/dom/Document.h

    r233066 r233140  
    8181namespace WebCore {
    8282
     83class DocumentAnimationScheduler;
    8384class ApplicationStateChangeListener;
    8485class AXObjectCache;
     
    14071408    WEBCORE_EXPORT void setConsoleMessageListener(RefPtr<StringCallback>&&); // For testing.
    14081409
     1410    DocumentAnimationScheduler& animationScheduler();
     1411
    14091412    WEBCORE_EXPORT DocumentTimeline& timeline();
    14101413    DocumentTimeline* existingTimeline() const { return m_timeline.get(); }
     
    19211924    bool m_grantStorageAccessOverride { false };
    19221925
     1926    RefPtr<DocumentAnimationScheduler> m_animationScheduler;
    19231927    RefPtr<DocumentTimeline> m_timeline;
    19241928    DocumentIdentifier m_identifier;
  • trunk/Source/WebCore/dom/ScriptedAnimationController.cpp

    r233122 r233140  
    3030#include "ChromeClient.h"
    3131#include "DOMWindow.h"
    32 #include "DisplayRefreshMonitor.h"
    33 #include "DisplayRefreshMonitorManager.h"
    3432#include "Document.h"
     33#include "DocumentAnimationScheduler.h"
    3534#include "DocumentLoader.h"
    3635#include "Frame.h"
     
    5655namespace WebCore {
    5756
    58 ScriptedAnimationController::ScriptedAnimationController(Document& document, PlatformDisplayID displayID)
     57ScriptedAnimationController::ScriptedAnimationController(Document& document)
    5958    : m_document(&document)
    6059    , m_animationTimer(*this, &ScriptedAnimationController::animationTimerFired)
    6160{
    62     windowScreenDidChange(displayID);
    6361}
    6462
     
    235233}
    236234
    237 void ScriptedAnimationController::windowScreenDidChange(PlatformDisplayID displayID)
    238 {
    239     if (!requestAnimationFrameEnabled())
    240         return;
    241 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    242     DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, *this);
    243 #else
    244     UNUSED_PARAM(displayID);
    245 #endif
    246 }
    247 
    248235Seconds ScriptedAnimationController::interval() const
    249236{
     
    275262#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    276263    if (!m_isUsingTimer && !isThrottled()) {
    277         if (DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this))
     264        if (m_document->animationScheduler().scheduleScriptedAnimationResolution())
    278265            return;
    279266
     
    309296
    310297#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    311 void ScriptedAnimationController::displayRefreshFired()
     298void ScriptedAnimationController::documentAnimationSchedulerDidFire()
    312299{
    313300    serviceScriptedAnimations(m_document->domWindow()->nowTimestamp());
    314301}
    315 
    316 RefPtr<DisplayRefreshMonitor> ScriptedAnimationController::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
    317 {
    318     if (!m_document->page())
    319         return nullptr;
    320 
    321     if (auto monitor = m_document->page()->chrome().client().createDisplayRefreshMonitor(displayID))
    322         return monitor;
    323 
    324     return DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor(displayID);
    325 }
    326 #endif
    327 
    328 }
     302#endif
     303
     304}
  • trunk/Source/WebCore/dom/ScriptedAnimationController.h

    r224797 r233140  
    2626#pragma once
    2727
    28 #include "PlatformScreen.h"
    2928#include "Timer.h"
    3029#include <wtf/OptionSet.h>
     
    3231#include <wtf/RefPtr.h>
    3332#include <wtf/Vector.h>
    34 
    35 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    36 #include "DisplayRefreshMonitorClient.h"
    37 #endif
    3833
    3934namespace WebCore {
     
    4439
    4540class ScriptedAnimationController : public RefCounted<ScriptedAnimationController>
    46 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    47     , public DisplayRefreshMonitorClient
    48 #endif
    4941{
    5042public:
    51     static Ref<ScriptedAnimationController> create(Document& document, PlatformDisplayID displayID)
     43    static Ref<ScriptedAnimationController> create(Document& document)
    5244    {
    53         return adoptRef(*new ScriptedAnimationController(document, displayID));
     45        return adoptRef(*new ScriptedAnimationController(document));
    5446    }
    5547    ~ScriptedAnimationController();
     
    7870    WEBCORE_EXPORT Seconds interval() const;
    7971
    80     void windowScreenDidChange(PlatformDisplayID);
     72#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     73    void documentAnimationSchedulerDidFire();
     74#endif
    8175
    8276private:
    83     ScriptedAnimationController(Document&, PlatformDisplayID);
     77    ScriptedAnimationController(Document&);
    8478
    8579    void scheduleAnimation();
    8680    void animationTimerFired();
    87 
    88 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    89     // Override for DisplayRefreshMonitorClient
    90     void displayRefreshFired() override;
    91 #endif
    9281
    9382    Page* page() const;
     
    10493
    10594#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    106     RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
    10795    OptionSet<ThrottlingReason> m_throttlingReasons;
    10896    bool m_isUsingTimer { false };
Note: See TracChangeset for help on using the changeset viewer.