| Index: Source/core/animation/StringKeyframe.cpp
|
| diff --git a/Source/core/animation/StringKeyframe.cpp b/Source/core/animation/StringKeyframe.cpp
|
| index 8c84b34e7c717eba42ad70eba4091bdec7486d10..db56d6314be26151a03088ec6836f78d9454bd74 100644
|
| --- a/Source/core/animation/StringKeyframe.cpp
|
| +++ b/Source/core/animation/StringKeyframe.cpp
|
| @@ -183,6 +183,22 @@ const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID
|
|
|
| } // namespace
|
|
|
| +PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::createLegacyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const
|
| +{
|
| + CSSValue& fromCSSValue = *m_value.get();
|
| + CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value();
|
| + if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(toCSSValue)) {
|
| + // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation.
|
| + return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSValue, property);
|
| + }
|
| +
|
| + // FIXME: Remove the use of AnimatableValues and Elements here.
|
| + ASSERT(element);
|
| + populateAnimatableValue(property, *element, baseStyle);
|
| + end.populateAnimatableValue(property, *element, baseStyle);
|
| + return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimatableValue(), property);
|
| +}
|
| +
|
| PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const
|
| {
|
| CSSPropertyID property = propertyHandle.cssProperty();
|
| @@ -196,7 +212,6 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| CSSValue* fromCSSValue = m_value.get();
|
| CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value();
|
| InterpolationRange range = RangeAll;
|
| - bool fallBackToLegacy = false;
|
|
|
| // FIXME: Remove this flag once we can rely on legacy's behaviour being correct.
|
| bool forceDefaultInterpolation = false;
|
| @@ -214,6 +229,9 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| return nullptr;
|
| }
|
|
|
| + if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword())
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| +
|
| switch (property) {
|
| case CSSPropertyLineHeight:
|
| if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInterpolation::canCreateFrom(*toCSSValue))
|
| @@ -282,11 +300,11 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
|
|
| // FIXME: Handle keywords e.g. 'smaller', 'larger'.
|
| if (property == CSSPropertyFontSize)
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
|
|
| // FIXME: Handle keywords e.g. 'baseline', 'sub'.
|
| if (property == CSSPropertyBaselineShift)
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
|
|
| break;
|
| case CSSPropertyOrphans:
|
| @@ -339,7 +357,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
|
|
| // Current color should use LegacyStyleInterpolation
|
| if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*fromCSSValue, *toCSSValue))
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
|
|
| break;
|
| }
|
| @@ -373,9 +391,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| return interpolation.release();
|
|
|
| // FIXME: Handle keywords: top, right, left, center, bottom
|
| - fallBackToLegacy = true;
|
| -
|
| - break;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| }
|
|
|
| case CSSPropertyBoxShadow:
|
| @@ -391,10 +407,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| }
|
|
|
| // FIXME: Handle interpolation from/to none, unspecified color values
|
| - fallBackToLegacy = true;
|
| -
|
| - break;
|
| -
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| }
|
|
|
| case CSSPropertyClip: {
|
| @@ -433,7 +446,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| return interpolation.release();
|
|
|
| // FIXME: Support drop shadow interpolation.
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| break;
|
| }
|
|
|
| @@ -443,7 +456,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| return interpolation.release();
|
|
|
| // TODO(soonm): Legacy mode is used when from and to cssvaluelist length does not match.
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| break;
|
| }
|
|
|
| @@ -453,42 +466,25 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
|
| return interpolation.release();
|
|
|
| // TODO(soonm): Legacy mode is used when from and to cssvaluelist length does not match.
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| break;
|
| }
|
|
|
| default:
|
| // Fall back to LegacyStyleInterpolation.
|
| - fallBackToLegacy = true;
|
| + return createLegacyStyleInterpolation(property, end, element, baseStyle);
|
| break;
|
| }
|
|
|
| if (fromCSSValue == toCSSValue)
|
| return ConstantStyleInterpolation::create(fromCSSValue, property);
|
|
|
| - if (forceDefaultInterpolation)
|
| - return nullptr;
|
| -
|
| - if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword())
|
| - fallBackToLegacy = true;
|
| -
|
| - if (fallBackToLegacy) {
|
| - if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*toCSSValue)) {
|
| - // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation.
|
| - return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue, property);
|
| - }
|
| -
|
| - // FIXME: Remove the use of AnimatableValues and Elements here.
|
| - ASSERT(element);
|
| - populateAnimatableValue(property, *element, baseStyle);
|
| - end.populateAnimatableValue(property, *element, baseStyle);
|
| - return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimatableValue(), property);
|
| + if (!forceDefaultInterpolation) {
|
| + ASSERT(AnimatableValue::usesDefaultInterpolation(
|
| + StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, property, fromCSSValue).get(),
|
| + StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, property, toCSSValue).get()));
|
| }
|
|
|
| - ASSERT(AnimatableValue::usesDefaultInterpolation(
|
| - StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, property, fromCSSValue).get(),
|
| - StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, property, toCSSValue).get()));
|
| -
|
| return nullptr;
|
|
|
| }
|
|
|