WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
37955
When webkitAnimationEnd event fires, on-screen rendering should show the last frame of animation
https://bugs.webkit.org/show_bug.cgi?id=37955
Summary
When webkitAnimationEnd event fires, on-screen rendering should show the last...
Simon Fraser (smfr)
Reported
2010-04-21 14:57:32 PDT
When the end-animation event fires, the rendering should show the last frame of animation. This way, JS can setup post-animation style without a flash.
Attachments
Testcase
(1.43 KB, text/html)
2010-04-21 17:56 PDT
,
Simon Fraser (smfr)
no flags
Details
Patch
(5.53 KB, patch)
2010-04-23 10:40 PDT
,
Simon Fraser (smfr)
mitz: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2010-04-21 17:56:32 PDT
This is also visible at
http://www.jqtouch.com/preview/demos/main/#home
Simon Fraser (smfr)
Comment 2
2010-04-21 17:56:49 PDT
Created
attachment 54010
[details]
Testcase
Simon Fraser (smfr)
Comment 3
2010-04-22 20:24:34 PDT
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.
Simon Fraser (smfr)
Comment 4
2010-04-22 20:38:47 PDT
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;
Simon Fraser (smfr)
Comment 5
2010-04-22 20:47:09 PDT
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?
Simon Fraser (smfr)
Comment 6
2010-04-23 10:40:41 PDT
Created
attachment 54172
[details]
Patch
Simon Fraser (smfr)
Comment 7
2010-04-23 10:59:00 PDT
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
Simon Fraser (smfr)
Comment 8
2010-04-23 13:23:11 PDT
http://trac.webkit.org/changeset/58186
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug