Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| diff --git a/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| index b6fa606c1eec2e0e582bec7955f9bf5ae23e0e20..e45ddeb92b37f9dc782f63e4a1884acfe8cb0fdd 100644 |
| --- a/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| +++ b/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| @@ -96,15 +96,14 @@ BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* valu |
| template<typename T> T animatableValueClampTo(const AnimatableValue* value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) |
| { |
| - static_assert(std::is_integral<T>::value, "should use integral type T when rounding values"); |
| return clampTo<T>(roundForImpreciseConversion<T>(toAnimatableDouble(value)->toDouble()), min, max); |
| } |
| -template<typename T> T animatableLineWidthClamp(const AnimatableValue* value) |
| +template<typename T> T animatableLineWidthClamp(const AnimatableValue* value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) |
|
alancutter (OOO until 2018)
2016/01/20 06:06:23
No need for min/max parameters. Line widths are al
|
| { |
| double doubleValue = toAnimatableDouble(value)->toDouble(); |
| // This matches StyleBuilderConverter::convertLineWidth(). |
| - return (doubleValue > 0 && doubleValue < 1) ? 1 : animatableValueClampTo<T>(value); |
| + return (doubleValue > 0 && doubleValue < 1) ? 1 : animatableValueClampTo<T>(value, min, max); |
| } |
| LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleResolverState& state, ValueRange range = ValueRangeAll) |
| @@ -323,7 +322,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| style->setBorderBottomRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative)); |
| return; |
| case CSSPropertyBorderBottomWidth: |
| - style->setBorderBottomWidth(animatableLineWidthClamp<unsigned>(value)); |
| + style->setBorderBottomWidth(animatableLineWidthClamp<float>(value, 0)); |
| return; |
| case CSSPropertyBorderImageOutset: |
| style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state)); |
| @@ -343,14 +342,14 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| style->setVisitedLinkBorderLeftColor(toAnimatableColor(value)->visitedLinkColor()); |
| return; |
| case CSSPropertyBorderLeftWidth: |
| - style->setBorderLeftWidth(animatableLineWidthClamp<unsigned>(value)); |
| + style->setBorderLeftWidth(animatableLineWidthClamp<float>(value, 0)); |
| return; |
| case CSSPropertyBorderRightColor: |
| style->setBorderRightColor(toAnimatableColor(value)->color()); |
| style->setVisitedLinkBorderRightColor(toAnimatableColor(value)->visitedLinkColor()); |
| return; |
| case CSSPropertyBorderRightWidth: |
| - style->setBorderRightWidth(animatableLineWidthClamp<unsigned>(value)); |
| + style->setBorderRightWidth(animatableLineWidthClamp<float>(value, 0)); |
| return; |
| case CSSPropertyBorderTopColor: |
| style->setBorderTopColor(toAnimatableColor(value)->color()); |
| @@ -363,7 +362,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| style->setBorderTopRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative)); |
| return; |
| case CSSPropertyBorderTopWidth: |
| - style->setBorderTopWidth(animatableLineWidthClamp<unsigned>(value)); |
| + style->setBorderTopWidth(animatableLineWidthClamp<float>(value, 0)); |
| return; |
| case CSSPropertyBottom: |
| style->setBottom(animatableValueToLength(value, state)); |