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

Unified Diff: Source/core/platform/animation/AnimationUtilities.h

Issue 23287005: CSS Animations: Clamp to avoid underflow when blending unsigned values (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update TestExpectations Created 7 years, 4 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 | « LayoutTests/animations/unsigned-underflow-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/animation/AnimationUtilities.h
diff --git a/Source/core/platform/animation/AnimationUtilities.h b/Source/core/platform/animation/AnimationUtilities.h
index 4cdc8291a5e8f3fc7fdc75914b703d0a5db630e0..4c86e770b432459036debc7e8293ba356215aef6 100644
--- a/Source/core/platform/animation/AnimationUtilities.h
+++ b/Source/core/platform/animation/AnimationUtilities.h
@@ -39,7 +39,7 @@ inline int blend(int from, int to, double progress)
inline unsigned blend(unsigned from, unsigned to, double progress)
{
- return lround(to > from ? from + (to - from) * progress : from - (from - to) * progress);
+ return clampTo<unsigned>(round(to > from ? from + (to - from) * progress : from - (from - to) * progress));
}
inline double blend(double from, double to, double progress)
« no previous file with comments | « LayoutTests/animations/unsigned-underflow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698