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

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

Issue 23451031: Fix AnimationBase::fractionalTime() to handle a scale of infinity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added a comment Created 7 years, 3 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
Index: Source/core/page/animation/AnimationBase.cpp
diff --git a/Source/core/page/animation/AnimationBase.cpp b/Source/core/page/animation/AnimationBase.cpp
index 48bcd2c2d28b9800e21530be6e75507b98b3e8fc..385c82c307c51cd96dd1836f8b3ca27abcd715d8 100644
--- a/Source/core/page/animation/AnimationBase.cpp
+++ b/Source/core/page/animation/AnimationBase.cpp
@@ -463,9 +463,15 @@ double AnimationBase::fractionalTime(double scale, double elapsedTime, double of
|| m_animation->direction() == CSSAnimationData::AnimationDirectionReverse)
fractionalTime = 1 - fractionalTime;
- if (scale != 1 || offset)
- fractionalTime = (fractionalTime - offset) * scale;
+ fractionalTime -= offset;
+ // Note that if fractionalTime == 0 here, scale may be infinity, but in
+ // this case we don't need to apply scale anyway.
+ if (scale != 1.0 && fractionalTime) {
+ ASSERT(scale >= 0 && !std::isinf(scale));
+ fractionalTime *= scale;
+ }
+ ASSERT(fractionalTime >= 0 && fractionalTime <= 1);
return fractionalTime;
}
« no previous file with comments | « LayoutTests/animations/sample-on-last-keyframe-expected.txt ('k') | Source/core/page/animation/KeyframeAnimation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698