Index: Source/core/animation/StringKeyframe.cpp |
diff --git a/Source/core/animation/StringKeyframe.cpp b/Source/core/animation/StringKeyframe.cpp |
index 25c36703bb71163c26129d0b43ee686640b8ac6e..048cd017b8a61e72ea3eb20cc33057b32c1d30f1 100644 |
--- a/Source/core/animation/StringKeyframe.cpp |
+++ b/Source/core/animation/StringKeyframe.cpp |
@@ -59,7 +59,7 @@ void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu |
m_propertySet->setProperty(property, value, false, styleSheetContents); |
} |
-void StringKeyframe::setPropertyValue(CSSPropertyID property, PassRefPtrWillBeRawPtr<CSSValue> value) |
+void StringKeyframe::setPropertyValue(CSSPropertyID property, CSSValue value) |
{ |
ASSERT(property != CSSPropertyInvalid); |
ASSERT(CSSAnimations::isAnimatableProperty(property)); |
@@ -106,12 +106,12 @@ DEFINE_TRACE(StringKeyframe) |
Keyframe::trace(visitor); |
} |
-StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::CompositeOperation op) |
+StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value, EffectModel::CompositeOperation op) |
: Keyframe::PropertySpecificKeyframe(offset, easing, op) |
, m_value(value) |
{ } |
-StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value) |
+StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value) |
: Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeReplace) |
, m_value(value) |
{ |
@@ -121,7 +121,7 @@ StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double |
void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPropertyID property, Element& element, const ComputedStyle* baseStyle) const |
{ |
if (!m_animatableValueCache && (baseStyle || !DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*m_value))) |
- m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(element, baseStyle, property, m_value.get()); |
+ m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(element, baseStyle, property, m_value); |
} |
namespace { |
@@ -183,8 +183,8 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
// TODO(alancutter): Remove the remainder of this function. |
// FIXME: Refactor this into a generic piece that lives in InterpolationEffect, and a template parameter specific converter. |
- CSSValue* fromCSSValue = m_value.get(); |
- CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); |
+ NullableCSSValue nullableFromCSSValue = m_value; |
+ NullableCSSValue nullableToCSSValue = toCSSPropertySpecificKeyframe(end).value(); |
InterpolationRange range = RangeAll; |
bool fallBackToLegacy = false; |
@@ -192,13 +192,13 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
bool forceDefaultInterpolation = false; |
// FIXME: Remove this check once neutral keyframes are implemented in StringKeyframes. |
- if (!fromCSSValue || !toCSSValue) |
- return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue, property); |
- |
- ASSERT(fromCSSValue && toCSSValue); |
+ if (!nullableFromCSSValue || !nullableToCSSValue) |
+ return DeferredLegacyStyleInterpolation::create(nullableFromCSSValue, nullableToCSSValue, property); |
+ CSSValue& fromCSSValue = *nullableFromCSSValue; |
+ CSSValue& toCSSValue = *nullableToCSSValue; |
if (!CSSPropertyMetadata::isInterpolableProperty(property)) { |
- if (fromCSSValue == toCSSValue) |
+ if (fromCSSValue.ptrEquals(toCSSValue)) |
return ConstantStyleInterpolation::create(fromCSSValue, property); |
return nullptr; |
@@ -206,11 +206,11 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
switch (property) { |
case CSSPropertyLineHeight: |
- if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyleInterpolation::canCreateFrom(*toCSSValue)) |
- return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, RangeNonNegative); |
+ 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); |
+ if (DoubleStyleInterpolation::canCreateFrom(fromCSSValue) && DoubleStyleInterpolation::canCreateFrom(toCSSValue)) |
+ return DoubleStyleInterpolation::create(fromCSSValue, toCSSValue, property, CSSPrimitiveValue::CSS_NUMBER, RangeNonNegative); |
break; |
case CSSPropertyBorderBottomWidth: |
@@ -267,8 +267,8 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
case CSSPropertyWebkitTransformOriginZ: |
case CSSPropertyX: |
case CSSPropertyY: |
- if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue, property) && LengthStyleInterpolation::canCreateFrom(*toCSSValue, property)) |
- return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); |
+ if (LengthStyleInterpolation::canCreateFrom(fromCSSValue, property) && LengthStyleInterpolation::canCreateFrom(toCSSValue, property)) |
+ return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, property, range); |
// FIXME: Handle keywords e.g. 'smaller', 'larger'. |
if (property == CSSPropertyFontSize) |
@@ -291,19 +291,19 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
case CSSPropertyStopOpacity: |
case CSSPropertyStrokeOpacity: |
case CSSPropertyStrokeMiterlimit: |
- if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyleInterpolation::canCreateFrom(*toCSSValue)) |
- return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property)); |
+ if (DoubleStyleInterpolation::canCreateFrom(fromCSSValue) && DoubleStyleInterpolation::canCreateFrom(toCSSValue)) |
+ return DoubleStyleInterpolation::create(fromCSSValue, toCSSValue, property, toCSSPrimitiveValue(fromCSSValue).primitiveType(), setRange(property)); |
break; |
case CSSPropertyMotionRotation: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolation::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolation::maybeCreateFromMotionRotation(fromCSSValue, toCSSValue, property); |
if (interpolation) |
return interpolation.release(); |
break; |
} |
case CSSPropertyVisibility: |
- if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && VisibilityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolation::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSValue))) |
- return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSValue, property); |
+ if (VisibilityStyleInterpolation::canCreateFrom(fromCSSValue) && VisibilityStyleInterpolation::canCreateFrom(toCSSValue) && (VisibilityStyleInterpolation::isVisible(fromCSSValue) || VisibilityStyleInterpolation::isVisible(toCSSValue))) |
+ return VisibilityStyleInterpolation::create(fromCSSValue, toCSSValue, property); |
break; |
@@ -323,12 +323,12 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
case CSSPropertyWebkitColumnRuleColor: |
case CSSPropertyWebkitTextStrokeColor: |
{ |
- RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpolation::maybeCreateFromColor(*fromCSSValue, *toCSSValue, property); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpolation::maybeCreateFromColor(fromCSSValue, toCSSValue, property); |
if (interpolation) |
return interpolation.release(); |
// Current color should use LegacyStyleInterpolation |
- if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*fromCSSValue, *toCSSValue)) |
+ if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(fromCSSValue, toCSSValue)) |
fallBackToLegacy = true; |
break; |
@@ -337,11 +337,11 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
case CSSPropertyBorderImageSource: |
case CSSPropertyListStyleImage: |
case CSSPropertyWebkitMaskBoxImageSource: |
- if (fromCSSValue == toCSSValue) |
+ if (fromCSSValue.ptrEquals(toCSSValue)) |
return ConstantStyleInterpolation::create(fromCSSValue, property); |
- if (ImageStyleInterpolation::canCreateFrom(*fromCSSValue) && ImageStyleInterpolation::canCreateFrom(*toCSSValue)) |
- return ImageStyleInterpolation::create(*fromCSSValue, *toCSSValue, property); |
+ if (ImageStyleInterpolation::canCreateFrom(fromCSSValue) && ImageStyleInterpolation::canCreateFrom(toCSSValue)) |
+ return ImageStyleInterpolation::create(fromCSSValue, toCSSValue, property); |
forceDefaultInterpolation = true; |
break; |
@@ -352,15 +352,17 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
range = RangeNonNegative; |
// Fall through |
case CSSPropertyObjectPosition: |
- if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthPairStyleInterpolation::canCreateFrom(*toCSSValue)) |
- return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); |
+ if (LengthPairStyleInterpolation::canCreateFrom(fromCSSValue) && LengthPairStyleInterpolation::canCreateFrom(toCSSValue)) |
+ return LengthPairStyleInterpolation::create(fromCSSValue, toCSSValue, property, range); |
break; |
case CSSPropertyPerspectiveOrigin: |
case CSSPropertyTransformOrigin: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range); |
- if (interpolation) |
- return interpolation.release(); |
+ if (fromCSSValue.isValueList() && toCSSValue.isValueList()) { |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<LengthStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue), toCSSValueList(toCSSValue), property, range); |
+ if (interpolation) |
+ return interpolation.release(); |
+ } |
// FIXME: Handle keywords: top, right, left, center, bottom |
fallBackToLegacy = true; |
@@ -370,12 +372,14 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
case CSSPropertyBoxShadow: |
case CSSPropertyTextShadow: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property); |
- if (interpolation) |
- return interpolation.release(); |
+ if (fromCSSValue.isValueList() && toCSSValue.isValueList()) { |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<ShadowStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue), toCSSValueList(toCSSValue), property); |
+ if (interpolation) |
+ return interpolation.release(); |
+ } |
// FIXME: AnimatableShadow incorrectly animates between inset and non-inset values so it will never indicate it needs default interpolation |
- if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValue, *toCSSValue)) { |
+ if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(fromCSSValue, toCSSValue)) { |
forceDefaultInterpolation = true; |
break; |
} |
@@ -388,11 +392,11 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
} |
case CSSPropertyClip: { |
- if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue, *toCSSValue)) { |
+ if (LengthBoxStyleInterpolation::usesDefaultInterpolation(fromCSSValue, toCSSValue)) { |
forceDefaultInterpolation = true; |
break; |
} |
- RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpolation::maybeCreateFrom(*fromCSSValue, *toCSSValue, property); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpolation::maybeCreateFrom(fromCSSValue, toCSSValue, property); |
if (interpolation) |
return interpolation.release(); |
break; |
@@ -400,17 +404,17 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
case CSSPropertyBorderImageSlice: |
case CSSPropertyWebkitMaskBoxImageSlice: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpolation::maybeCreate(*fromCSSValue, *toCSSValue, property); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpolation::maybeCreate(fromCSSValue, toCSSValue, property); |
if (interpolation) |
return interpolation.release(); |
- if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue, *toCSSValue)) |
+ if (ImageSliceStyleInterpolation::usesDefaultInterpolation(fromCSSValue, toCSSValue)) |
forceDefaultInterpolation = true; |
break; |
} |
case CSSPropertyStrokeDasharray: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyleInterpolation::maybeCreate(*fromCSSValue, *toCSSValue, property); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyleInterpolation::maybeCreate(fromCSSValue, toCSSValue, property); |
if (interpolation) |
return interpolation.release(); |
@@ -418,7 +422,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
} |
case CSSPropertyWebkitFilter: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolation::maybeCreateList(*fromCSSValue, *toCSSValue, property); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolation::maybeCreateList(fromCSSValue, toCSSValue, property); |
if (interpolation) |
return interpolation.release(); |
@@ -428,7 +432,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
} |
case CSSPropertyTranslate: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<LengthStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue), toCSSValueList(toCSSValue), property, range); |
if (interpolation) |
return interpolation.release(); |
@@ -438,7 +442,7 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
} |
case CSSPropertyScale: { |
- RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<DoubleStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range); |
+ RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation<DoubleStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue), toCSSValueList(toCSSValue), property, range); |
if (interpolation) |
return interpolation.release(); |
@@ -453,17 +457,17 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
break; |
} |
- if (fromCSSValue == toCSSValue) |
+ if (fromCSSValue.ptrEquals(toCSSValue)) |
return ConstantStyleInterpolation::create(fromCSSValue, property); |
if (forceDefaultInterpolation) |
return nullptr; |
- if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword()) |
+ if (fromCSSValue.isCSSWideKeyword() || toCSSValue.isCSSWideKeyword()) |
fallBackToLegacy = true; |
if (fallBackToLegacy) { |
- if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*toCSSValue)) { |
+ if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(toCSSValue)) { |
// FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation. |
return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue, property); |
} |
@@ -485,12 +489,12 @@ PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram |
PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const |
{ |
- return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, static_cast<CSSValue*>(0), EffectModel::CompositeAdd)); |
+ return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, nullptr, EffectModel::CompositeAdd)); |
} |
PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecificKeyframe::cloneWithOffset(double offset) const |
{ |
- Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyframe(offset, m_easing, m_value.get()); |
+ Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyframe(offset, m_easing, m_value); |
toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatableValueCache; |
return adoptPtrWillBeNoop(theClone); |
} |