⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 233585 in webkit


Ignore:
Timestamp:
Jul 6, 2018, 11:43:57 AM (8 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
​https://bugs.webkit.org/show_bug.cgi?id=186496
<rdar://problem/41000179>

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark a WPT progression.

  • web-platform-tests/web-animations/interfaces/Animation/finish-expected.txt:

Source/WebCore:

We used to only resolve animations that had a target element, but animations need not have a target and their
current time should still advance so that their finished promise may resolve. We now maintain a list of animations
without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations().

  • animation/AnimationTimeline.cpp:

(WebCore::AnimationTimeline::addAnimation):
(WebCore::AnimationTimeline::removeAnimation):
(WebCore::AnimationTimeline::animationWasAddedToElement):
(WebCore::AnimationTimeline::animationWasRemovedFromElement):

  • animation/AnimationTimeline.h:

(WebCore::AnimationTimeline:: const):

  • animation/DocumentTimeline.cpp:

(WebCore::DocumentTimeline::updateAnimations):

  • animation/WebAnimation.cpp:

(WebCore::WebAnimation::resolve):

  • animation/WebAnimation.h:
Location:
trunk
Files:
8 edited

Legend:

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

    r233584 r233585  
     12018-07-05  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=186496
     5        <rdar://problem/41000179>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Mark a WPT progression.
     10
     11        * web-platform-tests/web-animations/interfaces/Animation/finish-expected.txt:
     12
    1132018-07-05  Antoine Quint  <graouts@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/finish-expected.txt

    r233519 r233585  
    1414PASS Test finish() resolves finished promise synchronously
    1515PASS Test finish() resolves finished promise synchronously with an animation without a target
    16 FAIL Test normally finished animation resolves finished promise synchronously with an animation without a target assert_true: Animation.finished should be resolved soon after Animation finishes normally expected true got false
     16PASS Test normally finished animation resolves finished promise synchronously with an animation without a target
    1717
  • trunk/Source/WebCore/ChangeLog

    r233584 r233585  
     12018-07-05  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=186496
     5        <rdar://problem/41000179>
     6
     7        Reviewed by Dean Jackson.
     8
     9        We used to only resolve animations that had a target element, but animations need not have a target and their
     10        current time should still advance so that their finished promise may resolve. We now maintain a list of animations
     11        without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations().
     12
     13        * animation/AnimationTimeline.cpp:
     14        (WebCore::AnimationTimeline::addAnimation):
     15        (WebCore::AnimationTimeline::removeAnimation):
     16        (WebCore::AnimationTimeline::animationWasAddedToElement):
     17        (WebCore::AnimationTimeline::animationWasRemovedFromElement):
     18        * animation/AnimationTimeline.h:
     19        (WebCore::AnimationTimeline:: const):
     20        * animation/DocumentTimeline.cpp:
     21        (WebCore::DocumentTimeline::updateAnimations):
     22        * animation/WebAnimation.cpp:
     23        (WebCore::WebAnimation::resolve):
     24        * animation/WebAnimation.h:
     25
    1262018-07-05  Antoine Quint  <graouts@apple.com>
    227
  • trunk/Source/WebCore/animation/AnimationTimeline.cpp

    r233583 r233585  
    5757void AnimationTimeline::addAnimation(Ref<WebAnimation>&& animation)
    5858{
     59    m_animationsWithoutTarget.add(animation.ptr());
    5960    m_animations.add(WTFMove(animation));
    6061    timingModelDidChange();
    … …  
    6364void AnimationTimeline::removeAnimation(Ref<WebAnimation>&& animation)
    6465{
     66    m_animationsWithoutTarget.remove(animation.ptr());
    6567    m_animations.remove(WTFMove(animation));
    6668    timingModelDidChange();
    … …  
    9294void AnimationTimeline::animationWasAddedToElement(WebAnimation& animation, Element& element)
    9395{
     96    m_animationsWithoutTarget.remove(&animation);
     97
    9498    relevantMapForAnimation(animation).ensure(&element, [] {
    9599        return ListHashSet<RefPtr<WebAnimation>> { };
    … …  
    112116void AnimationTimeline::animationWasRemovedFromElement(WebAnimation& animation, Element& element)
    113117{
     118    // This animation doesn't have a target for now.
     119    m_animationsWithoutTarget.add(&animation);
     120
    114121    // First, we clear this animation from one of the m_elementToCSSAnimationsMap, m_elementToCSSTransitionsMap,
    115122    // m_elementToAnimationsMap or m_elementToCompletedCSSTransitionByCSSPropertyID map, whichever is relevant to
  • trunk/Source/WebCore/animation/AnimationTimeline.h

    r233189 r233585  
    8282    bool hasElementAnimations() const { return !m_elementToAnimationsMap.isEmpty() || !m_elementToCSSAnimationsMap.isEmpty() || !m_elementToCSSTransitionsMap.isEmpty(); }
    8383
     84    const ListHashSet<WebAnimation*>& animationsWithoutTarget() const { return m_animationsWithoutTarget; }
    8485    const HashMap<Element*, ListHashSet<RefPtr<WebAnimation>>>& elementToAnimationsMap() { return m_elementToAnimationsMap; }
    8586    const HashMap<Element*, ListHashSet<RefPtr<WebAnimation>>>& elementToCSSAnimationsMap() { return m_elementToCSSAnimationsMap; }
    … …  
    9899    ListHashSet<RefPtr<WebAnimation>> m_animations;
    99100
     101    ListHashSet<WebAnimation*> m_animationsWithoutTarget;
    100102    HashMap<Element*, HashMap<String, RefPtr<CSSAnimation>>> m_elementToCSSAnimationByName;
    101103    HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>> m_elementToRunningCSSTransitionByCSSPropertyID;
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r233583 r233585  
    281281    MicrotaskQueue::mainThreadQueue().performMicrotaskCheckpoint();
    282282
     283    // Let's first resolve any animation that does not have a target.
     284    for (auto* animation : animationsWithoutTarget())
     285        animation->resolve();
     286
     287    // For the rest of the animations, we will resolve them via TreeResolver::createAnimatedElementUpdate()
     288    // by invalidating their target element's style.
    283289    if (m_document && hasElementAnimations()) {
    284290        for (const auto& elementToAnimationsMapItem : elementToAnimationsMap())
  • trunk/Source/WebCore/animation/WebAnimation.cpp

    r233584 r233585  
    10561056}
    10571057
     1058void WebAnimation::resolve()
     1059{
     1060    updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
     1061}
     1062
    10581063void WebAnimation::resolve(RenderStyle& targetStyle)
    10591064{
    1060     updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
    1061 
     1065    resolve();
    10621066    if (m_effect)
    10631067        m_effect->apply(targetStyle);
  • trunk/Source/WebCore/animation/WebAnimation.h

    r233584 r233585  
    106106
    107107    Seconds timeToNextRequiredTick() const;
     108    void resolve();
    108109    virtual void resolve(RenderStyle&);
    109110    void runPendingTasks();
Note: See TracChangeset for help on using the changeset viewer.