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

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

Issue 90113003: Web Animations CSS: Fix crash when animating viewport units (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/animation/css/CSSAnimatableValueFactory.cpp
diff --git a/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
index 26c2fc9be822f722409f8be7d658f32b44bfe81a..6355b30f359a29f260ce5c6d6fa3da40b5096a54 100644
--- a/Source/core/animation/css/CSSAnimatableValueFactory.cpp
+++ b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
@@ -68,14 +68,6 @@ static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const
return AnimatableLength::create(adjustFloatForAbsoluteZoom(length.value(), style), AnimatableLength::UnitTypePixels);
case Percent:
return AnimatableLength::create(length.value(), AnimatableLength::UnitTypePercentage);
- case ViewportPercentageWidth:
- return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportWidth);
- case ViewportPercentageHeight:
- return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportHeight);
- case ViewportPercentageMin:
- return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportMin);
- case ViewportPercentageMax:
- return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportMax);
case Calculated:
return AnimatableLength::create(CSSCalcValue::createExpressionNode(length.calculationValue()->expression(), style.effectiveZoom()));
case Auto:
@@ -85,6 +77,11 @@ static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const
case MaxContent:
case FillAvailable:
case FitContent:
+ // FIXME: Support for viewport units needs to be improved before we can animate them as CSS values.
+ case ViewportPercentageWidth:
+ case ViewportPercentageHeight:
+ case ViewportPercentageMin:
+ case ViewportPercentageMax:
return AnimatableUnknown::create(CSSPrimitiveValue::create(length));
case Undefined:
return AnimatableUnknown::create(CSSValueNone);
@@ -98,19 +95,14 @@ static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const
static PassRefPtr<AnimatableValue> createFromLineHeight(const Length& length, const RenderStyle& style)
{
- double value = length.value();
- switch (length.type()) {
- case Fixed:
- return AnimatableLength::create(adjustFloatForAbsoluteZoom(value, style), AnimatableLength::UnitTypePixels);
- case Percent:
+ if (length.type() == Percent) {
+ double value = length.value();
// -100% is used to represent "normal" line height.
if (value == -100)
return AnimatableUnknown::create(CSSValueNormal);
return AnimatableDouble::create(value);
- default:
- ASSERT_NOT_REACHED();
- return 0;
}
+ return createFromLength(length, style);
}
inline static PassRefPtr<AnimatableValue> createFromDouble(double value, AnimatableDouble::Constraint constraint = AnimatableDouble::Unconstrained)

Powered by Google App Engine
This is Rietveld 408576698