Chromium Code Reviews| Index: Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| diff --git a/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| index bbdfc5948b791dea55cbd99827076188abffb4e0..665f2cf639b8475d8f6cab918c10b21e7a66e3f9 100644 |
| --- a/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| +++ b/Source/core/css/resolver/AnimatedStyleBuilder.cpp |
| @@ -31,10 +31,13 @@ |
| #include "config.h" |
| #include "core/css/resolver/AnimatedStyleBuilder.h" |
| +#include "core/animation/AnimatableImage.h" |
| +#include "core/animation/AnimatableLengthBox.h" |
| #include "core/animation/AnimatableNumber.h" |
| #include "core/animation/AnimatableTransform.h" |
| #include "core/animation/AnimatableUnknown.h" |
| #include "core/animation/AnimatableValue.h" |
| +#include "core/animation/css/CSSAnimations.h" |
| #include "core/css/resolver/StyleBuilder.h" |
| #include "core/css/resolver/StyleResolverState.h" |
| #include "core/rendering/style/RenderStyle.h" |
| @@ -55,10 +58,17 @@ unsigned animatableValueToUnsigned(const AnimatableValue* value) |
| return clampTo<unsigned>(round(toAnimatableNumber(value)->toDouble())); |
| } |
| -} // namespace |
| +LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleResolverState& state) |
| +{ |
| + const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value); |
| + return LengthBox( |
| + animatableValueToLength(animatableLengthBox->left(), state), |
| + animatableValueToLength(animatableLengthBox->right(), state), |
| + animatableValueToLength(animatableLengthBox->top(), state), |
| + animatableValueToLength(animatableLengthBox->bottom(), state)); |
|
alancutter (OOO until 2018)
2013/08/27 02:37:45
This will fail when any of these values are 'auto'
Timothy Loh
2013/08/27 04:26:06
I think the logic for creating a LengthBox should
dstockwell
2013/08/27 05:02:02
I've updated animatableValueToLength for now.
|
| +} |
| -// FIXME: This should handle all animatable properties |
| -// (see CSSAnimatableValueFactory for list of remaining) |
| +} // namespace |
| // FIXME: Generate this function. |
| void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverState& state, const AnimatableValue* value) |
| @@ -72,6 +82,18 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| case CSSPropertyBorderBottomWidth: |
| style->setBorderBottomWidth(animatableValueToUnsigned(value)); |
| return; |
| + case CSSPropertyBorderImageOutset: |
| + style->setBorderImageOutset(animatableValueToLengthBox(value, state)); |
| + return; |
| + case CSSPropertyBorderImageSlice: |
| + style->setBorderImageSlices(animatableValueToLengthBox(value, state)); |
| + return; |
| + case CSSPropertyBorderImageSource: |
| + style->setBorderImageSource(toAnimatableImage(value)->toStyleImage()); |
| + return; |
| + case CSSPropertyBorderImageWidth: |
| + style->setBorderImageWidth(animatableValueToLengthBox(value, state)); |
| + return; |
| case CSSPropertyBorderLeftWidth: |
| style->setBorderLeftWidth(animatableValueToUnsigned(value)); |
| return; |
| @@ -84,9 +106,15 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| case CSSPropertyBottom: |
| style->setBottom(animatableValueToLength(value, state)); |
| return; |
| + case CSSPropertyClip: |
| + style->setClip(animatableValueToLengthBox(value, state)); |
| + return; |
| case CSSPropertyHeight: |
| style->setHeight(animatableValueToLength(value, state)); |
| return; |
| + case CSSPropertyListStyleImage: |
| + style->setListStyleImage(toAnimatableImage(value)->toStyleImage()); |
| + return; |
| case CSSPropertyLeft: |
| style->setLeft(animatableValueToLength(value, state)); |
| return; |
| @@ -135,6 +163,12 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| case CSSPropertyTop: |
| style->setTop(animatableValueToLength(value, state)); |
| return; |
| + case CSSPropertyWebkitMaskBoxImageSource: |
| + style->setMaskBoxImageSource(toAnimatableImage(value)->toStyleImage()); |
| + return; |
| + case CSSPropertyWebkitMaskImage: |
| + style->setMaskImage(toAnimatableImage(value)->toStyleImage()); |
| + return; |
| case CSSPropertyWebkitPerspectiveOriginX: |
| style->setPerspectiveOriginX(animatableValueToLength(value, state)); |
| return; |
| @@ -154,8 +188,8 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt |
| style->setWidth(animatableValueToLength(value, state)); |
| return; |
| default: |
| - RELEASE_ASSERT_WITH_MESSAGE(false, "Unable to apply AnimatableValue to RenderStyle, not yet implemented!"); |
| - return; |
| + RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Unable to apply AnimatableValue to RenderStyle, not yet implemented: %s", getPropertyNameString(property).utf8().data()); |
| + ASSERT_NOT_REACHED(); |
| } |
| } |