Changeset 239269 in webkit


Ignore:
Timestamp:
Dec 17, 2018 9:49:55 AM (5 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Ensure we don't update an animation's finished state twice when updating animations
https://bugs.webkit.org/show_bug.cgi?id=192757

Reviewed by Dean Jackson.

When animations are udpated and DocumentTimeline::updateAnimationsAndSendEvents() is called, we used to update an animation's finished state
twice since we'd do it once when calling tick() and once again when calling resolve() in the ensuing style invalidation. We now keep track of
whether we've already updated an animation's finished state during animation update in the call to tick() and avoid updating in the immediate
next call to resolve(), unless any of the timing properties have changed in the meantime.

No new test since there is no user-observable change.

  • animation/WebAnimation.cpp:

(WebCore::WebAnimation::timingDidChange):
(WebCore::WebAnimation::tick):
(WebCore::WebAnimation::resolve):

  • animation/WebAnimation.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239268 r239269  
     12018-12-17  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Ensure we don't update an animation's finished state twice when updating animations
     4        https://bugs.webkit.org/show_bug.cgi?id=192757
     5
     6        Reviewed by Dean Jackson.
     7
     8        When animations are udpated and DocumentTimeline::updateAnimationsAndSendEvents() is called, we used to update an animation's finished state
     9        twice since we'd do it once when calling tick() and once again when calling resolve() in the ensuing style invalidation. We now keep track of
     10        whether we've already updated an animation's finished state during animation update in the call to tick() and avoid updating in the immediate
     11        next call to resolve(), unless any of the timing properties have changed in the meantime.
     12
     13        No new test since there is no user-observable change.
     14
     15        * animation/WebAnimation.cpp:
     16        (WebCore::WebAnimation::timingDidChange):
     17        (WebCore::WebAnimation::tick):
     18        (WebCore::WebAnimation::resolve):
     19        * animation/WebAnimation.h:
     20
    1212018-12-17  Simon Fraser  <simon.fraser@apple.com>
    222
  • trunk/Source/WebCore/animation/WebAnimation.cpp

    r238128 r239269  
    697697void WebAnimation::timingDidChange(DidSeek didSeek, SynchronouslyNotify synchronouslyNotify)
    698698{
     699    m_shouldSkipUpdatingFinishedStateWhenResolving = false;
    699700    updateFinishedState(didSeek, synchronouslyNotify);
    700701    if (m_timeline)
     
    11081109{
    11091110    updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
     1111    m_shouldSkipUpdatingFinishedStateWhenResolving = true;
    11101112
    11111113    // Run pending tasks, if any.
     
    11201122void WebAnimation::resolve(RenderStyle& targetStyle)
    11211123{
    1122     updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
     1124    if (!m_shouldSkipUpdatingFinishedStateWhenResolving)
     1125        updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
     1126    m_shouldSkipUpdatingFinishedStateWhenResolving = false;
     1127
    11231128    if (m_effect)
    11241129        m_effect->apply(targetStyle);
  • trunk/Source/WebCore/animation/WebAnimation.h

    r238128 r239269  
    175175    bool m_scheduledMicrotask;
    176176    bool m_isRelevant;
     177    bool m_shouldSkipUpdatingFinishedStateWhenResolving;
    177178    UniqueRef<ReadyPromise> m_readyPromise;
    178179    UniqueRef<FinishedPromise> m_finishedPromise;
Note: See TracChangeset for help on using the changeset viewer.