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

Unified Diff: third_party/WebKit/Source/core/animation/NumberPropertyFunctions.cpp

Issue 1457623003: Clamp animated numbers according to ComputedStyle data type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: var Created 5 years, 1 month 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: third_party/WebKit/Source/core/animation/NumberPropertyFunctions.cpp
diff --git a/third_party/WebKit/Source/core/animation/NumberPropertyFunctions.cpp b/third_party/WebKit/Source/core/animation/NumberPropertyFunctions.cpp
index 89c4c8ec56336a3cf9eae4112f1ea53291bdbcac..166efd8cd26aa89402296abca4c49b62b0969b6d 100644
--- a/third_party/WebKit/Source/core/animation/NumberPropertyFunctions.cpp
+++ b/third_party/WebKit/Source/core/animation/NumberPropertyFunctions.cpp
@@ -88,33 +88,37 @@ bool NumberPropertyFunctions::getNumber(CSSPropertyID property, const ComputedSt
double NumberPropertyFunctions::clampNumber(CSSPropertyID property, double value)
{
switch (property) {
- case CSSPropertyOrphans:
- case CSSPropertyWebkitColumnCount:
- case CSSPropertyWidows:
- return clampTo<double>(round(value), 1);
-
case CSSPropertyStrokeMiterlimit:
- return clampTo<double>(value, 1);
+ return clampTo<float>(value, 1);
case CSSPropertyFloodOpacity:
case CSSPropertyStopOpacity:
case CSSPropertyStrokeOpacity:
case CSSPropertyShapeImageThreshold:
- return clampTo<double>(value, 0, 1);
+ return clampTo<float>(value, 0, 1);
case CSSPropertyFillOpacity:
case CSSPropertyOpacity:
- return clampTo<double>(value, 0, nextafterf(1, 0));
+ return clampTo<float>(value, 0, nextafterf(1, 0));
case CSSPropertyFlexGrow:
case CSSPropertyFlexShrink:
case CSSPropertyFontSizeAdjust:
case CSSPropertyLineHeight:
- return clampTo<double>(value, 0);
+ return clampTo<float>(value, 0);
+
+ case CSSPropertyOrphans:
+ case CSSPropertyWidows:
+ return clampTo<short>(round(value), 1);
+
+ case CSSPropertyWebkitColumnCount:
+ return clampTo<unsigned short>(round(value), 1);
case CSSPropertyWebkitColumnRuleWidth:
+ return clampTo<unsigned short>(round(value));
+
case CSSPropertyZIndex:
- return round(value);
+ return clampTo<int>(round(value));
default:
ASSERT_NOT_REACHED();

Powered by Google App Engine
This is Rietveld 408576698