summaryrefslogtreecommitdiffstats
path: root/WebCore/page/animation
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-11 18:35:50 +0100
committerBen Murdoch <benm@google.com>2010-05-14 10:23:05 +0100
commit21939df44de1705786c545cd1bf519d47250322d (patch)
treeef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebCore/page/animation
parent4ff1d8891d520763f17675827154340c7c740f90 (diff)
downloadexternal_webkit-21939df44de1705786c545cd1bf519d47250322d.zip
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebCore/page/animation')
-rw-r--r--WebCore/page/animation/AnimationBase.cpp6
-rw-r--r--WebCore/page/animation/AnimationController.cpp13
-rw-r--r--WebCore/page/animation/AnimationControllerPrivate.h1
-rw-r--r--WebCore/page/animation/CompositeAnimation.cpp4
4 files changed, 19 insertions, 5 deletions
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index d9282cb..a49c754 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -952,9 +952,6 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param)
overrideAnimations();
- // Send start event, if needed
- onAnimationStart(0); // The elapsedTime is always 0 here
-
// Start the animation
if (overridden()) {
// We won't try to start accelerated animations if we are overridden and
@@ -987,6 +984,9 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param)
m_startTime += m_animation->delay();
}
+ // Now that we know the start time, fire the start event.
+ onAnimationStart(0); // The elapsedTime is 0.
+
// Decide whether to go into looping or ending state
goIntoEndingOrLoopingState();
diff --git a/WebCore/page/animation/AnimationController.cpp b/WebCore/page/animation/AnimationController.cpp
index cb609a5..3761c5a 100644
--- a/WebCore/page/animation/AnimationController.cpp
+++ b/WebCore/page/animation/AnimationController.cpp
@@ -134,9 +134,16 @@ 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;
+ bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
+
// fire all the events
Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = m_eventsToDispatch.end();
for (Vector<EventToDispatch>::const_iterator it = m_eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
@@ -155,7 +162,7 @@ void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<Animat
m_nodeChangesToDispatch.clear();
- if (m_frame)
+ if (updateStyle && m_frame)
m_frame->document()->updateStyleIfNeeded();
}
@@ -196,6 +203,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;
diff --git a/WebCore/page/animation/CompositeAnimation.cpp b/WebCore/page/animation/CompositeAnimation.cpp
index 0f238fd..7619b1f 100644
--- a/WebCore/page/animation/CompositeAnimation.cpp
+++ b/WebCore/page/animation/CompositeAnimation.cpp
@@ -205,6 +205,8 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render
// Toss the animation order map.
m_keyframeAnimationOrderMap.clear();
+
+ DEFINE_STATIC_LOCAL(const AtomicString, none, ("none"));
// Now mark any still active animations as active and add any new animations.
if (targetStyle->animations()) {
@@ -232,7 +234,7 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render
// Set the saved animation to this new one, just in case the play state has changed.
keyframeAnim->setAnimation(anim);
keyframeAnim->setIndex(i);
- } else if ((anim->duration() || anim->delay()) && anim->iterationCount()) {
+ } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && animationName != none) {
keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, targetStyle);
m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim);
}