summaryrefslogtreecommitdiffstats
path: root/WebCore/page/animation/KeyframeAnimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/animation/KeyframeAnimation.cpp')
-rw-r--r--WebCore/page/animation/KeyframeAnimation.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/WebCore/page/animation/KeyframeAnimation.cpp b/WebCore/page/animation/KeyframeAnimation.cpp
index 01ec2f1..df963fb 100644
--- a/WebCore/page/animation/KeyframeAnimation.cpp
+++ b/WebCore/page/animation/KeyframeAnimation.cpp
@@ -39,6 +39,8 @@
#include "RenderStyle.h"
#include <wtf/UnusedParam.h>
+using namespace std;
+
namespace WebCore {
KeyframeAnimation::KeyframeAnimation(const Animation* animation, RenderObject* renderer, int index, CompositeAnimation* compAnim, RenderStyle* unanimatedStyle)
@@ -66,6 +68,8 @@ void KeyframeAnimation::fetchIntervalEndpointsForProperty(int property, const Re
{
// Find the first key
double elapsedTime = getElapsedTime();
+ if (m_animation->duration() && m_animation->iterationCount() != Animation::IterationCountInfinite)
+ elapsedTime = min(elapsedTime, m_animation->duration() * m_animation->iterationCount());
double fractionalTime = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1;
@@ -75,6 +79,8 @@ void KeyframeAnimation::fetchIntervalEndpointsForProperty(int property, const Re
// FIXME: share this code with AnimationBase::progress().
int iteration = static_cast<int>(fractionalTime);
+ if (m_animation->iterationCount() != Animation::IterationCountInfinite)
+ iteration = min(iteration, m_animation->iterationCount() - 1);
fractionalTime -= iteration;
bool reversing = (m_animation->direction() == Animation::AnimationDirectionAlternate) && (iteration & 1);
@@ -127,7 +133,7 @@ void KeyframeAnimation::fetchIntervalEndpointsForProperty(int property, const Re
const TimingFunction* timingFunction = 0;
if (fromStyle->animations() && fromStyle->animations()->size() > 0) {
// We get the timing function from the first animation, because we've synthesized a RenderStyle for each keyframe.
- timingFunction = &(fromStyle->animations()->animation(0)->timingFunction());
+ timingFunction = fromStyle->animations()->animation(0)->timingFunction().get();
}
prog = progress(scale, offset, timingFunction);