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

Changeset 268809 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 11:10:52 AM (6 years ago)
Author:
graouts@webkit.org
Message:

REGRESSION (r263729): transform transition doesn't restart
https://bugs.webkit.org/show_bug.cgi?id=218011
Source/WebCore:

Reviewed by Dean Jackson.
<rdar://problem/70035130>

In the case of accelerated animations, style for the targeted element is not updated while the animation is
in flight since the animation is performed by Core Animation. This means that by the time the "transitionend"
event is fired, a transition has not yet performed style updates for the element that would have already been
performed for a software animations and thus the updates to the completed and running transition maps performed
under AnimationTimeline::updateCSSTransitionsForStyleableAndProperty() may be out of sync with the assumptions
made in DocumentTimelinesController::updateAnimationsAndSendEvents() that a transition newly marked as finished
should be added to the list of completed transitions.

Indeed, in the newly-added test, if a style update is forced during the "transitionend" event listener before also
clearing the transition styles, two style updates, and thus two calls to updateCSSTransitionsForStyleableAndProperty(),
will have been performed by the time updateAnimationsAndSendEvents() runs again and collects completed transitions,
during which time the transition in question will have been removed from the list of running transitions and added
to the list of completed transitions (first update) and subsequently removed from the list of completed transitions
(second update). At this point, setting styles that would start a new transition for this property will not yield a
transition since we won't be able to satisfy the requirement that the new target value does not match that of the
completed transition.

In this change we stop assuming that just because updateAnimationsAndSendEvents() sees a transition as finished for
the first time it implies that the transition is still considered a running transition. As such we only add a transition
to the list of completed transitions should it be in the list of running transitions.

Test: webanimations/transition-restart-after-style-recalc-during-transitionend.html

  • animation/DocumentTimeline.cpp:

(WebCore::DocumentTimeline::transitionDidComplete):

LayoutTests:

<rdar://problem/70035130>

Reviewed by Dean Jackson.

Add a new test that checks that forcing a style update during dispatch of the "transitionend" event
does not prevent the completed transition from starting again if reset.

  • webanimations/transition-restart-after-style-recalc-during-transitionend-expected.txt: Added.
  • webanimations/transition-restart-after-style-recalc-during-transitionend.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r268807 r268809  
     12020-10-21  Antoine Quint  <graouts@webkit.org>
     2
     3        REGRESSION (r263729): transform transition doesn't restart
     4        https://bugs.webkit.org/show_bug.cgi?id=218011
     5        <rdar://problem/70035130>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Add a new test that checks that forcing a style update during dispatch of the "transitionend" event
     10        does not prevent the completed transition from starting again if reset.
     11
     12        * webanimations/transition-restart-after-style-recalc-during-transitionend-expected.txt: Added.
     13        * webanimations/transition-restart-after-style-recalc-during-transitionend.html: Added.
     14
    1152020-10-21  Antoine Quint  <graouts@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r268808 r268809  
     12020-10-21  Antoine Quint  <graouts@webkit.org>
     2
     3        REGRESSION (r263729): transform transition doesn't restart
     4        https://bugs.webkit.org/show_bug.cgi?id=218011
     5
     6        Reviewed by Dean Jackson.
     7        <rdar://problem/70035130>
     8
     9        In the case of accelerated animations, style for the targeted element is not updated while the animation is
     10        in flight since the animation is performed by Core Animation. This means that by the time the "transitionend"
     11        event is fired, a transition has not yet performed style updates for the element that would have already been
     12        performed for a software animations and thus the updates to the completed and running transition maps performed
     13        under AnimationTimeline::updateCSSTransitionsForStyleableAndProperty() may be out of sync with the assumptions
     14        made in DocumentTimelinesController::updateAnimationsAndSendEvents() that a transition newly marked as finished
     15        should be added to the list of completed transitions.
     16       
     17        Indeed, in the newly-added test, if a style update is forced during the "transitionend" event listener before also
     18        clearing the transition styles, two style updates, and thus two calls to updateCSSTransitionsForStyleableAndProperty(),
     19        will have been performed by the time updateAnimationsAndSendEvents() runs again and collects completed transitions,
     20        during which time the transition in question will have been removed from the list of running transitions and added
     21        to the list of completed transitions (first update) and subsequently removed from the list of completed transitions
     22        (second update). At this point, setting styles that would start a new transition for this property will not yield a
     23        transition since we won't be able to satisfy the requirement that the new target value does not match that of the
     24        completed transition.
     25
     26        In this change we stop assuming that just because updateAnimationsAndSendEvents() sees a transition as finished for
     27        the first time it implies that the transition is still considered a running transition. As such we only add a transition
     28        to the list of completed transitions should it be in the list of running transitions.
     29
     30        Test: webanimations/transition-restart-after-style-recalc-during-transitionend.html
     31
     32        * animation/DocumentTimeline.cpp:
     33        (WebCore::DocumentTimeline::transitionDidComplete):
     34
    1352020-10-21  Antoine Quint  <graouts@webkit.org>
    236
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r268075 r268809  
    298298    removeAnimation(*transition);
    299299    if (is<KeyframeEffect>(transition->effect())) {
    300         if (auto styleable = downcast<KeyframeEffect>(transition->effect())->targetStyleable())
    301             styleable->ensureCompletedTransitionsByProperty().set(transition->property(), transition);
     300        if (auto styleable = downcast<KeyframeEffect>(transition->effect())->targetStyleable()) {
     301            auto property = transition->property();
     302            if (styleable->hasRunningTransitionForProperty(property))
     303                styleable->ensureCompletedTransitionsByProperty().set(property, transition);
     304        }
    302305    }
    303306}
Note: See TracChangeset for help on using the changeset viewer.