Chromium Code Reviews| Index: Source/core/animation/DoubleStyleInterpolation.cpp |
| diff --git a/Source/core/animation/DoubleStyleInterpolation.cpp b/Source/core/animation/DoubleStyleInterpolation.cpp |
| index 86e2286c2996a905875a4aa809d4efe90b5796cd..78135a64051b6196fe84660fa5b35dc35feec799 100644 |
| --- a/Source/core/animation/DoubleStyleInterpolation.cpp |
| +++ b/Source/core/animation/DoubleStyleInterpolation.cpp |
| @@ -32,20 +32,35 @@ PassRefPtrWillBeRawPtr<CSSValue> DoubleStyleInterpolation::interpolableValueToDo |
| { |
| ASSERT(value->isNumber()); |
| double doubleValue = toInterpolableNumber(value)->value(); |
| - |
| switch (clamp) { |
| - case RangeOpacityFIXME: |
| - doubleValue = clampTo<float>(doubleValue, 0, nextafterf(1, 0)); |
| + case RangeAll: |
| + // Do nothing |
| + break; |
| + case RangeFractions: |
|
dstockwell
2015/02/04 11:09:28
Why did this one get renamed from RangeOpacityFIXM
alancutter (OOO until 2018)
2015/02/04 20:24:37
RangeZeroToLessThanOne for clarity.
BTW, you shoul
jadeg
2015/02/05 23:37:02
I renamed it because Eve named it this in her Inte
|
| + doubleValue = clampTo<float>(doubleValue, 0, nextafter(1, 0)); |
| + break; |
| + case RangeFloor: |
| + doubleValue = floor(doubleValue); |
| + break; |
| + case RangeGreaterThanZero: |
|
alancutter (OOO until 2018)
2015/02/04 20:24:37
RangePositive?
jadeg
2015/02/05 23:37:02
Done.
|
| + doubleValue = clampTo<double>(doubleValue, nextafterf(0, 1)); |
| + break; |
| + case RangeRound: |
|
alancutter (OOO until 2018)
2015/02/04 20:24:37
RangeRoundPositive for clarity.
jadeg
2015/02/05 23:37:02
Done.
|
| + doubleValue = clampTo<int>((doubleValue + 0.5), 1); |
|
dstockwell
2015/02/04 11:09:27
Just use round?
jadeg
2015/02/05 23:37:02
Done.
|
| + break; |
| + case RangeGreaterThanOne: |
|
dstockwell
2015/02/04 11:09:27
Isn't this RangeGreaterThanOrEqualToOne?
jadeg
2015/02/05 23:37:02
Done.
|
| + doubleValue = clampTo<float>(doubleValue, 1); |
| break; |
|
alancutter (OOO until 2018)
2015/02/04 20:24:37
RangeAtLeastOne for correctness.
jadeg
2015/02/05 23:37:02
Done.
|
| case RangeNonNegative: |
| doubleValue = clampTo<float>(doubleValue, 0); |
| break; |
| - case RangeAll: |
| + case RangeAbsoluteValueFloor: |
|
alancutter (OOO until 2018)
2015/02/04 20:24:37
RangeRound.
jadeg
2015/02/05 23:37:02
Done.
|
| + if (doubleValue < 0) |
|
dstockwell
2015/02/04 11:09:28
Doesn't this use round() in AnimatedStyleBuidler.c
jadeg
2015/02/05 23:37:02
Done.
|
| + doubleValue = clampTo<int>(doubleValue - 0.5); |
| + if (doubleValue > 0) |
| + doubleValue = clampTo<int>(doubleValue + 0.5); |
|
dstockwell
2015/02/04 11:09:28
Does this still work without the clampTo<int>? (ju
alancutter (OOO until 2018)
2015/02/04 20:24:37
Just use round() instead of (doubleValue + 0.5) he
jadeg
2015/02/05 23:37:02
Done.
jadeg
2015/02/05 23:37:02
Done.
|
| break; |
| - default: |
| - ASSERT_NOT_REACHED(); |
|
alancutter (OOO until 2018)
2015/02/04 20:24:37
Leave this assert in.
jadeg
2015/02/05 23:37:02
Done.
|
| } |
| - |
| if (isNumber) |
| return CSSPrimitiveValue::create(doubleValue, CSSPrimitiveValue::CSS_NUMBER); |
| return CSSPrimitiveValue::create(doubleValue, CSSPrimitiveValue::CSS_DEG); |