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

Unified Diff: Source/core/css/resolver/AnimatedStyleBuilder.cpp

Issue 54123007: Web Animations CSS: Fix clamping to non-negative values for BorderImageLength (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bug with clampTo() Created 7 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: Source/core/css/resolver/AnimatedStyleBuilder.cpp
diff --git a/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/Source/core/css/resolver/AnimatedStyleBuilder.cpp
index 8a7531e7188aa62f65473907a926b3fbf4752bc3..f8c4a2d90cbada062bb374e11f5598b15938e6df 100644
--- a/Source/core/css/resolver/AnimatedStyleBuilder.cpp
+++ b/Source/core/css/resolver/AnimatedStyleBuilder.cpp
@@ -73,13 +73,13 @@ Length animatableValueToLength(const AnimatableValue* value, const StyleResolver
return cssPrimitiveValue->convertToLength<AnyConversion>(style, state.rootElementStyle(), style->effectiveZoom());
}
-BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* value, const StyleResolverState& state, NumberRange range = AllValues)
+BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* value, const StyleResolverState& state)
{
const RenderStyle* style = state.style();
if (value->isLength())
- return BorderImageLength(toAnimatableLength(value)->toLength(style, state.rootElementStyle(), style->effectiveZoom(), range));
+ return BorderImageLength(toAnimatableLength(value)->toLength(style, state.rootElementStyle(), style->effectiveZoom(), NonNegativeValues));
if (value->isDouble())
- return BorderImageLength(toAnimatableDouble(value)->toDouble());
+ return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDouble(), 0));
RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(style, state.rootElementStyle(), style->effectiveZoom()));
@@ -101,14 +101,14 @@ LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleRe
animatableValueToLength(animatableLengthBox->left(), state, range));
}
-BorderImageLengthBox animatableValueToBorderImageLengthBox(const AnimatableValue* value, const StyleResolverState& state, NumberRange range = AllValues)
+BorderImageLengthBox animatableValueToBorderImageLengthBox(const AnimatableValue* value, const StyleResolverState& state)
{
const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value);
return BorderImageLengthBox(
- animatableValueToBorderImageLength(animatableLengthBox->top(), state, range),
- animatableValueToBorderImageLength(animatableLengthBox->right(), state, range),
- animatableValueToBorderImageLength(animatableLengthBox->bottom(), state, range),
- animatableValueToBorderImageLength(animatableLengthBox->left(), state, range));
+ animatableValueToBorderImageLength(animatableLengthBox->top(), state),
+ animatableValueToBorderImageLength(animatableLengthBox->right(), state),
+ animatableValueToBorderImageLength(animatableLengthBox->bottom(), state),
+ animatableValueToBorderImageLength(animatableLengthBox->left(), state));
}
LengthPoint animatableValueToLengthPoint(const AnimatableValue* value, const StyleResolverState& state, NumberRange range = AllValues)
@@ -271,7 +271,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setBorderBottomWidth(animatableValueRoundClampTo<unsigned>(value));
return;
case CSSPropertyBorderImageOutset:
- style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state, NonNegativeValues));
+ style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state));
return;
case CSSPropertyBorderImageSlice:
style->setBorderImageSlices(animatableValueToLengthBox(value, state, NonNegativeValues));
@@ -280,7 +280,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setBorderImageSource(toAnimatableImage(value)->toStyleImage());
return;
case CSSPropertyBorderImageWidth:
- style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state, NonNegativeValues));
+ style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state));
return;
case CSSPropertyBorderLeftColor:
style->setBorderLeftColor(toAnimatableColor(value)->color());
@@ -505,7 +505,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setFilter(toAnimatableFilterOperations(value)->operations());
return;
case CSSPropertyWebkitMaskBoxImageOutset:
- style->setMaskBoxImageOutset(animatableValueToBorderImageLengthBox(value, state, NonNegativeValues));
+ style->setMaskBoxImageOutset(animatableValueToBorderImageLengthBox(value, state));
return;
case CSSPropertyWebkitMaskBoxImageSlice:
style->setMaskBoxImageSlices(animatableValueToLengthBox(toAnimatableLengthBoxAndBool(value)->box(), state, NonNegativeValues));
@@ -515,7 +515,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt
style->setMaskBoxImageSource(toAnimatableImage(value)->toStyleImage());
return;
case CSSPropertyWebkitMaskBoxImageWidth:
- style->setMaskBoxImageWidth(animatableValueToBorderImageLengthBox(value, state, NonNegativeValues));
+ style->setMaskBoxImageWidth(animatableValueToBorderImageLengthBox(value, state));
return;
case CSSPropertyWebkitMaskImage:
setOnFillLayers<CSSPropertyWebkitMaskImage>(style->accessMaskLayers(), value, state);
« no previous file with comments | « LayoutTests/virtual/web-animations-css/animations/interpolation/webkit-mask-box-image-width-interpolation-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698