Summary: | When webkitAnimationEnd event fires, on-screen rendering should show the last frame of animation | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||||
Component: | Layout and Rendering | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cmarrin, dino | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | OS X 10.5 | ||||||||
Attachments: |
|
Description
Simon Fraser (smfr)
2010-04-21 14:57:32 PDT
This is also visible at http://www.jqtouch.com/preview/demos/main/#home Created attachment 54010 [details]
Testcase
The changes in http://trac.webkit.org/changeset/37484 made it so that we fire webkitAnimationEnd events asynchronously, after we've restored the original, unanimated style. This opened up a window where the element has reverted to its original position before the event fires. Possible fix: diff --git a/WebCore/page/animation/AnimationController.cpp b/WebCore/page/animation/AnimationController.cpp index cb609a5..a0da350 100644 --- a/WebCore/page/animation/AnimationController.cpp +++ b/WebCore/page/animation/AnimationController.cpp @@ -134,6 +134,11 @@ void AnimationControllerPrivate::updateAnimationTimer(bool callSetChanged/* = fa void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*) { + fireEventsAndUpdateStyle(); +} + +void AnimationControllerPrivate::fireEventsAndUpdateStyle() +{ // Protect the frame from getting destroyed in the event handler RefPtr<Frame> protector = m_frame; @@ -196,6 +201,10 @@ void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPr // When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate // updateStyleIfNeeded. It will then call back to us with new information. updateAnimationTimer(true); + + // Fire events right away, to avoid a flash of unanimated style after an animation completes, and before + // the 'end' event fires. + fireEventsAndUpdateStyle(); } bool AnimationControllerPrivate::isAnimatingPropertyOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const diff --git a/WebCore/page/animation/AnimationControllerPrivate.h b/WebCore/page/animation/AnimationControllerPrivate.h index 682dd75..5ef9098 100644 --- a/WebCore/page/animation/AnimationControllerPrivate.h +++ b/WebCore/page/animation/AnimationControllerPrivate.h @@ -92,6 +92,7 @@ public: private: void styleAvailable(); + void fireEventsAndUpdateStyle(); typedef HashMap<RenderObject*, RefPtr<CompositeAnimation> > RenderObjectAnimationMap; This patch causes some DRT assertions in AnimationBase::freezeAtTime(), because we try to freeze animations before we've started them. Maybe we only need to process 'end' events in this new code? Created attachment 54172 [details]
Patch
Comment on attachment 54172 [details] Patch > + Fix by firing these events in the same event cycle as the animation end, once all animations > + have been updated. This also required moving the place that start animations are fixed until s/fixed/fired |