Modified: trunk/Source/WebCore/platform/graphics/blackberry/LayerAnimation.cpp (120733 => 120734)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerAnimation.cpp 2012-06-19 17:55:57 UTC (rev 120733)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerAnimation.cpp 2012-06-19 17:57:24 UTC (rev 120734)
@@ -77,7 +77,7 @@
return CubicBezierTimingFunction::defaultTimingFunction();
}
-static double progress(double elapsedTime, const LayerAnimation* layerAnimation, double scale, double offset, const TimingFunction* tf)
+static double progress(double elapsedTime, const LayerAnimation* layerAnimation, double scale, double offset, const TimingFunction* tf, bool& animationFinished)
{
double dur = layerAnimation->duration();
if (layerAnimation->iterationCount() > 0)
@@ -85,8 +85,10 @@
if (!layerAnimation->duration())
return 1.0;
- if (layerAnimation->iterationCount() > 0 && elapsedTime >= dur)
+ if (layerAnimation->iterationCount() > 0 && elapsedTime >= dur) {
+ animationFinished = true;
return (layerAnimation->iterationCount() % 2) ? 1.0 : 0.0;
+ }
// Compute the fractional time, taking into account direction.
// There is no need to worry about iterations, we assume that we would have
@@ -117,7 +119,7 @@
return fractionalTime;
}
-static void fetchIntervalEndpoints(double elapsedTime, const LayerAnimation* layerAnimation, const AnimationValue*& fromValue, const AnimationValue*& toValue, double& prog)
+static void fetchIntervalEndpoints(double elapsedTime, const LayerAnimation* layerAnimation, const AnimationValue*& fromValue, const AnimationValue*& toValue, double& prog, bool& animationFinished)
{
// Find the first key.
if (layerAnimation->duration() && layerAnimation->iterationCount() != Animation::IterationCountInfinite)
@@ -186,7 +188,7 @@
const TimingFunction* timingFunction = timingFunctionForAnimationValue(prevKeyframe, layerAnimation);
- prog = progress(elapsedTime, layerAnimation, scale, offset, timingFunction);
+ prog = progress(elapsedTime, layerAnimation, scale, offset, timingFunction, animationFinished);
}
void LayerAnimation::apply(LayerCompositingThread* layer, double elapsedTime)
@@ -194,8 +196,9 @@
const AnimationValue* from = 0;
const AnimationValue* to = 0;
double progress = 0.0;
+ bool animationFinished = false;
- fetchIntervalEndpoints(elapsedTime, this, from, to, progress);
+ fetchIntervalEndpoints(elapsedTime, this, from, to, progress, animationFinished);
switch (property()) {
case AnimatedPropertyWebkitTransform:
@@ -210,6 +213,8 @@
ASSERT_NOT_REACHED();
break;
}
+
+ m_finished = animationFinished;
}
TransformationMatrix LayerAnimation::blendTransform(const TransformOperations* from, const TransformOperations* to, double progress) const
Modified: trunk/Source/WebCore/platform/graphics/blackberry/LayerAnimation.h (120733 => 120734)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerAnimation.h 2012-06-19 17:55:57 UTC (rev 120733)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerAnimation.h 2012-06-19 17:57:24 UTC (rev 120734)
@@ -86,6 +86,7 @@
// NOTE: Don't try to clone() an AnimationValue, that's not a threadsafe operation since it mutates refcounts.
const AnimationValue* valueAt(size_t i) const { return m_values.at(i); }
+ bool finished() const { return m_finished; }
TransformationMatrix blendTransform(const TransformOperations* from, const TransformOperations*, double progress) const;
float blendOpacity(float from, float to, double progress) const;
@@ -103,6 +104,7 @@
, m_duration(animation->duration())
, m_iterationCount(animation->iterationCount())
, m_direction(animation->direction())
+ , m_finished(false)
{
if (animation->isTimingFunctionSet())
m_timingFunction = animation->timingFunction();
@@ -123,6 +125,7 @@
, m_duration(other.m_duration)
, m_iterationCount(other.m_iterationCount)
, m_direction(other.m_direction)
+ , m_finished(false)
{
}
@@ -143,6 +146,7 @@
double m_duration;
int m_iterationCount;
Animation::AnimationDirection m_direction;
+ bool m_finished;
};
}
Modified: trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp (120733 => 120734)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp 2012-06-19 17:55:57 UTC (rev 120733)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp 2012-06-19 17:57:24 UTC (rev 120734)
@@ -496,14 +496,15 @@
animation->apply(this, elapsedTime);
}
+ bool allAnimationsFinished = true;
for (size_t i = 0; i < m_runningAnimations.size(); ++i) {
LayerAnimation* animation = m_runningAnimations[i].get();
double elapsedTime = (m_suspendTime ? m_suspendTime : currentTime) - animation->startTime() + animation->timeOffset();
animation->apply(this, elapsedTime);
+ if (!animation->finished())
+ allAnimationsFinished = false;
}
- bool hasRunningAnimations = !m_runningAnimations.isEmpty();
-
// If there are any overrides, apply them
if (m_override) {
if (m_override->isPositionSet())
@@ -521,11 +522,12 @@
LayerAnimation* animation = m_override->animations()[i].get();
double elapsedTime = (m_suspendTime ? m_suspendTime : currentTime) - animation->startTime() + animation->timeOffset();
animation->apply(this, elapsedTime);
- hasRunningAnimations |= true;
+ if (!animation->finished())
+ allAnimationsFinished = false;
}
}
- return hasRunningAnimations;
+ return !allAnimationsFinished;
}
bool LayerCompositingThread::hasVisibleHolePunchRect() const