Changeset 209675 in webkit


Ignore:
Timestamp:
Dec 10, 2016 2:29:24 PM (7 years ago)
Author:
Simon Fraser
Message:

Animation followed by transition doesn't always fire transitionend event
https://bugs.webkit.org/show_bug.cgi?id=165731
rdar://problem/28471240

Reviewed by Zalan Bujtas.
Source/WebCore:

After r200047, a keyframe animation of an accelerated property followed by a
transition didn't always fire a transitionend event.

This happened if CompositeAnimation::timeToNextService() happend to be called
when the transitions's timeToNextService() returned a positive value, but the
keyframe animation still existed, but its timeToNextService() returned -1. In
this case that -1 would clobber the positing minT.

Fix by just continuing in each loop when the timeToNextService() returns -1.

This code should probably be rewritten to use std::optional<double> rather than
magic values.

Test: animations/animation-followed-by-transition.html

  • page/animation/CompositeAnimation.cpp:

(WebCore::CompositeAnimation::timeToNextService):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::addAnimation):
(WebCore::GraphicsLayerCA::pauseAnimation):
(WebCore::GraphicsLayerCA::removeAnimation):
(WebCore::GraphicsLayerCA::platformCALayerAnimationStarted):
(WebCore::GraphicsLayerCA::platformCALayerAnimationEnded):

LayoutTests:

  • animations/animation-followed-by-transition-expected.txt: Added.
  • animations/animation-followed-by-transition.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r209669 r209675  
     12016-12-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Animation followed by transition doesn't always fire transitionend event
     4        https://bugs.webkit.org/show_bug.cgi?id=165731
     5        rdar://problem/28471240
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * animations/animation-followed-by-transition-expected.txt: Added.
     10        * animations/animation-followed-by-transition.html: Added.
     11
    1122016-12-09  Sam Weinig  <sam@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r209674 r209675  
     12016-12-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Animation followed by transition doesn't always fire transitionend event
     4        https://bugs.webkit.org/show_bug.cgi?id=165731
     5        rdar://problem/28471240
     6
     7        Reviewed by Zalan Bujtas.
     8       
     9        After r200047, a keyframe animation of an accelerated property followed by a
     10        transition didn't always fire a transitionend event.
     11       
     12        This happened if CompositeAnimation::timeToNextService() happend to be called
     13        when the transitions's timeToNextService() returned a positive value, but the
     14        keyframe animation still existed, but its timeToNextService() returned -1. In
     15        this case that -1 would clobber the positing minT.
     16
     17        Fix by just continuing in each loop when the timeToNextService() returns -1.
     18
     19        This code should probably be rewritten to use std::optional<double> rather than
     20        magic values.
     21
     22        Test: animations/animation-followed-by-transition.html
     23
     24        * page/animation/CompositeAnimation.cpp:
     25        (WebCore::CompositeAnimation::timeToNextService):
     26        * platform/graphics/ca/GraphicsLayerCA.cpp:
     27        (WebCore::GraphicsLayerCA::addAnimation):
     28        (WebCore::GraphicsLayerCA::pauseAnimation):
     29        (WebCore::GraphicsLayerCA::removeAnimation):
     30        (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted):
     31        (WebCore::GraphicsLayerCA::platformCALayerAnimationEnded):
     32
    1332016-12-10  Sam Weinig  <sam@webkit.org>
    234
  • trunk/Source/WebCore/page/animation/CompositeAnimation.cpp

    r208314 r209675  
    376376        for (auto& transition : m_transitions.values()) {
    377377            double t = transition->timeToNextService();
     378            if (t == -1)
     379                continue;
    378380            if (t < minT || minT == -1)
    379381                minT = t;
     
    386388        for (auto& animation : m_keyframeAnimations.values()) {
    387389            double t = animation->timeToNextService();
     390            if (t == -1)
     391                continue;
    388392            if (t < minT || minT == -1)
    389393                minT = t;
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r209292 r209675  
    937937bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const FloatSize& boxSize, const Animation* anim, const String& animationName, double timeOffset)
    938938{
     939    LOG(Animations, "GraphicsLayerCA %p addAnimation %s (can be accelerated %d)", this, animationName.utf8().data(), animationCanBeAccelerated(valueList, anim));
     940
    939941    ASSERT(!animationName.isEmpty());
    940942
     
    966968void GraphicsLayerCA::pauseAnimation(const String& animationName, double timeOffset)
    967969{
     970    LOG(Animations, "GraphicsLayerCA %p pauseAnimation %s (running %d)", this, animationName.utf8().data(), animationIsRunning(animationName));
     971
    968972    if (!animationIsRunning(animationName))
    969973        return;
     
    983987void GraphicsLayerCA::removeAnimation(const String& animationName)
    984988{
     989    LOG(Animations, "GraphicsLayerCA %p removeAnimation %s (running %d)", this, animationName.utf8().data(), animationIsRunning(animationName));
     990
    985991    if (!animationIsRunning(animationName))
    986992        return;
     
    992998void GraphicsLayerCA::platformCALayerAnimationStarted(const String& animationKey, CFTimeInterval startTime)
    993999{
     1000    LOG(Animations, "GraphicsLayerCA %p platformCALayerAnimationStarted %s at %f", this, animationKey.utf8().data(), startTime);
    9941001    client().notifyAnimationStarted(this, animationKey, startTime);
    9951002}
     
    9971004void GraphicsLayerCA::platformCALayerAnimationEnded(const String& animationKey)
    9981005{
     1006    LOG(Animations, "GraphicsLayerCA %p platformCALayerAnimationEnded %s", this, animationKey.utf8().data());
    9991007    client().notifyAnimationEnded(this, animationKey);
    10001008}
Note: See TracChangeset for help on using the changeset viewer.