| 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 6539015eee3bf3ac8f8154898b98abd9a25a539f..d64c35f2942aff6a43716f039e6e339de6747fbc 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp
|
| @@ -102,6 +102,13 @@ BorderImageLength animatableValueToBorderImageLength(
|
| return Length(Auto);
|
| }
|
|
|
| +double animatableValueToPixels(const AnimatableValue* value,
|
| + const StyleResolverState& state) {
|
| + return toAnimatableLength(value)
|
| + ->getLength(state.style()->effectiveZoom(), ValueRangeAll)
|
| + .pixels();
|
| +}
|
| +
|
| template <typename T>
|
| T roundedClampTo(double value) {
|
| static_assert(std::is_integral<T>::value,
|
| @@ -115,12 +122,11 @@ T animatableValueClampTo(const AnimatableValue* value) {
|
| }
|
|
|
| template <typename T>
|
| -T animatableLineWidthClamp(const AnimatableValue* value) {
|
| - double doubleValue = toAnimatableDouble(value)->toDouble();
|
| +T animatableLineWidthClamp(const AnimatableValue* value,
|
| + const StyleResolverState& state) {
|
| + double lineWidth = animatableValueToPixels(value, state);
|
| // This matches StyleBuilderConverter::convertLineWidth().
|
| - return (doubleValue > 0 && doubleValue < 1)
|
| - ? 1
|
| - : animatableValueClampTo<T>(value);
|
| + return (lineWidth > 0 && lineWidth < 1) ? 1 : roundedClampTo<T>(lineWidth);
|
| }
|
|
|
| LengthBox animatableValueToLengthBox(const AnimatableValue* value,
|
| @@ -164,8 +170,7 @@ TransformOrigin animatableValueToTransformOrigin(
|
| return TransformOrigin(
|
| animatableValueToLength(animatableLengthPoint3D->x(), state),
|
| animatableValueToLength(animatableLengthPoint3D->y(), state),
|
| - clampTo<float>(
|
| - toAnimatableDouble(animatableLengthPoint3D->z())->toDouble()));
|
| + animatableValueToPixels(animatableLengthPoint3D->z(), state));
|
| }
|
|
|
| LengthSize animatableValueToLengthSize(const AnimatableValue* value,
|
| @@ -353,7 +358,8 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| animatableValueToLengthSize(value, state, ValueRangeNonNegative));
|
| return;
|
| case CSSPropertyBorderBottomWidth:
|
| - style->setBorderBottomWidth(animatableLineWidthClamp<unsigned>(value));
|
| + style->setBorderBottomWidth(
|
| + animatableLineWidthClamp<unsigned>(value, state));
|
| return;
|
| case CSSPropertyBorderImageOutset:
|
| style->setBorderImageOutset(
|
| @@ -380,7 +386,8 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| toAnimatableColor(value)->visitedLinkColor());
|
| return;
|
| case CSSPropertyBorderLeftWidth:
|
| - style->setBorderLeftWidth(animatableLineWidthClamp<unsigned>(value));
|
| + style->setBorderLeftWidth(
|
| + animatableLineWidthClamp<unsigned>(value, state));
|
| return;
|
| case CSSPropertyBorderRightColor:
|
| style->setBorderRightColor(toAnimatableColor(value)->getColor());
|
| @@ -388,7 +395,8 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| toAnimatableColor(value)->visitedLinkColor());
|
| return;
|
| case CSSPropertyBorderRightWidth:
|
| - style->setBorderRightWidth(animatableLineWidthClamp<unsigned>(value));
|
| + style->setBorderRightWidth(
|
| + animatableLineWidthClamp<unsigned>(value, state));
|
| return;
|
| case CSSPropertyBorderTopColor:
|
| style->setBorderTopColor(toAnimatableColor(value)->getColor());
|
| @@ -404,7 +412,8 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| animatableValueToLengthSize(value, state, ValueRangeNonNegative));
|
| return;
|
| case CSSPropertyBorderTopWidth:
|
| - style->setBorderTopWidth(animatableLineWidthClamp<unsigned>(value));
|
| + style->setBorderTopWidth(
|
| + animatableLineWidthClamp<unsigned>(value, state));
|
| return;
|
| case CSSPropertyBottom:
|
| style->setBottom(animatableValueToLength(value, state));
|
| @@ -489,7 +498,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| return;
|
| case CSSPropertyLetterSpacing:
|
| style->setLetterSpacing(
|
| - clampTo<float>(toAnimatableDouble(value)->toDouble()));
|
| + clampTo<float>(animatableValueToPixels(value, state)));
|
| return;
|
| case CSSPropertyMarginBottom:
|
| style->setMarginBottom(animatableValueToLength(value, state));
|
| @@ -537,10 +546,12 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| toAnimatableColor(value)->visitedLinkColor());
|
| return;
|
| case CSSPropertyOutlineOffset:
|
| - style->setOutlineOffset(animatableValueClampTo<int>(value));
|
| + style->setOutlineOffset(
|
| + roundedClampTo<int>(animatableValueToPixels(value, state)));
|
| return;
|
| case CSSPropertyOutlineWidth:
|
| - style->setOutlineWidth(animatableLineWidthClamp<unsigned short>(value));
|
| + style->setOutlineWidth(
|
| + animatableLineWidthClamp<unsigned short>(value, state));
|
| return;
|
| case CSSPropertyPaddingBottom:
|
| style->setPaddingBottom(
|
| @@ -613,12 +624,12 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| style->setTop(animatableValueToLength(value, state));
|
| return;
|
| case CSSPropertyWebkitBorderHorizontalSpacing:
|
| - style->setHorizontalBorderSpacing(
|
| - animatableValueClampTo<unsigned short>(value));
|
| + style->setHorizontalBorderSpacing(roundedClampTo<unsigned short>(
|
| + animatableValueToPixels(value, state)));
|
| return;
|
| case CSSPropertyWebkitBorderVerticalSpacing:
|
| - style->setVerticalBorderSpacing(
|
| - animatableValueClampTo<unsigned short>(value));
|
| + style->setVerticalBorderSpacing(roundedClampTo<unsigned short>(
|
| + animatableValueToPixels(value, state)));
|
| return;
|
| case CSSPropertyClipPath:
|
| style->setClipPath(
|
| @@ -629,7 +640,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| round(toAnimatableDouble(value)->toDouble()), 1));
|
| return;
|
| case CSSPropertyColumnGap:
|
| - style->setColumnGap(clampTo(toAnimatableDouble(value)->toDouble(), 0));
|
| + style->setColumnGap(clampTo(animatableValueToPixels(value, state), 0));
|
| return;
|
| case CSSPropertyColumnRuleColor:
|
| style->setColumnRuleColor(toAnimatableColor(value)->getColor());
|
| @@ -637,12 +648,12 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| toAnimatableColor(value)->visitedLinkColor());
|
| return;
|
| case CSSPropertyColumnWidth:
|
| - style->setColumnWidth(clampTo(toAnimatableDouble(value)->toDouble(),
|
| + style->setColumnWidth(clampTo(animatableValueToPixels(value, state),
|
| std::numeric_limits<float>::epsilon()));
|
| return;
|
| case CSSPropertyColumnRuleWidth:
|
| style->setColumnRuleWidth(
|
| - animatableLineWidthClamp<unsigned short>(value));
|
| + animatableLineWidthClamp<unsigned short>(value, state));
|
| return;
|
| case CSSPropertyFilter:
|
| style->setFilter(toAnimatableFilterOperations(value)->operations());
|
| @@ -688,8 +699,8 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| return;
|
| case CSSPropertyPerspective:
|
| style->setPerspective(
|
| - value->isDouble()
|
| - ? clampTo<float>(toAnimatableDouble(value)->toDouble())
|
| + value->isLength()
|
| + ? clampTo<float>(animatableValueToPixels(value, state))
|
| : 0);
|
| return;
|
| case CSSPropertyPerspectiveOrigin:
|
| @@ -783,7 +794,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| style->setTransformOriginY(animatableValueToLength(value, state));
|
| return;
|
| case CSSPropertyWebkitTransformOriginZ:
|
| - style->setTransformOriginZ(toAnimatableDouble(value)->toDouble());
|
| + style->setTransformOriginZ(animatableValueToPixels(value, state));
|
| return;
|
| case CSSPropertyWidows:
|
| style->setWidows(
|
| @@ -795,7 +806,7 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property,
|
| return;
|
| case CSSPropertyWordSpacing:
|
| style->setWordSpacing(
|
| - clampTo<float>(toAnimatableDouble(value)->toDouble()));
|
| + clampTo<float>(animatableValueToPixels(value, state)));
|
| return;
|
| case CSSPropertyVerticalAlign:
|
| style->setVerticalAlignLength(animatableValueToLength(value, state));
|
|
|