summaryrefslogtreecommitdiffstats
path: root/WebCore/page/animation/KeyframeAnimation.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/page/animation/KeyframeAnimation.cpp
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/page/animation/KeyframeAnimation.cpp')
-rw-r--r--WebCore/page/animation/KeyframeAnimation.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/WebCore/page/animation/KeyframeAnimation.cpp b/WebCore/page/animation/KeyframeAnimation.cpp
index c5e3660..4c2cbc8 100644
--- a/WebCore/page/animation/KeyframeAnimation.cpp
+++ b/WebCore/page/animation/KeyframeAnimation.cpp
@@ -68,6 +68,11 @@ void KeyframeAnimation::getKeyframeAnimationInterval(const RenderStyle*& fromSty
double elapsedTime = getElapsedTime();
double t = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1;
+
+ ASSERT(t >= 0);
+ if (t < 0)
+ t = 0;
+
int i = static_cast<int>(t);
t -= i;
if (m_animation->direction() && (i & 1))
@@ -120,9 +125,11 @@ void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const Render
}
// If we are waiting for the start timer, we don't want to change the style yet.
- // Special case - if the delay time is 0, then we do want to set the first frame of the
+ // Special case 1 - if the delay time is 0, then we do want to set the first frame of the
// animation right away. This avoids a flash when the animation starts.
- if (waitingToStart() && m_animation->delay() > 0)
+ // Special case 2 - if there is a backwards fill mode, then we want to continue
+ // through to the style blend so that we get the fromStyle.
+ if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
return;
// FIXME: we need to be more efficient about determining which keyframes we are animating between.
@@ -163,6 +170,11 @@ void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const Render
void KeyframeAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
{
+ // If we're in the delay phase and we're not backwards filling, tell the caller
+ // to use the current style.
+ if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
+ return;
+
// Get the from/to styles and progress between
const RenderStyle* fromStyle = 0;
const RenderStyle* toStyle = 0;
@@ -260,7 +272,10 @@ void KeyframeAnimation::onAnimationIteration(double elapsedTime)
void KeyframeAnimation::onAnimationEnd(double elapsedTime)
{
sendAnimationEvent(eventNames().webkitAnimationEndEvent, elapsedTime);
- endAnimation();
+ // End the animation if we don't fill forwards. Forward filling
+ // animations are ended properly in the class destructor.
+ if (!m_animation->fillsForwards())
+ endAnimation();
}
bool KeyframeAnimation::sendAnimationEvent(const AtomicString& eventType, double elapsedTime)