Chromium Code Reviews| Index: Source/core/animation/css/CSSAnimations.cpp |
| diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp |
| index 71fac2a2c7fed27676df7975b90dbab158c0f26e..43f9f7768fc18098640f0829eae26856d53a10ef 100644 |
| --- a/Source/core/animation/css/CSSAnimations.cpp |
| +++ b/Source/core/animation/css/CSSAnimations.cpp |
| @@ -39,6 +39,7 @@ |
| #include "core/animation/ElementAnimations.h" |
| #include "core/animation/Interpolation.h" |
| #include "core/animation/KeyframeEffectModel.h" |
| +#include "core/animation/animatable/AnimatableUnknown.h" |
| #include "core/animation/css/CSSAnimatableValueFactory.h" |
| #include "core/animation/css/CSSPropertyEquality.h" |
| #include "core/css/CSSKeyframeRule.h" |
| @@ -86,6 +87,17 @@ CSSPropertyID propertyForAnimation(CSSPropertyID property) |
| return property; |
| } |
| +static bool isValidValueForAnimation(const CSSPropertyID& property, const AnimatableValue& value) |
|
dstockwell
2015/03/16 21:49:31
I do not think you need to make these changes to C
changseok
2015/03/17 07:12:58
I guess you assume '0' and 'none' should be interp
|
| +{ |
| + switch (property) { |
| + case CSSPropertyFontSizeAdjust: |
| + return !(value.isUnknown() && (toAnimatableUnknown(value).toCSSValueID() == CSSValueNone)); |
| + default: |
| + break; |
| + } |
| + return true; |
| +} |
| + |
| static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframeEffect(StyleResolver* resolver, const Element* animatingElement, Element& element, const LayoutStyle& style, LayoutStyle* parentStyle, |
| const AtomicString& name, TimingFunction* defaultTimingFunction) |
| { |
| @@ -99,6 +111,7 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe |
| // Construct and populate the style for each keyframe |
| PropertySet specifiedPropertiesForUseCounter; |
| + PropertySet invalidValueProperties; |
| for (size_t i = 0; i < styleKeyframes.size(); ++i) { |
| const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get(); |
| RefPtr<LayoutStyle> keyframeStyle = resolver->styleForKeyframe(element, style, parentStyle, styleKeyframe, name); |
| @@ -124,7 +137,9 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe |
| } |
| keyframe->setEasing(timingFunction.release()); |
| } else if (CSSPropertyMetadata::isAnimatableProperty(property)) { |
| - keyframe->setPropertyValue(property, CSSAnimatableValueFactory::create(property, *keyframeStyle).get()); |
| + keyframe->setPropertyValue(property, CSSAnimatableValueFactory::create(property, *keyframeStyle)); |
| + if (!isValidValueForAnimation(property, *keyframe->propertyValue(property))) |
| + invalidValueProperties.add(property); |
| } |
| } |
| keyframes.append(keyframe); |
| @@ -139,6 +154,11 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe |
| blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); |
| } |
| + for (CSSPropertyID property : invalidValueProperties) { |
| + for (const auto& keyframe : keyframes) |
| + keyframe->clearPropertyValue(property); |
| + } |
| + |
| // Merge duplicate keyframes. |
| std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffsets); |
| size_t targetIndex = 0; |