Chromium Code Reviews| Index: Source/core/animation/StringKeyframe.cpp |
| diff --git a/Source/core/animation/StringKeyframe.cpp b/Source/core/animation/StringKeyframe.cpp |
| index 90b68cb8b2e85261872802d33c35f5fb5f89f01a..33e8b265b0f81e2a63dafccedde013dab39f8b1a 100644 |
| --- a/Source/core/animation/StringKeyframe.cpp |
| +++ b/Source/core/animation/StringKeyframe.cpp |
| @@ -78,6 +78,7 @@ StringKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset |
| PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe::maybeCreateInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe& end, Element* element) const |
| { |
| CSSValue* fromCSSValue = m_value.get(); |
| + |
|
Eric Willigers
2015/01/28 22:24:45
no need for blank line
|
| CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end).value(); |
| InterpolationRange range = RangeAll; |
| bool fallBackToLegacy = false; |
| @@ -96,17 +97,14 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: |
| // FIXME: Generate this giant switch statement. |
| switch (property) { |
| case CSSPropertyLineHeight: |
| - if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInterpolation::canCreateFrom(*toCSSValue)) |
| - return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, RangeNonNegative); |
| - |
| if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyleInterpolation::canCreateFrom(*toCSSValue)) |
| return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, CSSPrimitiveValue::CSS_NUMBER, RangeNonNegative); |
| - |
| - break; |
| + // Fall through |
| case CSSPropertyBorderBottomWidth: |
| case CSSPropertyBorderLeftWidth: |
| case CSSPropertyBorderRightWidth: |
| case CSSPropertyBorderTopWidth: |
| + case CSSPropertyFlexBasis: |
| case CSSPropertyFontSize: |
| case CSSPropertyHeight: |
| case CSSPropertyMaxHeight: |
| @@ -121,6 +119,10 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: |
| case CSSPropertyPaddingTop: |
| case CSSPropertyPerspective: |
| case CSSPropertyShapeMargin: |
| + case CSSPropertyWebkitBorderHorizontalSpacing: |
| + case CSSPropertyWebkitBorderVerticalSpacing: |
| + case CSSPropertyWebkitColumnGap: |
| + case CSSPropertyWebkitColumnWidth: |
| case CSSPropertyWidth: |
| range = RangeNonNegative; |
| // Fall through |
| @@ -142,7 +144,6 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: |
| // FIXME: Handle keywords e.g. 'none'. |
| if (property == CSSPropertyPerspective) |
| fallBackToLegacy = true; |
| - |
| // FIXME: Handle keywords e.g. 'smaller', 'larger'. |
| if (property == CSSPropertyFontSize) |
| fallBackToLegacy = true; |
| @@ -154,14 +155,50 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: |
| // FIXME: Handle keywords e.g. 'thick' |
| if (property == CSSPropertyOutlineWidth) |
| fallBackToLegacy = true; |
| + break; |
| + case CSSPropertyOrphans: |
| + if (range == RangeAll) |
| + range = RangeCeiling; |
| + // Fall through |
| + case CSSPropertyWebkitColumnCount: |
| + case CSSPropertyZIndex: |
| + if (range == RangeAll) |
| + range = RangeFloor; |
| + // Fall through |
| + case CSSPropertyFillOpacity: |
| + case CSSPropertyFloodOpacity: |
| + case CSSPropertyOpacity: |
| + case CSSPropertyShapeImageThreshold: |
| + case CSSPropertyStopOpacity: |
| + case CSSPropertyStrokeOpacity: |
| + if (range == RangeAll) |
| + range = RangeFloatFractions; |
| + // Fall through |
| + case CSSPropertyStrokeMiterlimit: |
| + case CSSPropertyWidows: |
| + if (range == RangeAll) |
| + range = RangeGreaterThanOne; |
| + // Fall through |
| + case CSSPropertyZoom: |
| + if (range == RangeAll) |
| + range = RangeDoubleFractions; |
| + // Fall through |
| + case CSSPropertyFlexGrow: |
| + case CSSPropertyFlexShrink: |
| + case CSSPropertyWebkitColumnRuleWidth: |
| + if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyleInterpolation::canCreateFrom(*toCSSValue)) { |
| + if (property == CSSPropertyOpacity) { |
| + StringKeyframe::PropertySpecificKeyframe::ensureAnimatableValueCaches(property, end, element, fromCSSValue, toCSSValue); |
| + } |
| + return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), range); |
| + } |
| break; |
| - case CSSPropertyMotionRotation: |
| - { |
| - RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolation::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); |
| - if (interpolation) |
| - return interpolation.release(); |
| + case CSSPropertyMotionRotation: { |
| + RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolation::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); |
| + if (interpolation) |
| + return interpolation.release(); |
| break; |
|
Eric Willigers
2015/01/22 23:38:57
Unindent this line and the following line.
|
| } |
| case CSSPropertyVisibility: |
| @@ -246,23 +283,15 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: |
| return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue, property); |
| } |
| - // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here. |
| - // FIXME: Remove this cache |
| - ASSERT(element); |
| - if (!m_animatableValueCache) |
| - m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*element, property, *fromCSSValue); |
| - |
| - RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValueSnapshot(*element, property, *toCSSValue); |
| - toStringPropertySpecificKeyframe(end).m_animatableValueCache = to; |
| + StringKeyframe::PropertySpecificKeyframe::ensureAnimatableValueCaches(property, end, element, fromCSSValue, toCSSValue); |
| - return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.release(), property); |
| + return LegacyStyleInterpolation::create(m_animatableValueCache.get(), toStringPropertySpecificKeyframe(end).m_animatableValueCache.release(), property); |
| } |
| ASSERT(AnimatableValue::usesDefaultInterpolation( |
| StyleResolver::createAnimatableValueSnapshot(*element, property, *fromCSSValue).get(), |
| StyleResolver::createAnimatableValueSnapshot(*element, property, *toCSSValue).get())); |
| - |
| // FIXME: Remove this once TimingFunction partitioning is implemented for all types. |
| if (!RuntimeEnabledFeatures::webAnimationsAPITimingFunctionPartitioningEnabled()) |
| return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, property); |
| @@ -274,6 +303,18 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: |
| } |
| +// FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here. |
| +// FIXME: Remove this cache |
| +void StringKeyframe::PropertySpecificKeyframe::ensureAnimatableValueCaches(CSSPropertyID property, Keyframe::PropertySpecificKeyframe& end, Element* element, CSSValue* fromCSSValue, CSSValue* toCSSValue) const |
| +{ |
| + ASSERT(element); |
| + if (!m_animatableValueCache) |
| + m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*element, property, *fromCSSValue); |
| + RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValueSnapshot(*element, property, *toCSSValue); |
| + toStringPropertySpecificKeyframe(end).m_animatableValueCache = to; |
| +} |
| + |
| + |
|
Eric Willigers
2015/01/22 23:38:57
only need one blank line here
|
| PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::PropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const |
| { |
| return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, AnimationEffect::CompositeAdd)); |