Animation followed by transition doesn't always fire transitionend event
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2016 22:29:24 +0000 (22:29 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2016 22:29:24 +0000 (22:29 +0000)
commit7d245d98af6287c9e4e27d8eac419581e9d2898e
tree58eadad13623db8432d60811060a4df3f9de6438
parentc7b3ae018c7e96caf29f203c77494fc4cd2684b3
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/animations/animation-followed-by-transition-expected.txt [new file with mode: 0644]
LayoutTests/animations/animation-followed-by-transition.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/animation/CompositeAnimation.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp