Home | History | Annotate | Download | only in css
      1 /*
      2  * Copyright (C) 2013 Google Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions are
      6  * met:
      7  *
      8  *     * Redistributions of source code must retain the above copyright
      9  * notice, this list of conditions and the following disclaimer.
     10  *     * Redistributions in binary form must reproduce the above
     11  * copyright notice, this list of conditions and the following disclaimer
     12  * in the documentation and/or other materials provided with the
     13  * distribution.
     14  *     * Neither the name of Google Inc. nor the names of its
     15  * contributors may be used to endorse or promote products derived from
     16  * this software without specific prior written permission.
     17  *
     18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #include "config.h"
     32 #include "core/animation/css/CSSAnimatableValueFactory.h"
     33 
     34 #include "core/CSSValueKeywords.h"
     35 #include "core/animation/AnimatableClipPathOperation.h"
     36 #include "core/animation/AnimatableColor.h"
     37 #include "core/animation/AnimatableDouble.h"
     38 #include "core/animation/AnimatableFilterOperations.h"
     39 #include "core/animation/AnimatableImage.h"
     40 #include "core/animation/AnimatableLength.h"
     41 #include "core/animation/AnimatableLengthBox.h"
     42 #include "core/animation/AnimatableLengthBoxAndBool.h"
     43 #include "core/animation/AnimatableLengthPoint.h"
     44 #include "core/animation/AnimatableLengthPoint3D.h"
     45 #include "core/animation/AnimatableLengthSize.h"
     46 #include "core/animation/AnimatableRepeatable.h"
     47 #include "core/animation/AnimatableSVGLength.h"
     48 #include "core/animation/AnimatableSVGPaint.h"
     49 #include "core/animation/AnimatableShadow.h"
     50 #include "core/animation/AnimatableShapeValue.h"
     51 #include "core/animation/AnimatableStrokeDasharrayList.h"
     52 #include "core/animation/AnimatableTransform.h"
     53 #include "core/animation/AnimatableUnknown.h"
     54 #include "core/animation/AnimatableVisibility.h"
     55 #include "core/animation/css/CSSAnimations.h"
     56 #include "core/css/CSSCalculationValue.h"
     57 #include "core/css/CSSPrimitiveValue.h"
     58 #include "core/css/CSSPrimitiveValueMappings.h"
     59 #include "core/rendering/style/RenderStyle.h"
     60 #include "platform/Length.h"
     61 #include "platform/LengthBox.h"
     62 
     63 namespace WebCore {
     64 
     65 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle& style)
     66 {
     67     switch (length.type()) {
     68     case Fixed:
     69     case Percent:
     70     case Calculated:
     71         return AnimatableLength::create(length, style.effectiveZoom());
     72     case Auto:
     73     case Intrinsic:
     74     case MinIntrinsic:
     75     case MinContent:
     76     case MaxContent:
     77     case FillAvailable:
     78     case FitContent:
     79         return AnimatableUnknown::create(CSSPrimitiveValue::create(length, 1));
     80     case Undefined:
     81         return AnimatableUnknown::create(CSSValueNone);
     82     case ExtendToZoom: // Does not apply to elements.
     83     case DeviceWidth:
     84     case DeviceHeight:
     85         ASSERT_NOT_REACHED();
     86         return nullptr;
     87     }
     88     ASSERT_NOT_REACHED();
     89     return nullptr;
     90 }
     91 
     92 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLineHeight(const Length& length, const RenderStyle& style)
     93 {
     94     if (length.type() == Percent) {
     95         double value = length.value();
     96         // -100% is used to represent "normal" line height.
     97         if (value == -100)
     98             return AnimatableUnknown::create(CSSValueNormal);
     99         return AnimatableDouble::create(value);
    100     }
    101     return createFromLength(length, style);
    102 }
    103 
    104 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromDouble(double value, AnimatableDouble::Constraint constraint = AnimatableDouble::Unconstrained)
    105 {
    106     return AnimatableDouble::create(value, constraint);
    107 }
    108 
    109 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle& style)
    110 {
    111     return AnimatableLengthBox::create(
    112         createFromLength(lengthBox.left(), style),
    113         createFromLength(lengthBox.right(), style),
    114         createFromLength(lengthBox.top(), style),
    115         createFromLength(lengthBox.bottom(), style));
    116 }
    117 
    118 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBorderImageLength(const BorderImageLength& borderImageLength, const RenderStyle& style)
    119 {
    120     if (borderImageLength.isNumber())
    121         return createFromDouble(borderImageLength.number());
    122     return createFromLength(borderImageLength.length(), style);
    123 }
    124 
    125 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBorderImageLengthBox(const BorderImageLengthBox& borderImageLengthBox, const RenderStyle& style)
    126 {
    127     return AnimatableLengthBox::create(
    128         createFromBorderImageLength(borderImageLengthBox.left(), style),
    129         createFromBorderImageLength(borderImageLengthBox.right(), style),
    130         createFromBorderImageLength(borderImageLengthBox.top(), style),
    131         createFromBorderImageLength(borderImageLengthBox.bottom(), style));
    132 }
    133 
    134 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthBoxAndBool(const LengthBox lengthBox, const bool flag, const RenderStyle& style)
    135 {
    136     return AnimatableLengthBoxAndBool::create(
    137         createFromLengthBox(lengthBox, style),
    138         flag);
    139 }
    140 
    141 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthPoint(const LengthPoint& lengthPoint, const RenderStyle& style)
    142 {
    143     return AnimatableLengthPoint::create(
    144         createFromLength(lengthPoint.x(), style),
    145         createFromLength(lengthPoint.y(), style));
    146 }
    147 
    148 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromLengthSize(const LengthSize& lengthSize, const RenderStyle& style)
    149 {
    150     return AnimatableLengthSize::create(
    151         createFromLength(lengthSize.width(), style),
    152         createFromLength(lengthSize.height(), style));
    153 }
    154 
    155 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromStyleImage(StyleImage* image)
    156 {
    157     if (image) {
    158         if (RefPtrWillBeRawPtr<CSSValue> cssValue = image->cssValue())
    159             return AnimatableImage::create(cssValue.release());
    160     }
    161     return AnimatableUnknown::create(CSSValueNone);
    162 }
    163 
    164 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFillSize(const FillSize& fillSize, const RenderStyle& style)
    165 {
    166     switch (fillSize.type) {
    167     case SizeLength:
    168         return createFromLengthSize(fillSize.size, style);
    169     case Contain:
    170     case Cover:
    171     case SizeNone:
    172         return AnimatableUnknown::create(CSSPrimitiveValue::create(fillSize.type));
    173     default:
    174         ASSERT_NOT_REACHED();
    175         return nullptr;
    176     }
    177 }
    178 
    179 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromBackgroundPosition(const Length& length, bool originIsSet, BackgroundEdgeOrigin origin, const RenderStyle& style)
    180 {
    181     if (!originIsSet || origin == LeftEdge || origin == TopEdge)
    182         return createFromLength(length, style);
    183     return createFromLength(length.subtractFromOneHundredPercent(), style);
    184 }
    185 
    186 template<CSSPropertyID property>
    187 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFillLayers(const FillLayer* fillLayer, const RenderStyle& style)
    188 {
    189     ASSERT(fillLayer);
    190     WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > values;
    191     while (fillLayer) {
    192         if (property == CSSPropertyBackgroundImage || property == CSSPropertyWebkitMaskImage) {
    193             if (!fillLayer->isImageSet())
    194                 break;
    195             values.append(createFromStyleImage(fillLayer->image()));
    196         } else if (property == CSSPropertyBackgroundPositionX || property == CSSPropertyWebkitMaskPositionX) {
    197             if (!fillLayer->isXPositionSet())
    198                 break;
    199             values.append(createFromBackgroundPosition(fillLayer->xPosition(), fillLayer->isBackgroundXOriginSet(), fillLayer->backgroundXOrigin(), style));
    200         } else if (property == CSSPropertyBackgroundPositionY || property == CSSPropertyWebkitMaskPositionY) {
    201             if (!fillLayer->isYPositionSet())
    202                 break;
    203             values.append(createFromBackgroundPosition(fillLayer->yPosition(), fillLayer->isBackgroundYOriginSet(), fillLayer->backgroundYOrigin(), style));
    204         } else if (property == CSSPropertyBackgroundSize || property == CSSPropertyWebkitMaskSize) {
    205             if (!fillLayer->isSizeSet())
    206                 break;
    207             values.append(createFromFillSize(fillLayer->size(), style));
    208         } else {
    209             ASSERT_NOT_REACHED();
    210         }
    211         fillLayer = fillLayer->next();
    212     }
    213     return AnimatableRepeatable::create(values);
    214 }
    215 
    216 PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle& style)
    217 {
    218     Color color = style.colorIncludingFallback(property, false);
    219     Color visitedLinkColor = style.colorIncludingFallback(property, true);
    220     return AnimatableColor::create(color, visitedLinkColor);
    221 }
    222 
    223 inline static PassRefPtrWillBeRawPtr<AnimatableValue> createFromShapeValue(ShapeValue* value)
    224 {
    225     if (value)
    226         return AnimatableShapeValue::create(value);
    227     return AnimatableUnknown::create(CSSValueNone);
    228 }
    229 
    230 static double fontWeightToDouble(FontWeight fontWeight)
    231 {
    232     switch (fontWeight) {
    233     case FontWeight100:
    234         return 100;
    235     case FontWeight200:
    236         return 200;
    237     case FontWeight300:
    238         return 300;
    239     case FontWeight400:
    240         return 400;
    241     case FontWeight500:
    242         return 500;
    243     case FontWeight600:
    244         return 600;
    245     case FontWeight700:
    246         return 700;
    247     case FontWeight800:
    248         return 800;
    249     case FontWeight900:
    250         return 900;
    251     }
    252 
    253     ASSERT_NOT_REACHED();
    254     return 400;
    255 }
    256 
    257 static PassRefPtrWillBeRawPtr<AnimatableValue> createFromFontWeight(FontWeight fontWeight)
    258 {
    259     return createFromDouble(fontWeightToDouble(fontWeight));
    260 }
    261 
    262 // FIXME: Generate this function.
    263 PassRefPtrWillBeRawPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style)
    264 {
    265     ASSERT(CSSAnimations::isAnimatableProperty(property));
    266     switch (property) {
    267     case CSSPropertyBackgroundColor:
    268         return createFromColor(property, style);
    269     case CSSPropertyBackgroundImage:
    270         return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style);
    271     case CSSPropertyBackgroundPositionX:
    272         return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style);
    273     case CSSPropertyBackgroundPositionY:
    274         return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style);
    275     case CSSPropertyBackgroundSize:
    276     case CSSPropertyWebkitBackgroundSize:
    277         return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style);
    278     case CSSPropertyBaselineShift:
    279         return AnimatableSVGLength::create(style.baselineShiftValue());
    280     case CSSPropertyBorderBottomColor:
    281         return createFromColor(property, style);
    282     case CSSPropertyBorderBottomLeftRadius:
    283         return createFromLengthSize(style.borderBottomLeftRadius(), style);
    284     case CSSPropertyBorderBottomRightRadius:
    285         return createFromLengthSize(style.borderBottomRightRadius(), style);
    286     case CSSPropertyBorderBottomWidth:
    287         return createFromDouble(style.borderBottomWidth());
    288     case CSSPropertyBorderImageOutset:
    289         return createFromBorderImageLengthBox(style.borderImageOutset(), style);
    290     case CSSPropertyBorderImageSlice:
    291         return createFromLengthBox(style.borderImageSlices(), style);
    292     case CSSPropertyBorderImageSource:
    293         return createFromStyleImage(style.borderImageSource());
    294     case CSSPropertyBorderImageWidth:
    295         return createFromBorderImageLengthBox(style.borderImageWidth(), style);
    296     case CSSPropertyBorderLeftColor:
    297         return createFromColor(property, style);
    298     case CSSPropertyBorderLeftWidth:
    299         return createFromDouble(style.borderLeftWidth());
    300     case CSSPropertyBorderRightColor:
    301         return createFromColor(property, style);
    302     case CSSPropertyBorderRightWidth:
    303         return createFromDouble(style.borderRightWidth());
    304     case CSSPropertyBorderTopColor:
    305         return createFromColor(property, style);
    306     case CSSPropertyBorderTopLeftRadius:
    307         return createFromLengthSize(style.borderTopLeftRadius(), style);
    308     case CSSPropertyBorderTopRightRadius:
    309         return createFromLengthSize(style.borderTopRightRadius(), style);
    310     case CSSPropertyBorderTopWidth:
    311         return createFromDouble(style.borderTopWidth());
    312     case CSSPropertyBottom:
    313         return createFromLength(style.bottom(), style);
    314     case CSSPropertyBoxShadow:
    315     case CSSPropertyWebkitBoxShadow:
    316         return AnimatableShadow::create(style.boxShadow());
    317     case CSSPropertyClip:
    318         if (style.hasClip())
    319             return createFromLengthBox(style.clip(), style);
    320         return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto));
    321     case CSSPropertyColor:
    322         return createFromColor(property, style);
    323     case CSSPropertyFillOpacity:
    324         return createFromDouble(style.fillOpacity());
    325     case CSSPropertyFill:
    326         return AnimatableSVGPaint::create(
    327             style.svgStyle()->fillPaintType(), style.svgStyle()->visitedLinkFillPaintType(),
    328             style.svgStyle()->fillPaintColor(), style.svgStyle()->visitedLinkFillPaintColor(),
    329             style.svgStyle()->fillPaintUri(), style.svgStyle()->visitedLinkFillPaintUri());
    330     case CSSPropertyFlexGrow:
    331         return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
    332     case CSSPropertyFlexShrink:
    333         return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
    334     case CSSPropertyFlexBasis:
    335         return createFromLength(style.flexBasis(), style);
    336     case CSSPropertyFloodColor:
    337         return createFromColor(property, style);
    338     case CSSPropertyFloodOpacity:
    339         return createFromDouble(style.floodOpacity());
    340     case CSSPropertyFontSize:
    341         // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
    342         // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
    343         // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
    344         // enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
    345         return createFromDouble(style.specifiedFontSize());
    346     case CSSPropertyFontWeight:
    347         return createFromFontWeight(style.fontWeight());
    348     case CSSPropertyHeight:
    349         return createFromLength(style.height(), style);
    350     case CSSPropertyLightingColor:
    351         return createFromColor(property, style);
    352     case CSSPropertyListStyleImage:
    353         return createFromStyleImage(style.listStyleImage());
    354     case CSSPropertyLeft:
    355         return createFromLength(style.left(), style);
    356     case CSSPropertyLetterSpacing:
    357         return createFromDouble(style.letterSpacing());
    358     case CSSPropertyLineHeight:
    359         return createFromLineHeight(style.specifiedLineHeight(), style);
    360     case CSSPropertyMarginBottom:
    361         return createFromLength(style.marginBottom(), style);
    362     case CSSPropertyMarginLeft:
    363         return createFromLength(style.marginLeft(), style);
    364     case CSSPropertyMarginRight:
    365         return createFromLength(style.marginRight(), style);
    366     case CSSPropertyMarginTop:
    367         return createFromLength(style.marginTop(), style);
    368     case CSSPropertyMaxHeight:
    369         return createFromLength(style.maxHeight(), style);
    370     case CSSPropertyMaxWidth:
    371         return createFromLength(style.maxWidth(), style);
    372     case CSSPropertyMinHeight:
    373         return createFromLength(style.minHeight(), style);
    374     case CSSPropertyMinWidth:
    375         return createFromLength(style.minWidth(), style);
    376     case CSSPropertyObjectPosition:
    377         return createFromLengthPoint(style.objectPosition(), style);
    378     case CSSPropertyOpacity:
    379         return createFromDouble(style.opacity());
    380     case CSSPropertyOrphans:
    381         return createFromDouble(style.orphans());
    382     case CSSPropertyOutlineColor:
    383         return createFromColor(property, style);
    384     case CSSPropertyOutlineOffset:
    385         return createFromDouble(style.outlineOffset());
    386     case CSSPropertyOutlineWidth:
    387         return createFromDouble(style.outlineWidth());
    388     case CSSPropertyPaddingBottom:
    389         return createFromLength(style.paddingBottom(), style);
    390     case CSSPropertyPaddingLeft:
    391         return createFromLength(style.paddingLeft(), style);
    392     case CSSPropertyPaddingRight:
    393         return createFromLength(style.paddingRight(), style);
    394     case CSSPropertyPaddingTop:
    395         return createFromLength(style.paddingTop(), style);
    396     case CSSPropertyRight:
    397         return createFromLength(style.right(), style);
    398     case CSSPropertyStrokeWidth:
    399         return AnimatableSVGLength::create(style.strokeWidth());
    400     case CSSPropertyStopColor:
    401         return createFromColor(property, style);
    402     case CSSPropertyStopOpacity:
    403         return createFromDouble(style.stopOpacity());
    404     case CSSPropertyStrokeDasharray:
    405         return AnimatableStrokeDasharrayList::create(style.strokeDashArray());
    406     case CSSPropertyStrokeDashoffset:
    407         return AnimatableSVGLength::create(style.strokeDashOffset());
    408     case CSSPropertyStrokeMiterlimit:
    409         return createFromDouble(style.strokeMiterLimit());
    410     case CSSPropertyStrokeOpacity:
    411         return createFromDouble(style.strokeOpacity());
    412     case CSSPropertyStroke:
    413         return AnimatableSVGPaint::create(
    414             style.svgStyle()->strokePaintType(), style.svgStyle()->visitedLinkStrokePaintType(),
    415             style.svgStyle()->strokePaintColor(), style.svgStyle()->visitedLinkStrokePaintColor(),
    416             style.svgStyle()->strokePaintUri(), style.svgStyle()->visitedLinkStrokePaintUri());
    417     case CSSPropertyTextDecorationColor:
    418         return AnimatableColor::create(style.textDecorationColor().resolve(style.color()), style.visitedLinkTextDecorationColor().resolve(style.visitedLinkColor()));
    419     case CSSPropertyTextIndent:
    420         return createFromLength(style.textIndent(), style);
    421     case CSSPropertyTextShadow:
    422         return AnimatableShadow::create(style.textShadow());
    423     case CSSPropertyTop:
    424         return createFromLength(style.top(), style);
    425     case CSSPropertyWebkitBorderHorizontalSpacing:
    426         return createFromDouble(style.horizontalBorderSpacing());
    427     case CSSPropertyWebkitBorderVerticalSpacing:
    428         return createFromDouble(style.verticalBorderSpacing());
    429     case CSSPropertyWebkitClipPath:
    430         if (ClipPathOperation* operation = style.clipPath())
    431             return AnimatableClipPathOperation::create(operation);
    432         return AnimatableUnknown::create(CSSValueNone);
    433     case CSSPropertyWebkitColumnCount:
    434         return createFromDouble(style.columnCount());
    435     case CSSPropertyWebkitColumnGap:
    436         return createFromDouble(style.columnGap());
    437     case CSSPropertyWebkitColumnRuleColor:
    438         return createFromColor(property, style);
    439     case CSSPropertyWebkitColumnRuleWidth:
    440         return createFromDouble(style.columnRuleWidth());
    441     case CSSPropertyWebkitColumnWidth:
    442         return createFromDouble(style.columnWidth());
    443     case CSSPropertyWebkitFilter:
    444         return AnimatableFilterOperations::create(style.filter());
    445     case CSSPropertyWebkitMaskBoxImageOutset:
    446         return createFromBorderImageLengthBox(style.maskBoxImageOutset(), style);
    447     case CSSPropertyWebkitMaskBoxImageSlice:
    448         return createFromLengthBoxAndBool(style.maskBoxImageSlices(), style.maskBoxImageSlicesFill(), style);
    449     case CSSPropertyWebkitMaskBoxImageSource:
    450         return createFromStyleImage(style.maskBoxImageSource());
    451     case CSSPropertyWebkitMaskBoxImageWidth:
    452         return createFromBorderImageLengthBox(style.maskBoxImageWidth(), style);
    453     case CSSPropertyWebkitMaskImage:
    454         return createFromFillLayers<CSSPropertyWebkitMaskImage>(style.maskLayers(), style);
    455     case CSSPropertyWebkitMaskPositionX:
    456         return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style.maskLayers(), style);
    457     case CSSPropertyWebkitMaskPositionY:
    458         return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style.maskLayers(), style);
    459     case CSSPropertyWebkitMaskSize:
    460         return createFromFillLayers<CSSPropertyWebkitMaskSize>(style.maskLayers(), style);
    461     case CSSPropertyPerspective:
    462         return createFromDouble(style.perspective());
    463     case CSSPropertyPerspectiveOrigin:
    464         ASSERT(RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    465         return AnimatableLengthPoint::create(
    466             createFromLength(style.perspectiveOriginX(), style),
    467             createFromLength(style.perspectiveOriginY(), style));
    468     case CSSPropertyWebkitPerspectiveOriginX:
    469         ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    470         return createFromLength(style.perspectiveOriginX(), style);
    471     case CSSPropertyWebkitPerspectiveOriginY:
    472         ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    473         return createFromLength(style.perspectiveOriginY(), style);
    474     case CSSPropertyShapeOutside:
    475         return createFromShapeValue(style.shapeOutside());
    476     case CSSPropertyShapeMargin:
    477         return createFromLength(style.shapeMargin(), style);
    478     case CSSPropertyShapeImageThreshold:
    479         return createFromDouble(style.shapeImageThreshold());
    480     case CSSPropertyWebkitTextStrokeColor:
    481         return createFromColor(property, style);
    482     case CSSPropertyTransform:
    483         return AnimatableTransform::create(style.transform());
    484     case CSSPropertyTransformOrigin:
    485         ASSERT(RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    486         return AnimatableLengthPoint3D::create(
    487             createFromLength(style.transformOriginX(), style),
    488             createFromLength(style.transformOriginY(), style),
    489             createFromDouble(style.transformOriginZ()));
    490     case CSSPropertyWebkitTransformOriginX:
    491         ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    492         return createFromLength(style.transformOriginX(), style);
    493     case CSSPropertyWebkitTransformOriginY:
    494         ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    495         return createFromLength(style.transformOriginY(), style);
    496     case CSSPropertyWebkitTransformOriginZ:
    497         ASSERT(!RuntimeEnabledFeatures::cssTransformsUnprefixedEnabled());
    498         return createFromDouble(style.transformOriginZ());
    499     case CSSPropertyWidows:
    500         return createFromDouble(style.widows());
    501     case CSSPropertyWidth:
    502         return createFromLength(style.width(), style);
    503     case CSSPropertyWordSpacing:
    504         return createFromDouble(style.wordSpacing());
    505     case CSSPropertyVerticalAlign:
    506         if (style.verticalAlign() == LENGTH)
    507             return createFromLength(style.verticalAlignLength(), style);
    508         return AnimatableUnknown::create(CSSPrimitiveValue::create(style.verticalAlign()));
    509     case CSSPropertyVisibility:
    510         return AnimatableVisibility::create(style.visibility());
    511     case CSSPropertyZIndex:
    512         return createFromDouble(style.zIndex());
    513     case CSSPropertyZoom:
    514         return createFromDouble(style.zoom());
    515     default:
    516         ASSERT_NOT_REACHED();
    517         // This return value is to avoid a release crash if possible.
    518         return AnimatableUnknown::create(nullptr);
    519     }
    520 }
    521 
    522 } // namespace WebCore
    523