| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/StringKeyframe.h" | 6 #include "core/animation/StringKeyframe.h" |
| 7 | 7 |
| 8 #include "core/animation/AngleSVGInterpolation.h" | 8 #include "core/animation/AngleSVGInterpolation.h" |
| 9 #include "core/animation/CSSValueInterpolationType.h" | 9 #include "core/animation/CSSValueInterpolationType.h" |
| 10 #include "core/animation/ColorStyleInterpolation.h" | 10 #include "core/animation/ColorStyleInterpolation.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu
e, Element* element, StyleSheetContents* styleSheetContents) | 55 void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu
e, Element* element, StyleSheetContents* styleSheetContents) |
| 56 { | 56 { |
| 57 ASSERT(property != CSSPropertyInvalid); | 57 ASSERT(property != CSSPropertyInvalid); |
| 58 if (CSSAnimations::isAnimatableProperty(property)) | 58 if (CSSAnimations::isAnimatableProperty(property)) |
| 59 m_propertySet->setProperty(property, value, false, styleSheetContents); | 59 m_propertySet->setProperty(property, value, false, styleSheetContents); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void StringKeyframe::setPropertyValue(CSSPropertyID property, PassRefPtrWillBeRa
wPtr<CSSValue> value) | 62 void StringKeyframe::setPropertyValue(CSSPropertyID property, CSSValue value) |
| 63 { | 63 { |
| 64 ASSERT(property != CSSPropertyInvalid); | 64 ASSERT(property != CSSPropertyInvalid); |
| 65 ASSERT(CSSAnimations::isAnimatableProperty(property)); | 65 ASSERT(CSSAnimations::isAnimatableProperty(property)); |
| 66 m_propertySet->setProperty(property, value, false); | 66 m_propertySet->setProperty(property, value, false); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void StringKeyframe::setPropertyValue(const QualifiedName& attributeName, const
String& value, Element* element) | 69 void StringKeyframe::setPropertyValue(const QualifiedName& attributeName, const
String& value, Element* element) |
| 70 { | 70 { |
| 71 ASSERT(element->isSVGElement()); | 71 ASSERT(element->isSVGElement()); |
| 72 m_svgPropertyMap.set(&attributeName, value); | 72 m_svgPropertyMap.set(&attributeName, value); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 99 ASSERT(property.isSVGAttribute()); | 99 ASSERT(property.isSVGAttribute()); |
| 100 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing(
), svgPropertyValue(*property.svgAttribute()), composite())); | 100 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing(
), svgPropertyValue(*property.svgAttribute()), composite())); |
| 101 } | 101 } |
| 102 | 102 |
| 103 DEFINE_TRACE(StringKeyframe) | 103 DEFINE_TRACE(StringKeyframe) |
| 104 { | 104 { |
| 105 visitor->trace(m_propertySet); | 105 visitor->trace(m_propertySet); |
| 106 Keyframe::trace(visitor); | 106 Keyframe::trace(visitor); |
| 107 } | 107 } |
| 108 | 108 |
| 109 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi
teOperation op) | 109 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value, EffectModel::
CompositeOperation op) |
| 110 : Keyframe::PropertySpecificKeyframe(offset, easing, op) | 110 : Keyframe::PropertySpecificKeyframe(offset, easing, op) |
| 111 , m_value(value) | 111 , m_value(value) |
| 112 { } | 112 { } |
| 113 | 113 |
| 114 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, CSSValue* value) | 114 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value) |
| 115 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) | 115 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) |
| 116 , m_value(value) | 116 , m_value(value) |
| 117 { | 117 { |
| 118 ASSERT(!isNull(m_offset)); | 118 ASSERT(!isNull(m_offset)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle) const | 121 void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle) const |
| 122 { | 122 { |
| 123 if (!m_animatableValueCache && (baseStyle || !DeferredLegacyStyleInterpolati
on::interpolationRequiresStyleResolve(*m_value))) | 123 if (!m_animatableValueCache && (baseStyle || !DeferredLegacyStyleInterpolati
on::interpolationRequiresStyleResolve(*m_value))) |
| 124 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(el
ement, baseStyle, property, m_value.get()); | 124 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(el
ement, baseStyle, property, m_value); |
| 125 } | 125 } |
| 126 | 126 |
| 127 namespace { | 127 namespace { |
| 128 InterpolationRange setRange(CSSPropertyID id) | 128 InterpolationRange setRange(CSSPropertyID id) |
| 129 { | 129 { |
| 130 switch (id) { | 130 switch (id) { |
| 131 case CSSPropertyOrphans: | 131 case CSSPropertyOrphans: |
| 132 case CSSPropertyWebkitColumnCount: | 132 case CSSPropertyWebkitColumnCount: |
| 133 case CSSPropertyWidows: | 133 case CSSPropertyWidows: |
| 134 return RangeRoundGreaterThanOrEqualToOne; | 134 return RangeRoundGreaterThanOrEqualToOne; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const | 176 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const |
| 177 { | 177 { |
| 178 CSSPropertyID property = propertyHandle.cssProperty(); | 178 CSSPropertyID property = propertyHandle.cssProperty(); |
| 179 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor
Property(property); | 179 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor
Property(property); |
| 180 if (applicableTypes) | 180 if (applicableTypes) |
| 181 return InvalidatableStyleInterpolation::create(*applicableTypes, *this,
toCSSPropertySpecificKeyframe(end)); | 181 return InvalidatableStyleInterpolation::create(*applicableTypes, *this,
toCSSPropertySpecificKeyframe(end)); |
| 182 | 182 |
| 183 // TODO(alancutter): Remove the remainder of this function. | 183 // TODO(alancutter): Remove the remainder of this function. |
| 184 | 184 |
| 185 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. | 185 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. |
| 186 CSSValue* fromCSSValue = m_value.get(); | 186 NullableCSSValue nullableFromCSSValue = m_value; |
| 187 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); | 187 NullableCSSValue nullableToCSSValue = toCSSPropertySpecificKeyframe(end).val
ue(); |
| 188 InterpolationRange range = RangeAll; | 188 InterpolationRange range = RangeAll; |
| 189 bool fallBackToLegacy = false; | 189 bool fallBackToLegacy = false; |
| 190 | 190 |
| 191 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. | 191 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. |
| 192 bool forceDefaultInterpolation = false; | 192 bool forceDefaultInterpolation = false; |
| 193 | 193 |
| 194 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. | 194 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. |
| 195 if (!fromCSSValue || !toCSSValue) | 195 if (!nullableFromCSSValue || !nullableToCSSValue) |
| 196 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue
, property); | 196 return DeferredLegacyStyleInterpolation::create(nullableFromCSSValue, nu
llableToCSSValue, property); |
| 197 | 197 CSSValue& fromCSSValue = *nullableFromCSSValue; |
| 198 ASSERT(fromCSSValue && toCSSValue); | 198 CSSValue& toCSSValue = *nullableToCSSValue; |
| 199 | 199 |
| 200 if (!CSSPropertyMetadata::isInterpolableProperty(property)) { | 200 if (!CSSPropertyMetadata::isInterpolableProperty(property)) { |
| 201 if (fromCSSValue == toCSSValue) | 201 if (fromCSSValue.ptrEquals(toCSSValue)) |
| 202 return ConstantStyleInterpolation::create(fromCSSValue, property); | 202 return ConstantStyleInterpolation::create(fromCSSValue, property); |
| 203 | 203 |
| 204 return nullptr; | 204 return nullptr; |
| 205 } | 205 } |
| 206 | 206 |
| 207 switch (property) { | 207 switch (property) { |
| 208 case CSSPropertyLineHeight: | 208 case CSSPropertyLineHeight: |
| 209 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 209 if (LengthStyleInterpolation::canCreateFrom(fromCSSValue) && LengthStyle
Interpolation::canCreateFrom(toCSSValue)) |
| 210 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, RangeNonNegative); | 210 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, RangeNonNegative); |
| 211 | 211 |
| 212 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 212 if (DoubleStyleInterpolation::canCreateFrom(fromCSSValue) && DoubleStyle
Interpolation::canCreateFrom(toCSSValue)) |
| 213 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, CSSPrimitiveValue::CSS_NUMBER, RangeNonNegative); | 213 return DoubleStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, CSSPrimitiveValue::CSS_NUMBER, RangeNonNegative); |
| 214 | 214 |
| 215 break; | 215 break; |
| 216 case CSSPropertyBorderBottomWidth: | 216 case CSSPropertyBorderBottomWidth: |
| 217 case CSSPropertyBorderLeftWidth: | 217 case CSSPropertyBorderLeftWidth: |
| 218 case CSSPropertyBorderRightWidth: | 218 case CSSPropertyBorderRightWidth: |
| 219 case CSSPropertyBorderTopWidth: | 219 case CSSPropertyBorderTopWidth: |
| 220 case CSSPropertyFlexBasis: | 220 case CSSPropertyFlexBasis: |
| 221 case CSSPropertyFontSize: | 221 case CSSPropertyFontSize: |
| 222 case CSSPropertyHeight: | 222 case CSSPropertyHeight: |
| 223 case CSSPropertyMaxHeight: | 223 case CSSPropertyMaxHeight: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 case CSSPropertyVerticalAlign: | 260 case CSSPropertyVerticalAlign: |
| 261 case CSSPropertyWordSpacing: | 261 case CSSPropertyWordSpacing: |
| 262 case CSSPropertyWebkitColumnRuleWidth: | 262 case CSSPropertyWebkitColumnRuleWidth: |
| 263 case CSSPropertyWebkitPerspectiveOriginX: | 263 case CSSPropertyWebkitPerspectiveOriginX: |
| 264 case CSSPropertyWebkitPerspectiveOriginY: | 264 case CSSPropertyWebkitPerspectiveOriginY: |
| 265 case CSSPropertyWebkitTransformOriginX: | 265 case CSSPropertyWebkitTransformOriginX: |
| 266 case CSSPropertyWebkitTransformOriginY: | 266 case CSSPropertyWebkitTransformOriginY: |
| 267 case CSSPropertyWebkitTransformOriginZ: | 267 case CSSPropertyWebkitTransformOriginZ: |
| 268 case CSSPropertyX: | 268 case CSSPropertyX: |
| 269 case CSSPropertyY: | 269 case CSSPropertyY: |
| 270 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue, property) &&
LengthStyleInterpolation::canCreateFrom(*toCSSValue, property)) | 270 if (LengthStyleInterpolation::canCreateFrom(fromCSSValue, property) && L
engthStyleInterpolation::canCreateFrom(toCSSValue, property)) |
| 271 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, range); | 271 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, range); |
| 272 | 272 |
| 273 // FIXME: Handle keywords e.g. 'smaller', 'larger'. | 273 // FIXME: Handle keywords e.g. 'smaller', 'larger'. |
| 274 if (property == CSSPropertyFontSize) | 274 if (property == CSSPropertyFontSize) |
| 275 fallBackToLegacy = true; | 275 fallBackToLegacy = true; |
| 276 | 276 |
| 277 // FIXME: Handle keywords e.g. 'baseline', 'sub'. | 277 // FIXME: Handle keywords e.g. 'baseline', 'sub'. |
| 278 if (property == CSSPropertyBaselineShift) | 278 if (property == CSSPropertyBaselineShift) |
| 279 fallBackToLegacy = true; | 279 fallBackToLegacy = true; |
| 280 | 280 |
| 281 break; | 281 break; |
| 282 case CSSPropertyOrphans: | 282 case CSSPropertyOrphans: |
| 283 case CSSPropertyWidows: | 283 case CSSPropertyWidows: |
| 284 case CSSPropertyZIndex: | 284 case CSSPropertyZIndex: |
| 285 case CSSPropertyWebkitColumnCount: | 285 case CSSPropertyWebkitColumnCount: |
| 286 case CSSPropertyShapeImageThreshold: | 286 case CSSPropertyShapeImageThreshold: |
| 287 case CSSPropertyFillOpacity: | 287 case CSSPropertyFillOpacity: |
| 288 case CSSPropertyFloodOpacity: | 288 case CSSPropertyFloodOpacity: |
| 289 case CSSPropertyFontSizeAdjust: | 289 case CSSPropertyFontSizeAdjust: |
| 290 case CSSPropertyOpacity: | 290 case CSSPropertyOpacity: |
| 291 case CSSPropertyStopOpacity: | 291 case CSSPropertyStopOpacity: |
| 292 case CSSPropertyStrokeOpacity: | 292 case CSSPropertyStrokeOpacity: |
| 293 case CSSPropertyStrokeMiterlimit: | 293 case CSSPropertyStrokeMiterlimit: |
| 294 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 294 if (DoubleStyleInterpolation::canCreateFrom(fromCSSValue) && DoubleStyle
Interpolation::canCreateFrom(toCSSValue)) |
| 295 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue,
property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property)
); | 295 return DoubleStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, toCSSPrimitiveValue(fromCSSValue).primitiveType(), setRange(property)); |
| 296 break; | 296 break; |
| 297 | 297 |
| 298 case CSSPropertyMotionRotation: { | 298 case CSSPropertyMotionRotation: { |
| 299 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati
on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); | 299 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati
on::maybeCreateFromMotionRotation(fromCSSValue, toCSSValue, property); |
| 300 if (interpolation) | 300 if (interpolation) |
| 301 return interpolation.release(); | 301 return interpolation.release(); |
| 302 break; | 302 break; |
| 303 } | 303 } |
| 304 case CSSPropertyVisibility: | 304 case CSSPropertyVisibility: |
| 305 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi
lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat
ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV
alue))) | 305 if (VisibilityStyleInterpolation::canCreateFrom(fromCSSValue) && Visibil
ityStyleInterpolation::canCreateFrom(toCSSValue) && (VisibilityStyleInterpolatio
n::isVisible(fromCSSValue) || VisibilityStyleInterpolation::isVisible(toCSSValue
))) |
| 306 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal
ue, property); | 306 return VisibilityStyleInterpolation::create(fromCSSValue, toCSSValue
, property); |
| 307 | 307 |
| 308 break; | 308 break; |
| 309 | 309 |
| 310 case CSSPropertyBackgroundColor: | 310 case CSSPropertyBackgroundColor: |
| 311 case CSSPropertyBorderBottomColor: | 311 case CSSPropertyBorderBottomColor: |
| 312 case CSSPropertyBorderLeftColor: | 312 case CSSPropertyBorderLeftColor: |
| 313 case CSSPropertyBorderRightColor: | 313 case CSSPropertyBorderRightColor: |
| 314 case CSSPropertyBorderTopColor: | 314 case CSSPropertyBorderTopColor: |
| 315 case CSSPropertyColor: | 315 case CSSPropertyColor: |
| 316 case CSSPropertyFill: | 316 case CSSPropertyFill: |
| 317 case CSSPropertyFloodColor: | 317 case CSSPropertyFloodColor: |
| 318 case CSSPropertyLightingColor: | 318 case CSSPropertyLightingColor: |
| 319 case CSSPropertyOutlineColor: | 319 case CSSPropertyOutlineColor: |
| 320 case CSSPropertyStopColor: | 320 case CSSPropertyStopColor: |
| 321 case CSSPropertyStroke: | 321 case CSSPropertyStroke: |
| 322 case CSSPropertyTextDecorationColor: | 322 case CSSPropertyTextDecorationColor: |
| 323 case CSSPropertyWebkitColumnRuleColor: | 323 case CSSPropertyWebkitColumnRuleColor: |
| 324 case CSSPropertyWebkitTextStrokeColor: | 324 case CSSPropertyWebkitTextStrokeColor: |
| 325 { | 325 { |
| 326 RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpol
ation::maybeCreateFromColor(*fromCSSValue, *toCSSValue, property); | 326 RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpol
ation::maybeCreateFromColor(fromCSSValue, toCSSValue, property); |
| 327 if (interpolation) | 327 if (interpolation) |
| 328 return interpolation.release(); | 328 return interpolation.release(); |
| 329 | 329 |
| 330 // Current color should use LegacyStyleInterpolation | 330 // Current color should use LegacyStyleInterpolation |
| 331 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*from
CSSValue, *toCSSValue)) | 331 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(fromC
SSValue, toCSSValue)) |
| 332 fallBackToLegacy = true; | 332 fallBackToLegacy = true; |
| 333 | 333 |
| 334 break; | 334 break; |
| 335 } | 335 } |
| 336 | 336 |
| 337 case CSSPropertyBorderImageSource: | 337 case CSSPropertyBorderImageSource: |
| 338 case CSSPropertyListStyleImage: | 338 case CSSPropertyListStyleImage: |
| 339 case CSSPropertyWebkitMaskBoxImageSource: | 339 case CSSPropertyWebkitMaskBoxImageSource: |
| 340 if (fromCSSValue == toCSSValue) | 340 if (fromCSSValue.ptrEquals(toCSSValue)) |
| 341 return ConstantStyleInterpolation::create(fromCSSValue, property); | 341 return ConstantStyleInterpolation::create(fromCSSValue, property); |
| 342 | 342 |
| 343 if (ImageStyleInterpolation::canCreateFrom(*fromCSSValue) && ImageStyleI
nterpolation::canCreateFrom(*toCSSValue)) | 343 if (ImageStyleInterpolation::canCreateFrom(fromCSSValue) && ImageStyleIn
terpolation::canCreateFrom(toCSSValue)) |
| 344 return ImageStyleInterpolation::create(*fromCSSValue, *toCSSValue, p
roperty); | 344 return ImageStyleInterpolation::create(fromCSSValue, toCSSValue, pro
perty); |
| 345 | 345 |
| 346 forceDefaultInterpolation = true; | 346 forceDefaultInterpolation = true; |
| 347 break; | 347 break; |
| 348 case CSSPropertyBorderBottomLeftRadius: | 348 case CSSPropertyBorderBottomLeftRadius: |
| 349 case CSSPropertyBorderBottomRightRadius: | 349 case CSSPropertyBorderBottomRightRadius: |
| 350 case CSSPropertyBorderTopLeftRadius: | 350 case CSSPropertyBorderTopLeftRadius: |
| 351 case CSSPropertyBorderTopRightRadius: | 351 case CSSPropertyBorderTopRightRadius: |
| 352 range = RangeNonNegative; | 352 range = RangeNonNegative; |
| 353 // Fall through | 353 // Fall through |
| 354 case CSSPropertyObjectPosition: | 354 case CSSPropertyObjectPosition: |
| 355 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length
PairStyleInterpolation::canCreateFrom(*toCSSValue)) | 355 if (LengthPairStyleInterpolation::canCreateFrom(fromCSSValue) && LengthP
airStyleInterpolation::canCreateFrom(toCSSValue)) |
| 356 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal
ue, property, range); | 356 return LengthPairStyleInterpolation::create(fromCSSValue, toCSSValue
, property, range); |
| 357 break; | 357 break; |
| 358 | 358 |
| 359 case CSSPropertyPerspectiveOrigin: | 359 case CSSPropertyPerspectiveOrigin: |
| 360 case CSSPropertyTransformOrigin: { | 360 case CSSPropertyTransformOrigin: { |
| 361 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty, range); | 361 if (fromCSSValue.isValueList() && toCSSValue.isValueList()) { |
| 362 if (interpolation) | 362 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpola
tion<LengthStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue)
, toCSSValueList(toCSSValue), property, range); |
| 363 return interpolation.release(); | 363 if (interpolation) |
| 364 return interpolation.release(); |
| 365 } |
| 364 | 366 |
| 365 // FIXME: Handle keywords: top, right, left, center, bottom | 367 // FIXME: Handle keywords: top, right, left, center, bottom |
| 366 fallBackToLegacy = true; | 368 fallBackToLegacy = true; |
| 367 | 369 |
| 368 break; | 370 break; |
| 369 } | 371 } |
| 370 | 372 |
| 371 case CSSPropertyBoxShadow: | 373 case CSSPropertyBoxShadow: |
| 372 case CSSPropertyTextShadow: { | 374 case CSSPropertyTextShadow: { |
| 373 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty); | 375 if (fromCSSValue.isValueList() && toCSSValue.isValueList()) { |
| 374 if (interpolation) | 376 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpola
tion<ShadowStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue)
, toCSSValueList(toCSSValue), property); |
| 375 return interpolation.release(); | 377 if (interpolation) |
| 378 return interpolation.release(); |
| 379 } |
| 376 | 380 |
| 377 // FIXME: AnimatableShadow incorrectly animates between inset and non-in
set values so it will never indicate it needs default interpolation | 381 // FIXME: AnimatableShadow incorrectly animates between inset and non-in
set values so it will never indicate it needs default interpolation |
| 378 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu
e, *toCSSValue)) { | 382 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(fromCSSValue
, toCSSValue)) { |
| 379 forceDefaultInterpolation = true; | 383 forceDefaultInterpolation = true; |
| 380 break; | 384 break; |
| 381 } | 385 } |
| 382 | 386 |
| 383 // FIXME: Handle interpolation from/to none, unspecified color values | 387 // FIXME: Handle interpolation from/to none, unspecified color values |
| 384 fallBackToLegacy = true; | 388 fallBackToLegacy = true; |
| 385 | 389 |
| 386 break; | 390 break; |
| 387 | 391 |
| 388 } | 392 } |
| 389 | 393 |
| 390 case CSSPropertyClip: { | 394 case CSSPropertyClip: { |
| 391 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue,
*toCSSValue)) { | 395 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(fromCSSValue,
toCSSValue)) { |
| 392 forceDefaultInterpolation = true; | 396 forceDefaultInterpolation = true; |
| 393 break; | 397 break; |
| 394 } | 398 } |
| 395 RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpol
ation::maybeCreateFrom(*fromCSSValue, *toCSSValue, property); | 399 RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpol
ation::maybeCreateFrom(fromCSSValue, toCSSValue, property); |
| 396 if (interpolation) | 400 if (interpolation) |
| 397 return interpolation.release(); | 401 return interpolation.release(); |
| 398 break; | 402 break; |
| 399 } | 403 } |
| 400 | 404 |
| 401 case CSSPropertyBorderImageSlice: | 405 case CSSPropertyBorderImageSlice: |
| 402 case CSSPropertyWebkitMaskBoxImageSlice: { | 406 case CSSPropertyWebkitMaskBoxImageSlice: { |
| 403 RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpo
lation::maybeCreate(*fromCSSValue, *toCSSValue, property); | 407 RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpo
lation::maybeCreate(fromCSSValue, toCSSValue, property); |
| 404 if (interpolation) | 408 if (interpolation) |
| 405 return interpolation.release(); | 409 return interpolation.release(); |
| 406 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue
, *toCSSValue)) | 410 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(fromCSSValue,
toCSSValue)) |
| 407 forceDefaultInterpolation = true; | 411 forceDefaultInterpolation = true; |
| 408 | 412 |
| 409 break; | 413 break; |
| 410 } | 414 } |
| 411 | 415 |
| 412 case CSSPropertyStrokeDasharray: { | 416 case CSSPropertyStrokeDasharray: { |
| 413 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyl
eInterpolation::maybeCreate(*fromCSSValue, *toCSSValue, property); | 417 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyl
eInterpolation::maybeCreate(fromCSSValue, toCSSValue, property); |
| 414 if (interpolation) | 418 if (interpolation) |
| 415 return interpolation.release(); | 419 return interpolation.release(); |
| 416 | 420 |
| 417 break; | 421 break; |
| 418 } | 422 } |
| 419 | 423 |
| 420 case CSSPropertyWebkitFilter: { | 424 case CSSPropertyWebkitFilter: { |
| 421 RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolati
on::maybeCreateList(*fromCSSValue, *toCSSValue, property); | 425 RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolati
on::maybeCreateList(fromCSSValue, toCSSValue, property); |
| 422 if (interpolation) | 426 if (interpolation) |
| 423 return interpolation.release(); | 427 return interpolation.release(); |
| 424 | 428 |
| 425 // FIXME: Support drop shadow interpolation. | 429 // FIXME: Support drop shadow interpolation. |
| 426 fallBackToLegacy = true; | 430 fallBackToLegacy = true; |
| 427 break; | 431 break; |
| 428 } | 432 } |
| 429 | 433 |
| 430 case CSSPropertyTranslate: { | 434 case CSSPropertyTranslate: { |
| 431 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty, range); | 435 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<LengthStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue), to
CSSValueList(toCSSValue), property, range); |
| 432 if (interpolation) | 436 if (interpolation) |
| 433 return interpolation.release(); | 437 return interpolation.release(); |
| 434 | 438 |
| 435 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length
does not match. | 439 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length
does not match. |
| 436 fallBackToLegacy = true; | 440 fallBackToLegacy = true; |
| 437 break; | 441 break; |
| 438 } | 442 } |
| 439 | 443 |
| 440 case CSSPropertyScale: { | 444 case CSSPropertyScale: { |
| 441 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<DoubleStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop
erty, range); | 445 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation
<DoubleStyleInterpolation>::maybeCreateFromList(toCSSValueList(fromCSSValue), to
CSSValueList(toCSSValue), property, range); |
| 442 if (interpolation) | 446 if (interpolation) |
| 443 return interpolation.release(); | 447 return interpolation.release(); |
| 444 | 448 |
| 445 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length
does not match. | 449 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length
does not match. |
| 446 fallBackToLegacy = true; | 450 fallBackToLegacy = true; |
| 447 break; | 451 break; |
| 448 } | 452 } |
| 449 | 453 |
| 450 default: | 454 default: |
| 451 // Fall back to LegacyStyleInterpolation. | 455 // Fall back to LegacyStyleInterpolation. |
| 452 fallBackToLegacy = true; | 456 fallBackToLegacy = true; |
| 453 break; | 457 break; |
| 454 } | 458 } |
| 455 | 459 |
| 456 if (fromCSSValue == toCSSValue) | 460 if (fromCSSValue.ptrEquals(toCSSValue)) |
| 457 return ConstantStyleInterpolation::create(fromCSSValue, property); | 461 return ConstantStyleInterpolation::create(fromCSSValue, property); |
| 458 | 462 |
| 459 if (forceDefaultInterpolation) | 463 if (forceDefaultInterpolation) |
| 460 return nullptr; | 464 return nullptr; |
| 461 | 465 |
| 462 if (fromCSSValue->isCSSWideKeyword() || toCSSValue->isCSSWideKeyword()) | 466 if (fromCSSValue.isCSSWideKeyword() || toCSSValue.isCSSWideKeyword()) |
| 463 fallBackToLegacy = true; | 467 fallBackToLegacy = true; |
| 464 | 468 |
| 465 if (fallBackToLegacy) { | 469 if (fallBackToLegacy) { |
| 466 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(
*fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleRe
solve(*toCSSValue)) { | 470 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(
fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleRes
olve(toCSSValue)) { |
| 467 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpola
tion. | 471 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpola
tion. |
| 468 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSV
alue, property); | 472 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSV
alue, property); |
| 469 } | 473 } |
| 470 | 474 |
| 471 // FIXME: Remove the use of AnimatableValues and Elements here. | 475 // FIXME: Remove the use of AnimatableValues and Elements here. |
| 472 ASSERT(element); | 476 ASSERT(element); |
| 473 populateAnimatableValue(property, *element, baseStyle); | 477 populateAnimatableValue(property, *element, baseStyle); |
| 474 end.populateAnimatableValue(property, *element, baseStyle); | 478 end.populateAnimatableValue(property, *element, baseStyle); |
| 475 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAni
matableValue(), property); | 479 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAni
matableValue(), property); |
| 476 } | 480 } |
| 477 | 481 |
| 478 ASSERT(AnimatableValue::usesDefaultInterpolation( | 482 ASSERT(AnimatableValue::usesDefaultInterpolation( |
| 479 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, fromCSSValue).get(), | 483 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, fromCSSValue).get(), |
| 480 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, toCSSValue).get())); | 484 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper
ty, toCSSValue).get())); |
| 481 | 485 |
| 482 return nullptr; | 486 return nullptr; |
| 483 | 487 |
| 484 } | 488 } |
| 485 | 489 |
| 486 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction
> easing) const | 490 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction
> easing) const |
| 487 { | 491 { |
| 488 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, st
atic_cast<CSSValue*>(0), EffectModel::CompositeAdd)); | 492 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, nu
llptr, EffectModel::CompositeAdd)); |
| 489 } | 493 } |
| 490 | 494 |
| 491 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::cloneWithOffset(double offset) const | 495 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr
opertySpecificKeyframe::cloneWithOffset(double offset) const |
| 492 { | 496 { |
| 493 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra
me(offset, m_easing, m_value.get()); | 497 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra
me(offset, m_easing, m_value); |
| 494 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab
leValueCache; | 498 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab
leValueCache; |
| 495 return adoptPtrWillBeNoop(theClone); | 499 return adoptPtrWillBeNoop(theClone); |
| 496 } | 500 } |
| 497 | 501 |
| 498 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe) | 502 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe) |
| 499 { | 503 { |
| 500 visitor->trace(m_value); | 504 visitor->trace(m_value); |
| 501 visitor->trace(m_animatableValueCache); | 505 visitor->trace(m_animatableValueCache); |
| 502 Keyframe::PropertySpecificKeyframe::trace(visitor); | 506 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 503 } | 507 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 598 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
| 595 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 599 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 596 | 600 |
| 597 if (!fromValue || !toValue) | 601 if (!fromValue || !toValue) |
| 598 return nullptr; | 602 return nullptr; |
| 599 | 603 |
| 600 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 604 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
| 601 } | 605 } |
| 602 | 606 |
| 603 } // namespace blink | 607 } // namespace blink |
| OLD | NEW |