2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
32 #include "core/css/resolver/AnimatedStyleBuilder.h"
34 #include "core/animation/animatable/AnimatableClipPathOperation.h"
35 #include "core/animation/animatable/AnimatableColor.h"
36 #include "core/animation/animatable/AnimatableDouble.h"
37 #include "core/animation/animatable/AnimatableFilterOperations.h"
38 #include "core/animation/animatable/AnimatableImage.h"
39 #include "core/animation/animatable/AnimatableLength.h"
40 #include "core/animation/animatable/AnimatableLengthBox.h"
41 #include "core/animation/animatable/AnimatableLengthBoxAndBool.h"
42 #include "core/animation/animatable/AnimatableLengthPoint.h"
43 #include "core/animation/animatable/AnimatableLengthPoint3D.h"
44 #include "core/animation/animatable/AnimatableLengthSize.h"
45 #include "core/animation/animatable/AnimatableRepeatable.h"
46 #include "core/animation/animatable/AnimatableSVGLength.h"
47 #include "core/animation/animatable/AnimatableSVGPaint.h"
48 #include "core/animation/animatable/AnimatableShadow.h"
49 #include "core/animation/animatable/AnimatableShapeValue.h"
50 #include "core/animation/animatable/AnimatableStrokeDasharrayList.h"
51 #include "core/animation/animatable/AnimatableTransform.h"
52 #include "core/animation/animatable/AnimatableUnknown.h"
53 #include "core/animation/animatable/AnimatableValue.h"
54 #include "core/animation/animatable/AnimatableVisibility.h"
55 #include "core/css/CSSPrimitiveValueMappings.h"
56 #include "core/css/CSSPropertyMetadata.h"
57 #include "core/css/resolver/StyleBuilder.h"
58 #include "core/css/resolver/StyleResolverState.h"
59 #include "core/rendering/style/RenderStyle.h"
60 #include "wtf/MathExtras.h"
61 #include "wtf/TypeTraits.h"
67 Length animatableValueToLength(const AnimatableValue* value, const StyleResolverState& state, ValueRange range = ValueRangeAll)
69 if (value->isLength())
70 return toAnimatableLength(value)->length(state.style()->effectiveZoom(), range);
71 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
72 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
73 return cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData());
76 BorderImageLength animatableValueToBorderImageLength(const AnimatableValue* value, const StyleResolverState& state)
78 if (value->isLength())
79 return BorderImageLength(toAnimatableLength(value)->length(state.style()->effectiveZoom(), ValueRangeNonNegative));
80 if (value->isDouble())
81 return BorderImageLength(clampTo<double>(toAnimatableDouble(value)->toDouble(), 0));
82 RefPtrWillBeRawPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
83 CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
84 return BorderImageLength(cssPrimitiveValue->convertToLength<AnyConversion>(state.cssToLengthConversionData()));
87 template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
89 COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingValues);
90 return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max);
93 LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleResolverState& state, ValueRange range = ValueRangeAll)
95 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value);
97 animatableValueToLength(animatableLengthBox->top(), state, range),
98 animatableValueToLength(animatableLengthBox->right(), state, range),
99 animatableValueToLength(animatableLengthBox->bottom(), state, range),
100 animatableValueToLength(animatableLengthBox->left(), state, range));
103 BorderImageLengthBox animatableValueToBorderImageLengthBox(const AnimatableValue* value, const StyleResolverState& state)
105 const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value);
106 return BorderImageLengthBox(
107 animatableValueToBorderImageLength(animatableLengthBox->top(), state),
108 animatableValueToBorderImageLength(animatableLengthBox->right(), state),
109 animatableValueToBorderImageLength(animatableLengthBox->bottom(), state),
110 animatableValueToBorderImageLength(animatableLengthBox->left(), state));
113 LengthPoint animatableValueToLengthPoint(const AnimatableValue* value, const StyleResolverState& state, ValueRange range = ValueRangeAll)
115 const AnimatableLengthPoint* animatableLengthPoint = toAnimatableLengthPoint(value);
117 animatableValueToLength(animatableLengthPoint->x(), state, range),
118 animatableValueToLength(animatableLengthPoint->y(), state, range));
121 TransformOrigin animatableValueToTransformOrigin(const AnimatableValue* value, const StyleResolverState& state, ValueRange range = ValueRangeAll)
123 const AnimatableLengthPoint3D* animatableLengthPoint3D = toAnimatableLengthPoint3D(value);
124 return TransformOrigin(
125 animatableValueToLength(animatableLengthPoint3D->x(), state),
126 animatableValueToLength(animatableLengthPoint3D->y(), state),
127 clampTo<float>(toAnimatableDouble(animatableLengthPoint3D->z())->toDouble())
131 LengthSize animatableValueToLengthSize(const AnimatableValue* value, const StyleResolverState& state, ValueRange range)
133 const AnimatableLengthSize* animatableLengthSize = toAnimatableLengthSize(value);
135 animatableValueToLength(animatableLengthSize->width(), state, range),
136 animatableValueToLength(animatableLengthSize->height(), state, range));
139 void setFillSize(FillLayer* fillLayer, const AnimatableValue* value, const StyleResolverState& state)
141 if (value->isLengthSize())
142 fillLayer->setSize(FillSize(SizeLength, animatableValueToLengthSize(value, state, ValueRangeNonNegative)));
144 state.styleMap().mapFillSize(fillLayer, toAnimatableUnknown(value)->toCSSValue().get());
147 PassRefPtr<SVGLength> animatableValueToNonNegativeSVGLength(const AnimatableValue* value)
149 RefPtr<SVGLength> length = toAnimatableSVGLength(value)->toSVGLength();
150 if (length->valueInSpecifiedUnits() < 0)
151 length->setValueInSpecifiedUnits(0);
152 return length.release();
155 template <CSSPropertyID property>
156 void setOnFillLayers(FillLayer& fillLayers, const AnimatableValue* value, StyleResolverState& state)
158 const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >& values = toAnimatableRepeatable(value)->values();
159 ASSERT(!values.isEmpty());
160 FillLayer* fillLayer = &fillLayers;
162 for (size_t i = 0; i < values.size(); ++i) {
164 fillLayer = prev->ensureNext();
165 const AnimatableValue* layerValue = values[i].get();
167 case CSSPropertyBackgroundImage:
168 case CSSPropertyWebkitMaskImage:
169 if (layerValue->isImage()) {
170 fillLayer->setImage(state.styleImage(property, toAnimatableImage(layerValue)->toCSSValue()));
172 ASSERT(toAnimatableUnknown(layerValue)->toCSSValueID() == CSSValueNone);
173 fillLayer->setImage(nullptr);
176 case CSSPropertyBackgroundPositionX:
177 case CSSPropertyWebkitMaskPositionX:
178 fillLayer->setXPosition(animatableValueToLength(layerValue, state));
180 case CSSPropertyBackgroundPositionY:
181 case CSSPropertyWebkitMaskPositionY:
182 fillLayer->setYPosition(animatableValueToLength(layerValue, state));
184 case CSSPropertyBackgroundSize:
185 case CSSPropertyWebkitBackgroundSize:
186 case CSSPropertyWebkitMaskSize:
187 setFillSize(fillLayer, layerValue, state);
190 ASSERT_NOT_REACHED();
193 fillLayer = fillLayer->next();
197 case CSSPropertyBackgroundImage:
198 case CSSPropertyWebkitMaskImage:
199 fillLayer->clearImage();
201 case CSSPropertyBackgroundPositionX:
202 case CSSPropertyWebkitMaskPositionX:
203 fillLayer->clearXPosition();
205 case CSSPropertyBackgroundPositionY:
206 case CSSPropertyWebkitMaskPositionY:
207 fillLayer->clearYPosition();
209 case CSSPropertyBackgroundSize:
210 case CSSPropertyWebkitBackgroundSize:
211 case CSSPropertyWebkitMaskSize:
212 fillLayer->clearSize();
215 ASSERT_NOT_REACHED();
217 fillLayer = fillLayer->next();
221 FontStretch animatableValueToFontStretch(const AnimatableValue* value)
223 ASSERT(FontStretchUltraCondensed == 1 && FontStretchUltraExpanded == 9);
224 unsigned index = round(toAnimatableDouble(value)->toDouble()) - 1;
225 static const FontStretch stretchValues[] = {
226 FontStretchUltraCondensed,
227 FontStretchExtraCondensed,
228 FontStretchCondensed,
229 FontStretchSemiCondensed,
231 FontStretchSemiExpanded,
233 FontStretchExtraExpanded,
234 FontStretchUltraExpanded
237 index = clampTo<unsigned>(index, 0, WTF_ARRAY_LENGTH(stretchValues) - 1);
238 return stretchValues[index];
241 FontWeight animatableValueToFontWeight(const AnimatableValue* value)
243 int index = round(toAnimatableDouble(value)->toDouble() / 100) - 1;
245 static const FontWeight weights[] = {
257 index = clampTo<int>(index, 0, WTF_ARRAY_LENGTH(weights) - 1);
259 return weights[index];
264 // FIXME: Generate this function.
265 void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverState& state, const AnimatableValue* value)
267 ASSERT(CSSPropertyMetadata::isAnimatableProperty(property));
268 if (value->isUnknown()) {
269 StyleBuilder::applyProperty(property, state, toAnimatableUnknown(value)->toCSSValue().get());
272 RenderStyle* style = state.style();
274 case CSSPropertyBackgroundColor:
275 style->setBackgroundColor(toAnimatableColor(value)->color());
276 style->setVisitedLinkBackgroundColor(toAnimatableColor(value)->visitedLinkColor());
278 case CSSPropertyBackgroundImage:
279 setOnFillLayers<CSSPropertyBackgroundImage>(style->accessBackgroundLayers(), value, state);
281 case CSSPropertyBackgroundPositionX:
282 setOnFillLayers<CSSPropertyBackgroundPositionX>(style->accessBackgroundLayers(), value, state);
284 case CSSPropertyBackgroundPositionY:
285 setOnFillLayers<CSSPropertyBackgroundPositionY>(style->accessBackgroundLayers(), value, state);
287 case CSSPropertyBackgroundSize:
288 setOnFillLayers<CSSPropertyBackgroundSize>(style->accessBackgroundLayers(), value, state);
290 case CSSPropertyBaselineShift:
291 style->setBaselineShiftValue(toAnimatableSVGLength(value)->toSVGLength());
293 case CSSPropertyBorderBottomColor:
294 style->setBorderBottomColor(toAnimatableColor(value)->color());
295 style->setVisitedLinkBorderBottomColor(toAnimatableColor(value)->visitedLinkColor());
297 case CSSPropertyBorderBottomLeftRadius:
298 style->setBorderBottomLeftRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
300 case CSSPropertyBorderBottomRightRadius:
301 style->setBorderBottomRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
303 case CSSPropertyBorderBottomWidth:
304 style->setBorderBottomWidth(animatableValueRoundClampTo<unsigned>(value));
306 case CSSPropertyBorderImageOutset:
307 style->setBorderImageOutset(animatableValueToBorderImageLengthBox(value, state));
309 case CSSPropertyBorderImageSlice:
310 style->setBorderImageSlices(animatableValueToLengthBox(value, state, ValueRangeNonNegative));
312 case CSSPropertyBorderImageSource:
313 style->setBorderImageSource(state.styleImage(property, toAnimatableImage(value)->toCSSValue()));
315 case CSSPropertyBorderImageWidth:
316 style->setBorderImageWidth(animatableValueToBorderImageLengthBox(value, state));
318 case CSSPropertyBorderLeftColor:
319 style->setBorderLeftColor(toAnimatableColor(value)->color());
320 style->setVisitedLinkBorderLeftColor(toAnimatableColor(value)->visitedLinkColor());
322 case CSSPropertyBorderLeftWidth:
323 style->setBorderLeftWidth(animatableValueRoundClampTo<unsigned>(value));
325 case CSSPropertyBorderRightColor:
326 style->setBorderRightColor(toAnimatableColor(value)->color());
327 style->setVisitedLinkBorderRightColor(toAnimatableColor(value)->visitedLinkColor());
329 case CSSPropertyBorderRightWidth:
330 style->setBorderRightWidth(animatableValueRoundClampTo<unsigned>(value));
332 case CSSPropertyBorderTopColor:
333 style->setBorderTopColor(toAnimatableColor(value)->color());
334 style->setVisitedLinkBorderTopColor(toAnimatableColor(value)->visitedLinkColor());
336 case CSSPropertyBorderTopLeftRadius:
337 style->setBorderTopLeftRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
339 case CSSPropertyBorderTopRightRadius:
340 style->setBorderTopRightRadius(animatableValueToLengthSize(value, state, ValueRangeNonNegative));
342 case CSSPropertyBorderTopWidth:
343 style->setBorderTopWidth(animatableValueRoundClampTo<unsigned>(value));
345 case CSSPropertyBottom:
346 style->setBottom(animatableValueToLength(value, state));
348 case CSSPropertyBoxShadow:
349 case CSSPropertyWebkitBoxShadow:
350 style->setBoxShadow(toAnimatableShadow(value)->shadowList());
352 case CSSPropertyClip:
353 style->setClip(animatableValueToLengthBox(value, state));
355 case CSSPropertyColor:
356 style->setColor(toAnimatableColor(value)->color());
357 style->setVisitedLinkColor(toAnimatableColor(value)->visitedLinkColor());
359 case CSSPropertyFillOpacity:
360 style->setFillOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
362 case CSSPropertyFill:
364 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
365 style->accessSVGStyle().setFillPaint(svgPaint->paintType(), svgPaint->color(), svgPaint->uri(), true, false);
366 style->accessSVGStyle().setFillPaint(svgPaint->visitedLinkPaintType(), svgPaint->visitedLinkColor(), svgPaint->visitedLinkURI(), false, true);
369 case CSSPropertyFlexGrow:
370 style->setFlexGrow(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
372 case CSSPropertyFlexShrink:
373 style->setFlexShrink(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
375 case CSSPropertyFlexBasis:
376 style->setFlexBasis(animatableValueToLength(value, state, ValueRangeNonNegative));
378 case CSSPropertyFloodColor:
379 style->setFloodColor(toAnimatableColor(value)->color());
381 case CSSPropertyFloodOpacity:
382 style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
384 case CSSPropertyFontSize:
385 style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
387 case CSSPropertyFontStretch:
388 style->setFontStretch(animatableValueToFontStretch(value));
390 case CSSPropertyFontWeight:
391 style->setFontWeight(animatableValueToFontWeight(value));
393 case CSSPropertyHeight:
394 style->setHeight(animatableValueToLength(value, state, ValueRangeNonNegative));
396 case CSSPropertyLeft:
397 style->setLeft(animatableValueToLength(value, state));
399 case CSSPropertyLightingColor:
400 style->setLightingColor(toAnimatableColor(value)->color());
402 case CSSPropertyLineHeight:
403 if (value->isLength())
404 style->setLineHeight(animatableValueToLength(value, state, ValueRangeNonNegative));
406 style->setLineHeight(Length(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0), Percent));
408 case CSSPropertyListStyleImage:
409 style->setListStyleImage(state.styleImage(property, toAnimatableImage(value)->toCSSValue()));
411 case CSSPropertyLetterSpacing:
412 style->setLetterSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble()));
414 case CSSPropertyMarginBottom:
415 style->setMarginBottom(animatableValueToLength(value, state));
417 case CSSPropertyMarginLeft:
418 style->setMarginLeft(animatableValueToLength(value, state));
420 case CSSPropertyMarginRight:
421 style->setMarginRight(animatableValueToLength(value, state));
423 case CSSPropertyMarginTop:
424 style->setMarginTop(animatableValueToLength(value, state));
426 case CSSPropertyMaxHeight:
427 style->setMaxHeight(animatableValueToLength(value, state, ValueRangeNonNegative));
429 case CSSPropertyMaxWidth:
430 style->setMaxWidth(animatableValueToLength(value, state, ValueRangeNonNegative));
432 case CSSPropertyMinHeight:
433 style->setMinHeight(animatableValueToLength(value, state, ValueRangeNonNegative));
435 case CSSPropertyMinWidth:
436 style->setMinWidth(animatableValueToLength(value, state, ValueRangeNonNegative));
438 case CSSPropertyObjectPosition:
439 style->setObjectPosition(animatableValueToLengthPoint(value, state));
441 case CSSPropertyOpacity:
442 // Avoiding a value of 1 forces a layer to be created.
443 style->setOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, nextafterf(1, 0)));
445 case CSSPropertyOrphans:
446 style->setOrphans(animatableValueRoundClampTo<unsigned short>(value, 1));
448 case CSSPropertyOutlineColor:
449 style->setOutlineColor(toAnimatableColor(value)->color());
450 style->setVisitedLinkOutlineColor(toAnimatableColor(value)->visitedLinkColor());
452 case CSSPropertyOutlineOffset:
453 style->setOutlineOffset(animatableValueRoundClampTo<int>(value));
455 case CSSPropertyOutlineWidth:
456 style->setOutlineWidth(animatableValueRoundClampTo<unsigned short>(value));
458 case CSSPropertyPaddingBottom:
459 style->setPaddingBottom(animatableValueToLength(value, state, ValueRangeNonNegative));
461 case CSSPropertyPaddingLeft:
462 style->setPaddingLeft(animatableValueToLength(value, state, ValueRangeNonNegative));
464 case CSSPropertyPaddingRight:
465 style->setPaddingRight(animatableValueToLength(value, state, ValueRangeNonNegative));
467 case CSSPropertyPaddingTop:
468 style->setPaddingTop(animatableValueToLength(value, state, ValueRangeNonNegative));
470 case CSSPropertyRight:
471 style->setRight(animatableValueToLength(value, state));
473 case CSSPropertyStrokeWidth:
474 style->setStrokeWidth(animatableValueToNonNegativeSVGLength(value));
476 case CSSPropertyStopColor:
477 style->setStopColor(toAnimatableColor(value)->color());
479 case CSSPropertyStopOpacity:
480 style->setStopOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
482 case CSSPropertyStrokeDasharray:
483 style->setStrokeDashArray(toAnimatableStrokeDasharrayList(value)->toSVGLengthList());
485 case CSSPropertyStrokeDashoffset:
486 style->setStrokeDashOffset(toAnimatableSVGLength(value)->toSVGLength());
488 case CSSPropertyStrokeMiterlimit:
489 style->setStrokeMiterLimit(clampTo<float>(toAnimatableDouble(value)->toDouble(), 1));
491 case CSSPropertyStrokeOpacity:
492 style->setStrokeOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
494 case CSSPropertyStroke:
496 const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
497 style->accessSVGStyle().setStrokePaint(svgPaint->paintType(), svgPaint->color(), svgPaint->uri(), true, false);
498 style->accessSVGStyle().setStrokePaint(svgPaint->visitedLinkPaintType(), svgPaint->visitedLinkColor(), svgPaint->visitedLinkURI(), false, true);
501 case CSSPropertyTextDecorationColor:
502 style->setTextDecorationColor(toAnimatableColor(value)->color());
503 style->setVisitedLinkTextDecorationColor(toAnimatableColor(value)->visitedLinkColor());
505 case CSSPropertyTextIndent:
506 style->setTextIndent(animatableValueToLength(value, state));
508 case CSSPropertyTextShadow:
509 style->setTextShadow(toAnimatableShadow(value)->shadowList());
512 style->setTop(animatableValueToLength(value, state));
514 case CSSPropertyWebkitBackgroundSize:
515 setOnFillLayers<CSSPropertyWebkitBackgroundSize>(style->accessBackgroundLayers(), value, state);
517 case CSSPropertyWebkitBorderHorizontalSpacing:
518 style->setHorizontalBorderSpacing(animatableValueRoundClampTo<unsigned short>(value));
520 case CSSPropertyWebkitBorderVerticalSpacing:
521 style->setVerticalBorderSpacing(animatableValueRoundClampTo<unsigned short>(value));
523 case CSSPropertyWebkitClipPath:
524 style->setClipPath(toAnimatableClipPathOperation(value)->clipPathOperation());
526 case CSSPropertyWebkitColumnCount:
527 style->setColumnCount(animatableValueRoundClampTo<unsigned short>(value, 1));
529 case CSSPropertyWebkitColumnGap:
530 style->setColumnGap(clampTo(toAnimatableDouble(value)->toDouble(), 0));
532 case CSSPropertyWebkitColumnRuleColor:
533 style->setColumnRuleColor(toAnimatableColor(value)->color());
534 style->setVisitedLinkColumnRuleColor(toAnimatableColor(value)->visitedLinkColor());
536 case CSSPropertyWebkitColumnWidth:
537 style->setColumnWidth(clampTo(toAnimatableDouble(value)->toDouble(), std::numeric_limits<float>::epsilon()));
539 case CSSPropertyWebkitColumnRuleWidth:
540 style->setColumnRuleWidth(animatableValueRoundClampTo<unsigned short>(value));
542 case CSSPropertyWebkitFilter:
543 style->setFilter(toAnimatableFilterOperations(value)->operations());
545 case CSSPropertyWebkitMaskBoxImageOutset:
546 style->setMaskBoxImageOutset(animatableValueToBorderImageLengthBox(value, state));
548 case CSSPropertyWebkitMaskBoxImageSlice:
549 style->setMaskBoxImageSlices(animatableValueToLengthBox(toAnimatableLengthBoxAndBool(value)->box(), state, ValueRangeNonNegative));
550 style->setMaskBoxImageSlicesFill(toAnimatableLengthBoxAndBool(value)->flag());
552 case CSSPropertyWebkitMaskBoxImageSource:
553 style->setMaskBoxImageSource(state.styleImage(property, toAnimatableImage(value)->toCSSValue()));
555 case CSSPropertyWebkitMaskBoxImageWidth:
556 style->setMaskBoxImageWidth(animatableValueToBorderImageLengthBox(value, state));
558 case CSSPropertyWebkitMaskImage:
559 setOnFillLayers<CSSPropertyWebkitMaskImage>(style->accessMaskLayers(), value, state);
561 case CSSPropertyWebkitMaskPositionX:
562 setOnFillLayers<CSSPropertyWebkitMaskPositionX>(style->accessMaskLayers(), value, state);
564 case CSSPropertyWebkitMaskPositionY:
565 setOnFillLayers<CSSPropertyWebkitMaskPositionY>(style->accessMaskLayers(), value, state);
567 case CSSPropertyWebkitMaskSize:
568 setOnFillLayers<CSSPropertyWebkitMaskSize>(style->accessMaskLayers(), value, state);
570 case CSSPropertyPerspective:
571 style->setPerspective(clampTo<float>(toAnimatableDouble(value)->toDouble()));
573 case CSSPropertyPerspectiveOrigin:
574 style->setPerspectiveOrigin(animatableValueToLengthPoint(value, state));
576 case CSSPropertyShapeOutside:
577 style->setShapeOutside(toAnimatableShapeValue(value)->shapeValue());
579 case CSSPropertyShapeMargin:
580 style->setShapeMargin(animatableValueToLength(value, state, ValueRangeNonNegative));
582 case CSSPropertyShapeImageThreshold:
583 style->setShapeImageThreshold(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
585 case CSSPropertyWebkitTextStrokeColor:
586 style->setTextStrokeColor(toAnimatableColor(value)->color());
587 style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLinkColor());
589 case CSSPropertyTransform: {
590 const TransformOperations& operations = toAnimatableTransform(value)->transformOperations();
591 // FIXME: This normalization (handling of 'none') should be performed at input in AnimatableValueFactory.
592 style->setTransform(operations.size() ? operations : TransformOperations(true));
595 case CSSPropertyTransformOrigin:
596 style->setTransformOrigin(animatableValueToTransformOrigin(value, state));
598 case CSSPropertyWidows:
599 style->setWidows(animatableValueRoundClampTo<unsigned short>(value, 1));
601 case CSSPropertyWidth:
602 style->setWidth(animatableValueToLength(value, state, ValueRangeNonNegative));
604 case CSSPropertyWordSpacing:
605 style->setWordSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble()));
607 case CSSPropertyVerticalAlign:
608 style->setVerticalAlignLength(animatableValueToLength(value, state));
610 case CSSPropertyVisibility:
611 style->setVisibility(toAnimatableVisibility(value)->visibility());
613 case CSSPropertyZIndex:
614 style->setZIndex(animatableValueRoundClampTo<int>(value));
616 case CSSPropertyZoom:
617 style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std::numeric_limits<float>::denorm_min()));
620 ASSERT_NOT_REACHED();