Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / animation / css / CSSAnimatableValueFactory.cpp
index e770d7a..bf953ed 100644 (file)
 #include "config.h"
 #include "core/animation/css/CSSAnimatableValueFactory.h"
 
-#include "CSSValueKeywords.h"
-#include "core/animation/AnimatableClipPathOperation.h"
-#include "core/animation/AnimatableColor.h"
-#include "core/animation/AnimatableDouble.h"
-#include "core/animation/AnimatableFilterOperations.h"
-#include "core/animation/AnimatableImage.h"
-#include "core/animation/AnimatableLength.h"
-#include "core/animation/AnimatableLengthBox.h"
-#include "core/animation/AnimatableLengthBoxAndBool.h"
-#include "core/animation/AnimatableLengthPoint.h"
-#include "core/animation/AnimatableLengthSize.h"
-#include "core/animation/AnimatableRepeatable.h"
-#include "core/animation/AnimatableSVGLength.h"
-#include "core/animation/AnimatableSVGPaint.h"
-#include "core/animation/AnimatableShadow.h"
-#include "core/animation/AnimatableShapeValue.h"
-#include "core/animation/AnimatableStrokeDasharrayList.h"
-#include "core/animation/AnimatableTransform.h"
-#include "core/animation/AnimatableUnknown.h"
-#include "core/animation/AnimatableVisibility.h"
-#include "core/animation/css/CSSAnimations.h"
+#include "core/CSSValueKeywords.h"
+#include "core/animation/animatable/AnimatableClipPathOperation.h"
+#include "core/animation/animatable/AnimatableColor.h"
+#include "core/animation/animatable/AnimatableDouble.h"
+#include "core/animation/animatable/AnimatableFilterOperations.h"
+#include "core/animation/animatable/AnimatableImage.h"
+#include "core/animation/animatable/AnimatableLength.h"
+#include "core/animation/animatable/AnimatableLengthBox.h"
+#include "core/animation/animatable/AnimatableLengthBoxAndBool.h"
+#include "core/animation/animatable/AnimatableLengthPoint.h"
+#include "core/animation/animatable/AnimatableLengthPoint3D.h"
+#include "core/animation/animatable/AnimatableLengthSize.h"
+#include "core/animation/animatable/AnimatableRepeatable.h"
+#include "core/animation/animatable/AnimatableSVGLength.h"
+#include "core/animation/animatable/AnimatableSVGPaint.h"
+#include "core/animation/animatable/AnimatableShadow.h"
+#include "core/animation/animatable/AnimatableShapeValue.h"
+#include "core/animation/animatable/AnimatableStrokeDasharrayList.h"
+#include "core/animation/animatable/AnimatableTransform.h"
+#include "core/animation/animatable/AnimatableUnknown.h"
+#include "core/animation/animatable/AnimatableVisibility.h"
 #include "core/css/CSSCalculationValue.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/css/CSSPropertyMetadata.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "platform/Length.h"
 #include "platform/LengthBox.h"
 
-namespace WebCore {
+namespace blink {
 
-static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle& style)
 {
     switch (length.type()) {
     case Fixed:
-        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()));
+        return AnimatableLength::create(length, style.effectiveZoom());
     case Auto:
     case Intrinsic:
     case MinIntrinsic:
@@ -85,41 +76,37 @@ static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const
     case MaxContent:
     case FillAvailable:
     case FitContent:
-        return AnimatableUnknown::create(CSSPrimitiveValue::create(length));
+        return AnimatableUnknown::create(CSSPrimitiveValue::create(length, 1));
     case Undefined:
         return AnimatableUnknown::create(CSSValueNone);
     case ExtendToZoom: // Does not apply to elements.
-    case Relative: // Does not get used by interpolable properties.
+    case DeviceWidth:
+    case DeviceHeight:
         ASSERT_NOT_REACHED();
-        return 0;
+        return nullptr;
     }
     ASSERT_NOT_REACHED();
-    return 0;
+    return nullptr;
 }
 
-static PassRefPtr<AnimatableValue> createFromLineHeight(const Length& length, const RenderStyle* style)
+static PassRefPtrWillBeRawPtr<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)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromDouble(double value, AnimatableDouble::Constraint constraint = AnimatableDouble::Unconstrained)
 {
     return AnimatableDouble::create(value, constraint);
 }
 
-inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle& style)
 {
     return AnimatableLengthBox::create(
         createFromLength(lengthBox.left(), style),
@@ -128,35 +115,53 @@ inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& l
         createFromLength(lengthBox.bottom(), style));
 }
 
-inline static PassRefPtr<AnimatableValue> createFromLengthBoxAndBool(const LengthBox lengthBox, const bool flag, const RenderStyle *style)
+static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBorderImageLength(const BorderImageLength& borderImageLength, const RenderStyle& style)
+{
+    if (borderImageLength.isNumber())
+        return createFromDouble(borderImageLength.number());
+    return createFromLength(borderImageLength.length(), style);
+}
+
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBorderImageLengthBox(const BorderImageLengthBox& borderImageLengthBox, const RenderStyle& style)
+{
+    return AnimatableLengthBox::create(
+        createFromBorderImageLength(borderImageLengthBox.left(), style),
+        createFromBorderImageLength(borderImageLengthBox.right(), style),
+        createFromBorderImageLength(borderImageLengthBox.top(), style),
+        createFromBorderImageLength(borderImageLengthBox.bottom(), style));
+}
+
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthBoxAndBool(const LengthBox lengthBox, const bool flag, const RenderStyle& style)
 {
     return AnimatableLengthBoxAndBool::create(
         createFromLengthBox(lengthBox, style),
         flag);
 }
 
-inline static PassRefPtr<AnimatableValue> createFromLengthPoint(const LengthPoint& lengthPoint, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthPoint(const LengthPoint& lengthPoint, const RenderStyle& style)
 {
     return AnimatableLengthPoint::create(
         createFromLength(lengthPoint.x(), style),
         createFromLength(lengthPoint.y(), style));
 }
 
-inline static PassRefPtr<AnimatableValue> createFromLengthSize(const LengthSize& lengthSize, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthSize(const LengthSize& lengthSize, const RenderStyle& style)
 {
     return AnimatableLengthSize::create(
         createFromLength(lengthSize.width(), style),
         createFromLength(lengthSize.height(), style));
 }
 
-inline static PassRefPtr<AnimatableValue> createFromStyleImage(StyleImage* image)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromStyleImage(StyleImage* image)
 {
-    if (image)
-        return AnimatableImage::create(image);
+    if (image) {
+        if (RefPtrWillBeRawPtr<CSSValue> cssValue = image->cssValue())
+            return AnimatableImage::create(cssValue.release());
+    }
     return AnimatableUnknown::create(CSSValueNone);
 }
 
-inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fillSize, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFillSize(const FillSize& fillSize, const RenderStyle& style)
 {
     switch (fillSize.type) {
     case SizeLength:
@@ -167,16 +172,22 @@ inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fil
         return AnimatableUnknown::create(CSSPrimitiveValue::create(fillSize.type));
     default:
         ASSERT_NOT_REACHED();
-        return 0;
+        return nullptr;
     }
 }
 
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBackgroundPosition(const Length& length, bool originIsSet, BackgroundEdgeOrigin origin, const RenderStyle& style)
+{
+    if (!originIsSet || origin == LeftEdge || origin == TopEdge)
+        return createFromLength(length, style);
+    return createFromLength(length.subtractFromOneHundredPercent(), style);
+}
+
 template<CSSPropertyID property>
-inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer* fillLayer, const RenderStyle* style)
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFillLayers(const FillLayer& fillLayers, const RenderStyle& style)
 {
-    ASSERT(fillLayer);
-    Vector<RefPtr<AnimatableValue> > values;
-    while (fillLayer) {
+    WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > values;
+    for (const FillLayer* fillLayer = &fillLayers; fillLayer; fillLayer = fillLayer->next()) {
         if (property == CSSPropertyBackgroundImage || property == CSSPropertyWebkitMaskImage) {
             if (!fillLayer->isImageSet())
                 break;
@@ -184,11 +195,11 @@ inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer*
         } else if (property == CSSPropertyBackgroundPositionX || property == CSSPropertyWebkitMaskPositionX) {
             if (!fillLayer->isXPositionSet())
                 break;
-            values.append(createFromLength(fillLayer->xPosition(), style));
+            values.append(createFromBackgroundPosition(fillLayer->xPosition(), fillLayer->isBackgroundXOriginSet(), fillLayer->backgroundXOrigin(), style));
         } else if (property == CSSPropertyBackgroundPositionY || property == CSSPropertyWebkitMaskPositionY) {
             if (!fillLayer->isYPositionSet())
                 break;
-            values.append(createFromLength(fillLayer->yPosition(), style));
+            values.append(createFromBackgroundPosition(fillLayer->yPosition(), fillLayer->isBackgroundYOriginSet(), fillLayer->backgroundYOrigin(), style));
         } else if (property == CSSPropertyBackgroundSize || property == CSSPropertyWebkitMaskSize) {
             if (!fillLayer->isSizeSet())
                 break;
@@ -196,259 +207,309 @@ inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer*
         } else {
             ASSERT_NOT_REACHED();
         }
-        fillLayer = fillLayer->next();
     }
     return AnimatableRepeatable::create(values);
 }
 
-PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle* style)
+PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle& style)
 {
-    Color color = style->colorIncludingFallback(property, false);
-    Color visitedLinkColor = style->colorIncludingFallback(property, true);
-    Color fallbackColor = style->color();
-    Color fallbackVisitedLinkColor = style->visitedLinkColor();
-    Color resolvedColor;
-    if (color.isValid())
-        resolvedColor = color;
-    else
-        resolvedColor = fallbackColor;
-    Color resolvedVisitedLinkColor;
-    if (visitedLinkColor.isValid())
-        resolvedVisitedLinkColor = visitedLinkColor;
-    else
-        resolvedVisitedLinkColor = fallbackVisitedLinkColor;
-    return AnimatableColor::create(resolvedColor, resolvedVisitedLinkColor);
+    Color color = style.colorIncludingFallback(property, false);
+    Color visitedLinkColor = style.colorIncludingFallback(property, true);
+    return AnimatableColor::create(color, visitedLinkColor);
+}
+
+inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromShapeValue(ShapeValue* value)
+{
+    if (value)
+        return AnimatableShapeValue::create(value);
+    return AnimatableUnknown::create(CSSValueNone);
+}
+
+static double fontStretchToDouble(FontStretch fontStretch)
+{
+    return static_cast<unsigned>(fontStretch);
+}
+
+static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontStretch(FontStretch fontStretch)
+{
+    return createFromDouble(fontStretchToDouble(fontStretch));
+}
+
+static double fontWeightToDouble(FontWeight fontWeight)
+{
+    switch (fontWeight) {
+    case FontWeight100:
+        return 100;
+    case FontWeight200:
+        return 200;
+    case FontWeight300:
+        return 300;
+    case FontWeight400:
+        return 400;
+    case FontWeight500:
+        return 500;
+    case FontWeight600:
+        return 600;
+    case FontWeight700:
+        return 700;
+    case FontWeight800:
+        return 800;
+    case FontWeight900:
+        return 900;
+    }
+
+    ASSERT_NOT_REACHED();
+    return 400;
+}
+
+static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontWeight(FontWeight fontWeight)
+{
+    return createFromDouble(fontWeightToDouble(fontWeight));
 }
 
 // FIXME: Generate this function.
-PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle* style)
+PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style)
 {
+    ASSERT(CSSPropertyMetadata::isAnimatableProperty(property));
     switch (property) {
     case CSSPropertyBackgroundColor:
         return createFromColor(property, style);
     case CSSPropertyBackgroundImage:
-        return createFromFillLayers<CSSPropertyBackgroundImage>(style->backgroundLayers(), style);
+        return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style);
     case CSSPropertyBackgroundPositionX:
-        return createFromFillLayers<CSSPropertyBackgroundPositionX>(style->backgroundLayers(), style);
+        return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style);
     case CSSPropertyBackgroundPositionY:
-        return createFromFillLayers<CSSPropertyBackgroundPositionY>(style->backgroundLayers(), style);
+        return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style);
     case CSSPropertyBackgroundSize:
     case CSSPropertyWebkitBackgroundSize:
-        return createFromFillLayers<CSSPropertyBackgroundSize>(style->backgroundLayers(), style);
+        return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style);
     case CSSPropertyBaselineShift:
-        return AnimatableSVGLength::create(style->baselineShiftValue());
+        return AnimatableSVGLength::create(style.baselineShiftValue());
     case CSSPropertyBorderBottomColor:
         return createFromColor(property, style);
     case CSSPropertyBorderBottomLeftRadius:
-        return createFromLengthSize(style->borderBottomLeftRadius(), style);
+        return createFromLengthSize(style.borderBottomLeftRadius(), style);
     case CSSPropertyBorderBottomRightRadius:
-        return createFromLengthSize(style->borderBottomRightRadius(), style);
+        return createFromLengthSize(style.borderBottomRightRadius(), style);
     case CSSPropertyBorderBottomWidth:
-        return createFromDouble(style->borderBottomWidth());
+        return createFromDouble(style.borderBottomWidth());
     case CSSPropertyBorderImageOutset:
-        return createFromLengthBox(style->borderImageOutset(), style);
+        return createFromBorderImageLengthBox(style.borderImageOutset(), style);
     case CSSPropertyBorderImageSlice:
-        return createFromLengthBox(style->borderImageSlices(), style);
+        return createFromLengthBox(style.borderImageSlices(), style);
     case CSSPropertyBorderImageSource:
-        return createFromStyleImage(style->borderImageSource());
+        return createFromStyleImage(style.borderImageSource());
     case CSSPropertyBorderImageWidth:
-        return createFromLengthBox(style->borderImageWidth(), style);
+        return createFromBorderImageLengthBox(style.borderImageWidth(), style);
     case CSSPropertyBorderLeftColor:
         return createFromColor(property, style);
     case CSSPropertyBorderLeftWidth:
-        return createFromDouble(style->borderLeftWidth());
+        return createFromDouble(style.borderLeftWidth());
     case CSSPropertyBorderRightColor:
         return createFromColor(property, style);
     case CSSPropertyBorderRightWidth:
-        return createFromDouble(style->borderRightWidth());
+        return createFromDouble(style.borderRightWidth());
     case CSSPropertyBorderTopColor:
         return createFromColor(property, style);
     case CSSPropertyBorderTopLeftRadius:
-        return createFromLengthSize(style->borderTopLeftRadius(), style);
+        return createFromLengthSize(style.borderTopLeftRadius(), style);
     case CSSPropertyBorderTopRightRadius:
-        return createFromLengthSize(style->borderTopRightRadius(), style);
+        return createFromLengthSize(style.borderTopRightRadius(), style);
     case CSSPropertyBorderTopWidth:
-        return createFromDouble(style->borderTopWidth());
+        return createFromDouble(style.borderTopWidth());
     case CSSPropertyBottom:
-        return createFromLength(style->bottom(), style);
+        return createFromLength(style.bottom(), style);
     case CSSPropertyBoxShadow:
     case CSSPropertyWebkitBoxShadow:
-        return AnimatableShadow::create(style->boxShadow());
+        return AnimatableShadow::create(style.boxShadow());
     case CSSPropertyClip:
-        if (style->hasClip())
-            return createFromLengthBox(style->clip(), style);
+        if (style.hasClip())
+            return createFromLengthBox(style.clip(), style);
         return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto));
     case CSSPropertyColor:
         return createFromColor(property, style);
     case CSSPropertyFillOpacity:
-        return createFromDouble(style->fillOpacity());
+        return createFromDouble(style.fillOpacity());
     case CSSPropertyFill:
-        return AnimatableSVGPaint::create(style->svgStyle()->fillPaintType(), style->svgStyle()->fillPaintColor(), style->svgStyle()->fillPaintUri());
+        return AnimatableSVGPaint::create(
+            style.svgStyle().fillPaintType(), style.svgStyle().visitedLinkFillPaintType(),
+            style.svgStyle().fillPaintColor(), style.svgStyle().visitedLinkFillPaintColor(),
+            style.svgStyle().fillPaintUri(), style.svgStyle().visitedLinkFillPaintUri());
     case CSSPropertyFlexGrow:
-        return createFromDouble(style->flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
+        return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
     case CSSPropertyFlexShrink:
-        return createFromDouble(style->flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
+        return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
     case CSSPropertyFlexBasis:
-        return createFromLength(style->flexBasis(), style);
+        return createFromLength(style.flexBasis(), style);
     case CSSPropertyFloodColor:
         return createFromColor(property, style);
     case CSSPropertyFloodOpacity:
-        return createFromDouble(style->floodOpacity());
+        return createFromDouble(style.floodOpacity());
     case CSSPropertyFontSize:
         // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
         // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
         // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
         // enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
-        return createFromDouble(style->specifiedFontSize());
+        return createFromDouble(style.specifiedFontSize());
+    case CSSPropertyFontStretch:
+        return createFromFontStretch(style.fontStretch());
+    case CSSPropertyFontWeight:
+        return createFromFontWeight(style.fontWeight());
     case CSSPropertyHeight:
-        return createFromLength(style->height(), style);
-    case CSSPropertyKerning:
-        return AnimatableSVGLength::create(style->kerning());
+        return createFromLength(style.height(), style);
     case CSSPropertyLightingColor:
         return createFromColor(property, style);
     case CSSPropertyListStyleImage:
-        return createFromStyleImage(style->listStyleImage());
+        return createFromStyleImage(style.listStyleImage());
     case CSSPropertyLeft:
-        return createFromLength(style->left(), style);
+        return createFromLength(style.left(), style);
     case CSSPropertyLetterSpacing:
-        return createFromDouble(style->letterSpacing());
+        return createFromDouble(style.letterSpacing());
     case CSSPropertyLineHeight:
-        return createFromLineHeight(style->specifiedLineHeight(), style);
+        return createFromLineHeight(style.specifiedLineHeight(), style);
     case CSSPropertyMarginBottom:
-        return createFromLength(style->marginBottom(), style);
+        return createFromLength(style.marginBottom(), style);
     case CSSPropertyMarginLeft:
-        return createFromLength(style->marginLeft(), style);
+        return createFromLength(style.marginLeft(), style);
     case CSSPropertyMarginRight:
-        return createFromLength(style->marginRight(), style);
+        return createFromLength(style.marginRight(), style);
     case CSSPropertyMarginTop:
-        return createFromLength(style->marginTop(), style);
+        return createFromLength(style.marginTop(), style);
     case CSSPropertyMaxHeight:
-        return createFromLength(style->maxHeight(), style);
+        return createFromLength(style.maxHeight(), style);
     case CSSPropertyMaxWidth:
-        return createFromLength(style->maxWidth(), style);
+        return createFromLength(style.maxWidth(), style);
     case CSSPropertyMinHeight:
-        return createFromLength(style->minHeight(), style);
+        return createFromLength(style.minHeight(), style);
     case CSSPropertyMinWidth:
-        return createFromLength(style->minWidth(), style);
+        return createFromLength(style.minWidth(), style);
     case CSSPropertyObjectPosition:
-        return createFromLengthPoint(style->objectPosition(), style);
+        return createFromLengthPoint(style.objectPosition(), style);
     case CSSPropertyOpacity:
-        return createFromDouble(style->opacity());
+        return createFromDouble(style.opacity());
     case CSSPropertyOrphans:
-        return createFromDouble(style->orphans());
+        return createFromDouble(style.orphans());
     case CSSPropertyOutlineColor:
         return createFromColor(property, style);
     case CSSPropertyOutlineOffset:
-        return createFromDouble(style->outlineOffset());
+        return createFromDouble(style.outlineOffset());
     case CSSPropertyOutlineWidth:
-        return createFromDouble(style->outlineWidth());
+        return createFromDouble(style.outlineWidth());
     case CSSPropertyPaddingBottom:
-        return createFromLength(style->paddingBottom(), style);
+        return createFromLength(style.paddingBottom(), style);
     case CSSPropertyPaddingLeft:
-        return createFromLength(style->paddingLeft(), style);
+        return createFromLength(style.paddingLeft(), style);
     case CSSPropertyPaddingRight:
-        return createFromLength(style->paddingRight(), style);
+        return createFromLength(style.paddingRight(), style);
     case CSSPropertyPaddingTop:
-        return createFromLength(style->paddingTop(), style);
+        return createFromLength(style.paddingTop(), style);
     case CSSPropertyRight:
-        return createFromLength(style->right(), style);
+        return createFromLength(style.right(), style);
     case CSSPropertyStrokeWidth:
-        return AnimatableSVGLength::create(style->strokeWidth());
+        return AnimatableSVGLength::create(style.strokeWidth());
     case CSSPropertyStopColor:
         return createFromColor(property, style);
     case CSSPropertyStopOpacity:
-        return createFromDouble(style->stopOpacity());
+        return createFromDouble(style.stopOpacity());
     case CSSPropertyStrokeDasharray:
-        return AnimatableStrokeDasharrayList::create(style->strokeDashArray());
+        return AnimatableStrokeDasharrayList::create(style.strokeDashArray());
     case CSSPropertyStrokeDashoffset:
-        return AnimatableSVGLength::create(style->strokeDashOffset());
+        return AnimatableSVGLength::create(style.strokeDashOffset());
     case CSSPropertyStrokeMiterlimit:
-        return createFromDouble(style->strokeMiterLimit());
+        return createFromDouble(style.strokeMiterLimit());
     case CSSPropertyStrokeOpacity:
-        return createFromDouble(style->strokeOpacity());
+        return createFromDouble(style.strokeOpacity());
     case CSSPropertyStroke:
-        return AnimatableSVGPaint::create(style->svgStyle()->strokePaintType(), style->svgStyle()->strokePaintColor(), style->svgStyle()->strokePaintUri());
+        return AnimatableSVGPaint::create(
+            style.svgStyle().strokePaintType(), style.svgStyle().visitedLinkStrokePaintType(),
+            style.svgStyle().strokePaintColor(), style.svgStyle().visitedLinkStrokePaintColor(),
+            style.svgStyle().strokePaintUri(), style.svgStyle().visitedLinkStrokePaintUri());
     case CSSPropertyTextDecorationColor:
-        return createFromColor(property, style);
+        return AnimatableColor::create(style.textDecorationColor().resolve(style.color()), style.visitedLinkTextDecorationColor().resolve(style.visitedLinkColor()));
     case CSSPropertyTextIndent:
-        return createFromLength(style->textIndent(), style);
+        return createFromLength(style.textIndent(), style);
     case CSSPropertyTextShadow:
-        return AnimatableShadow::create(style->textShadow());
+        return AnimatableShadow::create(style.textShadow());
     case CSSPropertyTop:
-        return createFromLength(style->top(), style);
+        return createFromLength(style.top(), style);
     case CSSPropertyWebkitBorderHorizontalSpacing:
-        return createFromDouble(style->horizontalBorderSpacing());
+        return createFromDouble(style.horizontalBorderSpacing());
     case CSSPropertyWebkitBorderVerticalSpacing:
-        return createFromDouble(style->verticalBorderSpacing());
+        return createFromDouble(style.verticalBorderSpacing());
     case CSSPropertyWebkitClipPath:
-        return AnimatableClipPathOperation::create(style->clipPath());
+        if (ClipPathOperation* operation = style.clipPath())
+            return AnimatableClipPathOperation::create(operation);
+        return AnimatableUnknown::create(CSSValueNone);
     case CSSPropertyWebkitColumnCount:
-        return createFromDouble(style->columnCount());
+        return createFromDouble(style.columnCount());
     case CSSPropertyWebkitColumnGap:
-        return createFromDouble(style->columnGap());
+        return createFromDouble(style.columnGap());
     case CSSPropertyWebkitColumnRuleColor:
         return createFromColor(property, style);
     case CSSPropertyWebkitColumnRuleWidth:
-        return createFromDouble(style->columnRuleWidth());
+        return createFromDouble(style.columnRuleWidth());
     case CSSPropertyWebkitColumnWidth:
-        return createFromDouble(style->columnWidth());
+        return createFromDouble(style.columnWidth());
     case CSSPropertyWebkitFilter:
-        return AnimatableFilterOperations::create(style->filter());
+        return AnimatableFilterOperations::create(style.filter());
     case CSSPropertyWebkitMaskBoxImageOutset:
-        return createFromLengthBox(style->maskBoxImageOutset(), style);
+        return createFromBorderImageLengthBox(style.maskBoxImageOutset(), style);
     case CSSPropertyWebkitMaskBoxImageSlice:
-        return createFromLengthBoxAndBool(style->maskBoxImageSlices(), style->maskBoxImageSlicesFill(), style);
+        return createFromLengthBoxAndBool(style.maskBoxImageSlices(), style.maskBoxImageSlicesFill(), style);
     case CSSPropertyWebkitMaskBoxImageSource:
-        return createFromStyleImage(style->maskBoxImageSource());
+        return createFromStyleImage(style.maskBoxImageSource());
     case CSSPropertyWebkitMaskBoxImageWidth:
-        return createFromLengthBox(style->maskBoxImageWidth(), style);
+        return createFromBorderImageLengthBox(style.maskBoxImageWidth(), style);
     case CSSPropertyWebkitMaskImage:
-        return createFromFillLayers<CSSPropertyWebkitMaskImage>(style->maskLayers(), style);
+        return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers(), style);
     case CSSPropertyWebkitMaskPositionX:
-        return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style->maskLayers(), style);
+        return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLayers(), style);
     case CSSPropertyWebkitMaskPositionY:
-        return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style->maskLayers(), style);
+        return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLayers(), style);
     case CSSPropertyWebkitMaskSize:
-        return createFromFillLayers<CSSPropertyWebkitMaskSize>(style->maskLayers(), style);
-    case CSSPropertyWebkitPerspective:
-        return createFromDouble(style->perspective());
-    case CSSPropertyWebkitPerspectiveOriginX:
-        return createFromLength(style->perspectiveOriginX(), style);
-    case CSSPropertyWebkitPerspectiveOriginY:
-        return createFromLength(style->perspectiveOriginY(), style);
-    case CSSPropertyShapeInside:
-        return AnimatableShapeValue::create(style->shapeInside());
+        return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(), style);
+    case CSSPropertyPerspective:
+        return createFromDouble(style.perspective());
+    case CSSPropertyPerspectiveOrigin:
+        return AnimatableLengthPoint::create(
+            createFromLength(style.perspectiveOriginX(), style),
+            createFromLength(style.perspectiveOriginY(), style));
     case CSSPropertyShapeOutside:
-        return AnimatableShapeValue::create(style->shapeOutside());
+        return createFromShapeValue(style.shapeOutside());
     case CSSPropertyShapeMargin:
-        return createFromLength(style->shapeMargin(), style);
+        return createFromLength(style.shapeMargin(), style);
+    case CSSPropertyShapeImageThreshold:
+        return createFromDouble(style.shapeImageThreshold());
     case CSSPropertyWebkitTextStrokeColor:
         return createFromColor(property, style);
-    case CSSPropertyWebkitTransform:
-        return AnimatableTransform::create(style->transform());
-    case CSSPropertyWebkitTransformOriginX:
-        return createFromLength(style->transformOriginX(), style);
-    case CSSPropertyWebkitTransformOriginY:
-        return createFromLength(style->transformOriginY(), style);
-    case CSSPropertyWebkitTransformOriginZ:
-        return createFromDouble(style->transformOriginZ());
+    case CSSPropertyTransform:
+        return AnimatableTransform::create(style.transform());
+    case CSSPropertyTransformOrigin:
+        return AnimatableLengthPoint3D::create(
+            createFromLength(style.transformOriginX(), style),
+            createFromLength(style.transformOriginY(), style),
+            createFromDouble(style.transformOriginZ()));
     case CSSPropertyWidows:
-        return createFromDouble(style->widows());
+        return createFromDouble(style.widows());
     case CSSPropertyWidth:
-        return createFromLength(style->width(), style);
+        return createFromLength(style.width(), style);
     case CSSPropertyWordSpacing:
-        return createFromDouble(style->wordSpacing());
+        return createFromDouble(style.wordSpacing());
+    case CSSPropertyVerticalAlign:
+        if (style.verticalAlign() == LENGTH)
+            return createFromLength(style.verticalAlignLength(), style);
+        return AnimatableUnknown::create(CSSPrimitiveValue::create(style.verticalAlign()));
     case CSSPropertyVisibility:
-        return AnimatableVisibility::create(style->visibility());
+        return AnimatableVisibility::create(style.visibility());
     case CSSPropertyZIndex:
-        return createFromDouble(style->zIndex());
+        return createFromDouble(style.zIndex());
     case CSSPropertyZoom:
-        return createFromDouble(style->zoom());
+        return createFromDouble(style.zoom());
     default:
-        RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data());
         ASSERT_NOT_REACHED();
-        return 0;
+        // This return value is to avoid a release crash if possible.
+        return AnimatableUnknown::create(nullptr);
     }
 }
 
-} // namespace WebCore
+} // namespace blink