Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1527)

Unified Diff: Source/core/page/animation/CompositeAnimation.cpp

Issue 14556022: Simplify animation testing API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/animation/CompositeAnimation.h ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/animation/CompositeAnimation.cpp
diff --git a/Source/core/page/animation/CompositeAnimation.cpp b/Source/core/page/animation/CompositeAnimation.cpp
index 8166e8d06e0ef952eec51456dfdc0ad8a35a8537..c46d09b8546b40442866db2aa8c0434b56b78a31 100644
--- a/Source/core/page/animation/CompositeAnimation.cpp
+++ b/Source/core/page/animation/CompositeAnimation.cpp
@@ -474,51 +474,31 @@ bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool accele
return false;
}
-bool CompositeAnimation::pauseAnimationAtTime(const AtomicString& name, double t)
+void CompositeAnimation::pauseAnimationsForTesting(double t)
{
m_keyframeAnimations.checkConsistency();
- RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(name.impl());
- if (!keyframeAnim || !keyframeAnim->running())
- return false;
+ AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+ for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+ RefPtr<KeyframeAnimation> keyframeAnim = it->value;
+ if (!keyframeAnim || !keyframeAnim->running())
+ continue;
- double count = keyframeAnim->m_animation->iterationCount();
- if ((t >= 0.0) && ((count == CSSAnimationData::IterationCountInfinite) || (t <= count * keyframeAnim->duration()))) {
- keyframeAnim->freezeAtTime(t);
- return true;
+ double count = keyframeAnim->m_animation->iterationCount();
+ if ((t >= 0.0) && ((count == CSSAnimationData::IterationCountInfinite) || (t <= count * keyframeAnim->duration())))
+ keyframeAnim->freezeAtTime(t);
}
- return false;
-}
-
-bool CompositeAnimation::pauseTransitionAtTime(CSSPropertyID property, double t)
-{
- if ((property < firstCSSProperty) || (property >= firstCSSProperty + numCSSProperties))
- return false;
-
- ImplicitAnimation* implAnim = m_transitions.get(property);
- if (!implAnim) {
- // Check to see if this property is being animated via a shorthand.
- // This code is only used for testing, so performance is not critical here.
- HashSet<CSSPropertyID> shorthandProperties = CSSPropertyAnimation::animatableShorthandsAffectingProperty(property);
- bool anyPaused = false;
- HashSet<CSSPropertyID>::const_iterator end = shorthandProperties.end();
- for (HashSet<CSSPropertyID>::const_iterator it = shorthandProperties.begin(); it != end; ++it) {
- if (pauseTransitionAtTime(*it, t))
- anyPaused = true;
- }
- return anyPaused;
- }
+ CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+ for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+ RefPtr<ImplicitAnimation> implAnim = it->value;
- if (!implAnim->running())
- return false;
+ if (!implAnim->running())
+ continue;
- if ((t >= 0.0) && (t <= implAnim->duration())) {
- implAnim->freezeAtTime(t);
- return true;
+ if ((t >= 0.0) && (t <= implAnim->duration()))
+ implAnim->freezeAtTime(t);
}
-
- return false;
}
unsigned CompositeAnimation::numberOfActiveAnimations() const
« no previous file with comments | « Source/core/page/animation/CompositeAnimation.h ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698