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

Side by Side Diff: Source/core/page/animation/KeyframeAnimation.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/animation/AnimationBase.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 nextIndex = numKeyframes - 1; 151 nextIndex = numKeyframes - 1;
152 152
153 const KeyframeValue& prevKeyframe = m_keyframes[prevIndex]; 153 const KeyframeValue& prevKeyframe = m_keyframes[prevIndex];
154 const KeyframeValue& nextKeyframe = m_keyframes[nextIndex]; 154 const KeyframeValue& nextKeyframe = m_keyframes[nextIndex];
155 155
156 fromStyle = prevKeyframe.style(); 156 fromStyle = prevKeyframe.style();
157 toStyle = nextKeyframe.style(); 157 toStyle = nextKeyframe.style();
158 158
159 offset = prevKeyframe.key(); 159 offset = prevKeyframe.key();
160 scale = 1.0 / (nextKeyframe.key() - prevKeyframe.key()); 160 scale = 1.0 / (nextKeyframe.key() - prevKeyframe.key());
161 // A scale of infinity is handled in AnimationBase::fractionalTime().
162 ASSERT(scale >= 0 && (!std::isinf(scale) || prevIndex == nextIndex));
161 163
162 const TimingFunction* timingFunction = 0; 164 const TimingFunction* timingFunction = 0;
163 if (const CSSAnimationData* matchedAnimation = getAnimationFromStyleByName(f romStyle, name())) 165 if (const CSSAnimationData* matchedAnimation = getAnimationFromStyleByName(f romStyle, name()))
164 timingFunction = matchedAnimation->timingFunction().get(); 166 timingFunction = matchedAnimation->timingFunction().get();
165 167
166 prog = progress(scale, offset, timingFunction); 168 prog = progress(scale, offset, timingFunction);
167 } 169 }
168 170
169 void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const Render Style*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle) 171 void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const Render Style*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle)
170 { 172 {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 469
468 if (acceleratedPropertiesOnly) { 470 if (acceleratedPropertiesOnly) {
469 bool isLooping; 471 bool isLooping;
470 getTimeToNextEvent(t, isLooping); 472 getTimeToNextEvent(t, isLooping);
471 } 473 }
472 474
473 return t; 475 return t;
474 } 476 }
475 477
476 } // namespace WebCore 478 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/animation/AnimationBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698