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

Unified Diff: third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 2562643002: Avoid visually transitioning on length CSS properties when zoom changes (Closed)
Patch Set: Use setup() Created 4 years 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/css/CSSAnimatableValueFactory.cpp
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp
index 8f455bf4d031b1ad4f9e9441711a644586d3936b..57e060c331517bd7792630475db1cfe7fa660113 100644
--- a/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp
+++ b/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp
@@ -31,6 +31,7 @@
#include "core/animation/css/CSSAnimatableValueFactory.h"
#include "core/CSSValueKeywords.h"
+#include "core/animation/LengthPropertyFunctions.h"
#include "core/animation/animatable/AnimatableClipPathOperation.h"
#include "core/animation/animatable/AnimatableColor.h"
#include "core/animation/animatable/AnimatableDouble.h"
@@ -96,6 +97,15 @@ static PassRefPtr<AnimatableValue> createFromLength(
return createFromLengthWithZoom(length, style.effectiveZoom());
}
+static PassRefPtr<AnimatableValue> createFromPropertyLength(
+ CSSPropertyID property,
+ const ComputedStyle& style) {
+ Length length;
+ bool success = LengthPropertyFunctions::getLength(property, style, length);
+ DCHECK(success);
+ return createFromLength(length, style);
+}
+
static PassRefPtr<AnimatableValue> createFromUnzoomedLength(
const UnzoomedLength& unzoomedLength) {
return createFromLengthWithZoom(unzoomedLength.length(), 1);
@@ -175,7 +185,7 @@ inline static PassRefPtr<AnimatableValue> createFromTransformOrigin(
return AnimatableLengthPoint3D::create(
createFromLength(transformOrigin.x(), style),
createFromLength(transformOrigin.y(), style),
- createFromDouble(transformOrigin.z()));
+ createFromLength(Length(transformOrigin.z(), Fixed), style));
}
inline static PassRefPtr<AnimatableValue> createFromLengthSize(
@@ -371,7 +381,7 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyBorderBottomRightRadius:
return createFromLengthSize(style.borderBottomRightRadius(), style);
case CSSPropertyBorderBottomWidth:
- return createFromDouble(style.borderBottomWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyBorderImageOutset:
return createFromBorderImageLengthBox(style.borderImageOutset(), style);
case CSSPropertyBorderImageSlice:
@@ -384,11 +394,11 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyBorderLeftColor:
return createFromColor(property, style);
case CSSPropertyBorderLeftWidth:
- return createFromDouble(style.borderLeftWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyBorderRightColor:
return createFromColor(property, style);
case CSSPropertyBorderRightWidth:
- return createFromDouble(style.borderRightWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyBorderTopColor:
return createFromColor(property, style);
case CSSPropertyBorderTopLeftRadius:
@@ -396,7 +406,7 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyBorderTopRightRadius:
return createFromLengthSize(style.borderTopRightRadius(), style);
case CSSPropertyBorderTopWidth:
- return createFromDouble(style.borderTopWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyBottom:
return createFromLength(style.bottom(), style);
case CSSPropertyBoxShadow:
@@ -454,7 +464,7 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyLeft:
return createFromLength(style.left(), style);
case CSSPropertyLetterSpacing:
- return createFromDouble(style.letterSpacing());
+ return createFromPropertyLength(property, style);
case CSSPropertyLineHeight:
return createFromLineHeight(style.specifiedLineHeight(), style);
case CSSPropertyMarginBottom:
@@ -482,9 +492,9 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyOutlineColor:
return createFromColor(property, style);
case CSSPropertyOutlineOffset:
- return createFromDouble(style.outlineOffset());
+ return createFromPropertyLength(property, style);
case CSSPropertyOutlineWidth:
- return createFromDouble(style.outlineWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyPaddingBottom:
return createFromLength(style.paddingBottom(), style);
case CSSPropertyPaddingLeft:
@@ -527,9 +537,9 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyTop:
return createFromLength(style.top(), style);
case CSSPropertyWebkitBorderHorizontalSpacing:
- return createFromDouble(style.horizontalBorderSpacing());
+ return createFromPropertyLength(property, style);
case CSSPropertyWebkitBorderVerticalSpacing:
- return createFromDouble(style.verticalBorderSpacing());
+ return createFromPropertyLength(property, style);
case CSSPropertyClipPath:
if (ClipPathOperation* operation = style.clipPath())
return AnimatableClipPathOperation::create(operation);
@@ -539,15 +549,15 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
return AnimatableUnknown::create(CSSValueAuto);
return createFromDouble(style.columnCount());
case CSSPropertyColumnGap:
- return createFromDouble(style.columnGap());
+ return createFromPropertyLength(property, style);
case CSSPropertyColumnRuleColor:
return createFromColor(property, style);
case CSSPropertyColumnRuleWidth:
- return createFromDouble(style.columnRuleWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyColumnWidth:
if (style.hasAutoColumnWidth())
return AnimatableUnknown::create(CSSValueAuto);
- return createFromDouble(style.columnWidth());
+ return createFromPropertyLength(property, style);
case CSSPropertyFilter:
return AnimatableFilterOperations::create(style.filter());
case CSSPropertyBackdropFilter:
@@ -578,7 +588,7 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
return AnimatableUnknown::create(
CSSIdentifierValue::create(CSSValueNone));
}
- return createFromDouble(style.perspective());
+ return createFromPropertyLength(property, style);
case CSSPropertyPerspectiveOrigin:
return createFromLengthPoint(style.perspectiveOrigin(), style);
case CSSPropertyShapeOutside:
@@ -636,13 +646,13 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(
case CSSPropertyWebkitTransformOriginY:
return createFromLength(style.transformOriginY(), style);
case CSSPropertyWebkitTransformOriginZ:
- return createFromDouble(style.transformOriginZ());
+ return createFromPropertyLength(property, style);
case CSSPropertyWidows:
return createFromDouble(style.widows());
case CSSPropertyWidth:
return createFromLength(style.width(), style);
case CSSPropertyWordSpacing:
- return createFromDouble(style.wordSpacing());
+ return createFromPropertyLength(property, style);
case CSSPropertyVerticalAlign:
if (style.verticalAlign() == VerticalAlignLength)
return createFromLength(style.getVerticalAlignLength(), style);

Powered by Google App Engine
This is Rietveld 408576698