Changeset 233325 in webkit


Ignore:
Timestamp:
Jun 28, 2018 2:13:16 PM (6 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
https://bugs.webkit.org/show_bug.cgi?id=183834
<rdar://problem/40997932>

Reviewed by Dean Jackson.

LayoutTests/imported/mozilla:

Mark progressions in the Mozilla CSS Animations tests.

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

Source/WebCore:

We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set
to a different time than the timeline time at the time the animation was asked to play(). This ensure the
timeline current time has progressed and can be queried to a different value in a requestAnimationFrame()
callback.

When invalidating events, we need to make sure we disregard instances when an animation has and is still pending
so that we wait until we change the pending state to work out which events to enqueue.

  • animation/DeclarativeAnimation.cpp:

(WebCore::DeclarativeAnimation::invalidateDOMEvents):

  • animation/DocumentTimeline.cpp:

(WebCore::DocumentTimeline::updateAnimations):

  • animation/WebAnimation.cpp:

(WebCore::WebAnimation::updatePendingTasks):
(WebCore::WebAnimation::timeToNextRequiredTick const):
(WebCore::WebAnimation::runPendingTasks):

  • animation/WebAnimation.h:

LayoutTests:

This test now passes reliably so we remove any specific expectation. Another test needed to be modified to account for
the pending state being updated at a different time, so we just wait a frame to ensure the animation is started.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r233312 r233325  
     12018-06-28  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=183834
     5        <rdar://problem/40997932>
     6
     7        Reviewed by Dean Jackson.
     8
     9        This test now passes reliably so we remove any specific expectation. Another test needed to be modified to account for
     10        the pending state being updated at a different time, so we just wait a frame to ensure the animation is started.
     11
     12        * TestExpectations:
     13        * compositing/visible-rect/animated.html:
     14
    1152018-06-28  Jer Noble  <jer.noble@apple.com>
    216
  • trunk/LayoutTests/TestExpectations

    r233292 r233325  
    19641964webkit.org/b/181888 imported/w3c/web-platform-tests/web-animations/timing-model/animation-effects/current-iteration.html [ Pass Failure ]
    19651965
    1966 webkit.org/b/183834 imported/mozilla/css-animations/test_animation-starttime.html [ Pass Failure Timeout ]
    19671966webkit.org/b/183836 imported/mozilla/css-animations/test_animations-dynamic-changes.html [ Pass Failure Timeout ]
    19681967webkit.org/b/183837 imported/mozilla/css-transitions/test_document-get-animations.html [ Pass Failure Timeout ]
  • trunk/LayoutTests/compositing/visible-rect/animated.html

    r231977 r233325  
    3535        {
    3636            document.getElementById('animated').addEventListener('webkitAnimationStart', function() {
    37                 if (window.internals)
    38                     document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
     37                requestAnimationFrame(() => {
     38                    if (window.internals)
     39                        document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS)
    3940
    40                 if (window.testRunner)
    41                     testRunner.notifyDone();
     41                    if (window.testRunner)
     42                        testRunner.notifyDone();
     43                });
    4244            }, false);
    4345        }
  • trunk/LayoutTests/imported/mozilla/ChangeLog

    r233141 r233325  
     12018-06-28  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=183834
     5        <rdar://problem/40997932>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Mark progressions in the Mozilla CSS Animations tests.
     10
     11        * css-animations/test_animation-starttime-expected.txt:
     12
    1132018-06-25  Antoine Quint  <graouts@apple.com>
    214
  • trunk/LayoutTests/imported/mozilla/css-animations/test_animation-starttime-expected.txt

    r229864 r233325  
    77PASS startTime while play-pending from finished state
    88PASS startTime while play-pending from finished state using finish()
    9 FAIL Pausing should make the startTime become null assert_true: After the animation has started, startTime is greater than the time when it was started expected true got false
     9PASS Pausing should make the startTime become null
    1010PASS Sanity test to check round-tripping assigning to a new animation's startTime
    1111PASS Skipping forward through animation
  • trunk/Source/WebCore/ChangeLog

    r233324 r233325  
     12018-06-28  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=183834
     5        <rdar://problem/40997932>
     6
     7        Reviewed by Dean Jackson.
     8
     9        We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set
     10        to a different time than the timeline time at the time the animation was asked to play(). This ensure the
     11        timeline current time has progressed and can be queried to a different value in a requestAnimationFrame()
     12        callback.
     13
     14        When invalidating events, we need to make sure we disregard instances when an animation has and is still pending
     15        so that we wait until we change the pending state to work out which events to enqueue.
     16
     17        * animation/DeclarativeAnimation.cpp:
     18        (WebCore::DeclarativeAnimation::invalidateDOMEvents):
     19        * animation/DocumentTimeline.cpp:
     20        (WebCore::DocumentTimeline::updateAnimations):
     21        * animation/WebAnimation.cpp:
     22        (WebCore::WebAnimation::updatePendingTasks):
     23        (WebCore::WebAnimation::timeToNextRequiredTick const):
     24        (WebCore::WebAnimation::runPendingTasks):
     25        * animation/WebAnimation.h:
     26
    1272018-06-28  Ryosuke Niwa  <rniwa@webkit.org>
    228
  • trunk/Source/WebCore/animation/DeclarativeAnimation.cpp

    r232946 r233325  
    122122
    123123    auto isPending = pending();
     124    if (isPending && m_wasPending)
     125        return;
     126
    124127    auto iteration = animationEffect ? animationEffect->currentIteration().value_or(0) : 0;
    125128    auto currentPhase = animationEffect ? animationEffect->phase() : phaseWithoutEffect();
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r233140 r233325  
    233233void DocumentTimeline::updateAnimations()
    234234{
     235    for (const auto& animation : animations())
     236        animation->runPendingTasks();
     237
    235238    if (m_document && hasElementAnimations()) {
    236239        for (const auto& elementToAnimationsMapItem : elementToAnimationsMap())
  • trunk/Source/WebCore/animation/WebAnimation.cpp

    r233196 r233325  
    989989void WebAnimation::updatePendingTasks()
    990990{
    991     if (hasPendingPauseTask() && is<DocumentTimeline>(m_timeline)) {
    992         if (auto document = downcast<DocumentTimeline>(*m_timeline).document()) {
    993             document->postTask([this, protectedThis = makeRef(*this)] (auto&) {
    994                 if (this->hasPendingPauseTask() && m_timeline)
    995                     this->runPendingPauseTask();
    996             });
    997         }
    998     }
    999 
    1000     // FIXME: This should only happen if we're ready, at the moment we think we're ready if we have a timeline.
    1001     if (hasPendingPlayTask() && is<DocumentTimeline>(m_timeline)) {
    1002         if (auto document = downcast<DocumentTimeline>(*m_timeline).document()) {
    1003             document->postTask([this, protectedThis = makeRef(*this)] (auto&) {
    1004                 if (this->hasPendingPlayTask() && m_timeline)
    1005                     this->runPendingPlayTask();
    1006             });
    1007         }
    1008     }
    1009 
    1010991    timingModelDidChange();
    1011992}
     
    1015996    // If we don't have a timeline, an effect, a start time or a playback rate other than 0,
    1016997    // there is no value to apply so we don't need to schedule invalidation.
    1017     if (!m_timeline || !m_effect || !m_startTime || !m_playbackRate)
     998    if (!m_timeline || !m_effect || !m_playbackRate)
    1018999        return Seconds::infinity();
    10191000
    1020     // If we're in the running state, we need to schedule invalidation as soon as possible.
    1021     if (playState() == PlayState::Running)
     1001    if (pending())
     1002        return 0_s;
     1003
     1004    if (!m_startTime)
     1005        return Seconds::infinity();
     1006
     1007    // If we're in or expected to be in the running state, we need to schedule invalidation as soon as possible.
     1008    if (hasPendingPlayTask() || playState() == PlayState::Running)
    10221009        return 0_s;
    10231010
     
    10341021}
    10351022
     1023void WebAnimation::runPendingTasks()
     1024{
     1025    if (hasPendingPauseTask())
     1026        runPendingPauseTask();
     1027
     1028    if (hasPendingPlayTask())
     1029        runPendingPlayTask();
     1030}
     1031
    10361032void WebAnimation::resolve(RenderStyle& targetStyle)
    10371033{
  • trunk/Source/WebCore/animation/WebAnimation.h

    r233051 r233325  
    108108    Seconds timeToNextRequiredTick() const;
    109109    virtual void resolve(RenderStyle&);
     110    void runPendingTasks();
    110111    void effectTargetDidChange(Element* previousTarget, Element* newTarget);
    111112    void acceleratedStateDidChange();
Note: See TracChangeset for help on using the changeset viewer.