Chromium Code Reviews| 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/ColorStyleInterpolation.h" | 9 #include "core/animation/ColorStyleInterpolation.h" |
| 10 #include "core/animation/CompositorAnimations.h" | 10 #include "core/animation/CompositorAnimations.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 PropertyHandleSet properties; | 76 PropertyHandleSet properties; |
| 77 for (unsigned i = 0; i < m_propertySet->propertyCount(); ++i) | 77 for (unsigned i = 0; i < m_propertySet->propertyCount(); ++i) |
| 78 properties.add(PropertyHandle(m_propertySet->propertyAt(i).id())); | 78 properties.add(PropertyHandle(m_propertySet->propertyAt(i).id())); |
| 79 | 79 |
| 80 for (const auto& key: m_svgPropertyMap.keys()) | 80 for (const auto& key: m_svgPropertyMap.keys()) |
| 81 properties.add(PropertyHandle(*key)); | 81 properties.add(PropertyHandle(*key)); |
| 82 | 82 |
| 83 return properties; | 83 return properties; |
| 84 } | 84 } |
| 85 | 85 |
| 86 PassRefPtrWillBeRawPtr<Keyframe> StringKeyframe::clone() const | 86 Keyframe* StringKeyframe::clone() const |
| 87 { | 87 { |
| 88 return adoptRefWillBeNoop(new StringKeyframe(*this)); | 88 return new StringKeyframe(*this); |
| 89 } | 89 } |
| 90 | 90 |
| 91 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::creat ePropertySpecificKeyframe(PropertyHandle property) const | 91 Keyframe::PropertySpecificKeyframe* StringKeyframe::createPropertySpecificKeyfra me(PropertyHandle property) const |
| 92 { | 92 { |
| 93 if (property.isCSSProperty()) | 93 if (property.isCSSProperty()) |
| 94 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset(), &eas ing(), cssPropertyValue(property.cssProperty()), composite())); | 94 return new CSSPropertySpecificKeyframe(offset(), &easing(), cssPropertyV alue(property.cssProperty()), composite()); |
| 95 | 95 |
| 96 ASSERT(property.isSVGAttribute()); | 96 ASSERT(property.isSVGAttribute()); |
| 97 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing( ), svgPropertyValue(*property.svgAttribute()), composite())); | 97 return new SVGPropertySpecificKeyframe(offset(), &easing(), svgPropertyValue (*property.svgAttribute()), composite()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 DEFINE_TRACE(StringKeyframe) | 100 DEFINE_TRACE(StringKeyframe) |
| 101 { | 101 { |
| 102 visitor->trace(m_propertySet); | 102 visitor->trace(m_propertySet); |
| 103 Keyframe::trace(visitor); | 103 Keyframe::trace(visitor); |
| 104 } | 104 } |
| 105 | 105 |
| 106 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi teOperation op) | 106 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi teOperation op) |
| 107 : Keyframe::PropertySpecificKeyframe(offset, easing, op) | 107 : Keyframe::PropertySpecificKeyframe(offset, easing, op) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 case CSSPropertyFontSizeAdjust: | 145 case CSSPropertyFontSizeAdjust: |
| 146 return RangeNonNegative; | 146 return RangeNonNegative; |
| 147 default: | 147 default: |
| 148 ASSERT_NOT_REACHED(); | 148 ASSERT_NOT_REACHED(); |
| 149 return RangeAll; | 149 return RangeAll; |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| 154 | 154 |
| 155 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const | 155 Interpolation* StringKeyframe::CSSPropertySpecificKeyframe::maybeCreateInterpola tion(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Ele ment* element, const ComputedStyle* baseStyle) const |
| 156 { | 156 { |
| 157 CSSPropertyID property = propertyHandle.cssProperty(); | 157 CSSPropertyID property = propertyHandle.cssProperty(); |
| 158 | 158 |
| 159 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe ct, and a template parameter specific converter. | 159 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe ct, and a template parameter specific converter. |
| 160 CSSValue* fromCSSValue = m_value.get(); | 160 CSSValue* fromCSSValue = m_value.get(); |
| 161 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); | 161 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); |
| 162 InterpolationRange range = RangeAll; | 162 InterpolationRange range = RangeAll; |
| 163 bool fallBackToLegacy = false; | 163 bool fallBackToLegacy = false; |
| 164 | 164 |
| 165 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr ect. | 165 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr ect. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 case CSSPropertyFontSizeAdjust: | 264 case CSSPropertyFontSizeAdjust: |
| 265 case CSSPropertyOpacity: | 265 case CSSPropertyOpacity: |
| 266 case CSSPropertyStopOpacity: | 266 case CSSPropertyStopOpacity: |
| 267 case CSSPropertyStrokeOpacity: | 267 case CSSPropertyStrokeOpacity: |
| 268 case CSSPropertyStrokeMiterlimit: | 268 case CSSPropertyStrokeMiterlimit: |
| 269 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) | 269 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) |
| 270 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property) ); | 270 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, toCSSPrimitiveValue(fromCSSValue)->primitiveType(), setRange(property) ); |
| 271 break; | 271 break; |
| 272 | 272 |
| 273 case CSSPropertyMotionRotation: { | 273 case CSSPropertyMotionRotation: { |
| 274 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); | 274 Interpolation* interpolation = DoubleStyleInterpolation::maybeCreateFrom MotionRotation(*fromCSSValue, *toCSSValue, property); |
| 275 if (interpolation) | 275 if (interpolation) |
| 276 return interpolation.release(); | 276 return interpolation; |
| 277 break; | 277 break; |
|
sof
2015/05/30 11:34:05
Could you fix indentation of this "break"?
peria
2015/06/01 04:43:02
Thank you for catching up this mistake!
| |
| 278 } | 278 } |
| 279 case CSSPropertyVisibility: | 279 case CSSPropertyVisibility: |
| 280 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) | 280 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) |
| 281 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); | 281 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); |
| 282 | 282 |
| 283 break; | 283 break; |
| 284 | 284 |
| 285 case CSSPropertyBackgroundColor: | 285 case CSSPropertyBackgroundColor: |
| 286 case CSSPropertyBorderBottomColor: | 286 case CSSPropertyBorderBottomColor: |
| 287 case CSSPropertyBorderLeftColor: | 287 case CSSPropertyBorderLeftColor: |
| 288 case CSSPropertyBorderRightColor: | 288 case CSSPropertyBorderRightColor: |
| 289 case CSSPropertyBorderTopColor: | 289 case CSSPropertyBorderTopColor: |
| 290 case CSSPropertyColor: | 290 case CSSPropertyColor: |
| 291 case CSSPropertyFill: | 291 case CSSPropertyFill: |
| 292 case CSSPropertyFloodColor: | 292 case CSSPropertyFloodColor: |
| 293 case CSSPropertyLightingColor: | 293 case CSSPropertyLightingColor: |
| 294 case CSSPropertyOutlineColor: | 294 case CSSPropertyOutlineColor: |
| 295 case CSSPropertyStopColor: | 295 case CSSPropertyStopColor: |
| 296 case CSSPropertyStroke: | 296 case CSSPropertyStroke: |
| 297 case CSSPropertyTextDecorationColor: | 297 case CSSPropertyTextDecorationColor: |
| 298 case CSSPropertyWebkitColumnRuleColor: | 298 case CSSPropertyWebkitColumnRuleColor: |
| 299 case CSSPropertyWebkitTextStrokeColor: | 299 case CSSPropertyWebkitTextStrokeColor: |
| 300 { | 300 { |
| 301 RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpol ation::maybeCreateFromColor(*fromCSSValue, *toCSSValue, property); | 301 Interpolation* interpolation = ColorStyleInterpolation::maybeCreateF romColor(*fromCSSValue, *toCSSValue, property); |
| 302 if (interpolation) | 302 if (interpolation) |
| 303 return interpolation.release(); | 303 return interpolation; |
| 304 | 304 |
| 305 // Current color should use LegacyStyleInterpolation | 305 // Current color should use LegacyStyleInterpolation |
| 306 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*from CSSValue, *toCSSValue)) | 306 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*from CSSValue, *toCSSValue)) |
| 307 fallBackToLegacy = true; | 307 fallBackToLegacy = true; |
| 308 | 308 |
| 309 break; | 309 break; |
| 310 } | 310 } |
| 311 | 311 |
| 312 case CSSPropertyBorderImageSource: | 312 case CSSPropertyBorderImageSource: |
| 313 case CSSPropertyListStyleImage: | 313 case CSSPropertyListStyleImage: |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 326 case CSSPropertyBorderTopRightRadius: | 326 case CSSPropertyBorderTopRightRadius: |
| 327 range = RangeNonNegative; | 327 range = RangeNonNegative; |
| 328 // Fall through | 328 // Fall through |
| 329 case CSSPropertyObjectPosition: | 329 case CSSPropertyObjectPosition: |
| 330 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length PairStyleInterpolation::canCreateFrom(*toCSSValue)) | 330 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length PairStyleInterpolation::canCreateFrom(*toCSSValue)) |
| 331 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property, range); | 331 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property, range); |
| 332 break; | 332 break; |
| 333 | 333 |
| 334 case CSSPropertyPerspectiveOrigin: | 334 case CSSPropertyPerspectiveOrigin: |
| 335 case CSSPropertyTransformOrigin: { | 335 case CSSPropertyTransformOrigin: { |
| 336 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty, range); | 336 Interpolation* interpolation = ListStyleInterpolation<LengthStyleInterpo lation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range); |
| 337 if (interpolation) | 337 if (interpolation) |
| 338 return interpolation.release(); | 338 return interpolation; |
| 339 | 339 |
| 340 // FIXME: Handle keywords: top, right, left, center, bottom | 340 // FIXME: Handle keywords: top, right, left, center, bottom |
| 341 fallBackToLegacy = true; | 341 fallBackToLegacy = true; |
| 342 | 342 |
| 343 break; | 343 break; |
| 344 } | 344 } |
| 345 | 345 |
| 346 case CSSPropertyBoxShadow: | 346 case CSSPropertyBoxShadow: |
| 347 case CSSPropertyTextShadow: { | 347 case CSSPropertyTextShadow: { |
| 348 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty); | 348 Interpolation* interpolation = ListStyleInterpolation<ShadowStyleInterpo lation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property); |
| 349 if (interpolation) | 349 if (interpolation) |
| 350 return interpolation.release(); | 350 return interpolation; |
| 351 | 351 |
| 352 // FIXME: AnimatableShadow incorrectly animates between inset and non-in set values so it will never indicate it needs default interpolation | 352 // FIXME: AnimatableShadow incorrectly animates between inset and non-in set values so it will never indicate it needs default interpolation |
| 353 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu e, *toCSSValue)) { | 353 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu e, *toCSSValue)) { |
| 354 forceDefaultInterpolation = true; | 354 forceDefaultInterpolation = true; |
| 355 break; | 355 break; |
| 356 } | 356 } |
| 357 | 357 |
| 358 // FIXME: Handle interpolation from/to none, unspecified color values | 358 // FIXME: Handle interpolation from/to none, unspecified color values |
| 359 fallBackToLegacy = true; | 359 fallBackToLegacy = true; |
| 360 | 360 |
| 361 break; | 361 break; |
| 362 | 362 |
| 363 } | 363 } |
| 364 | 364 |
| 365 case CSSPropertyClip: { | 365 case CSSPropertyClip: { |
| 366 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue, *toCSSValue)) { | 366 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue, *toCSSValue)) { |
| 367 forceDefaultInterpolation = true; | 367 forceDefaultInterpolation = true; |
| 368 break; | 368 break; |
| 369 } | 369 } |
| 370 RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpol ation::maybeCreateFrom(*fromCSSValue, *toCSSValue, property); | 370 Interpolation* interpolation = LengthBoxStyleInterpolation::maybeCreateF rom(*fromCSSValue, *toCSSValue, property); |
| 371 if (interpolation) | 371 if (interpolation) |
| 372 return interpolation.release(); | 372 return interpolation; |
| 373 break; | 373 break; |
| 374 } | 374 } |
| 375 | 375 |
| 376 case CSSPropertyBorderImageSlice: | 376 case CSSPropertyBorderImageSlice: |
| 377 case CSSPropertyWebkitMaskBoxImageSlice: { | 377 case CSSPropertyWebkitMaskBoxImageSlice: { |
| 378 RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpo lation::maybeCreate(*fromCSSValue, *toCSSValue, property); | 378 Interpolation* interpolation = ImageSliceStyleInterpolation::maybeCreate (*fromCSSValue, *toCSSValue, property); |
| 379 if (interpolation) | 379 if (interpolation) |
| 380 return interpolation.release(); | 380 return interpolation; |
| 381 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue , *toCSSValue)) | 381 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue , *toCSSValue)) |
| 382 forceDefaultInterpolation = true; | 382 forceDefaultInterpolation = true; |
| 383 | 383 |
| 384 break; | 384 break; |
| 385 } | 385 } |
| 386 | 386 |
| 387 case CSSPropertyStrokeDasharray: { | 387 case CSSPropertyStrokeDasharray: { |
| 388 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyl eInterpolation::maybeCreate(*fromCSSValue, *toCSSValue, property); | 388 Interpolation* interpolation = SVGStrokeDasharrayStyleInterpolation::may beCreate(*fromCSSValue, *toCSSValue, property); |
| 389 if (interpolation) | 389 if (interpolation) |
| 390 return interpolation.release(); | 390 return interpolation; |
| 391 | 391 |
| 392 break; | 392 break; |
| 393 } | 393 } |
| 394 | 394 |
| 395 case CSSPropertyWebkitFilter: { | 395 case CSSPropertyWebkitFilter: { |
| 396 RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolati on::maybeCreateList(*fromCSSValue, *toCSSValue, property); | 396 Interpolation* interpolation = FilterStyleInterpolation::maybeCreateList (*fromCSSValue, *toCSSValue, property); |
| 397 if (interpolation) | 397 if (interpolation) |
| 398 return interpolation.release(); | 398 return interpolation; |
| 399 | 399 |
| 400 // FIXME: Support drop shadow interpolation. | 400 // FIXME: Support drop shadow interpolation. |
| 401 fallBackToLegacy = true; | 401 fallBackToLegacy = true; |
| 402 break; | 402 break; |
| 403 } | 403 } |
| 404 | 404 |
| 405 default: | 405 default: |
| 406 // Fall back to LegacyStyleInterpolation. | 406 // Fall back to LegacyStyleInterpolation. |
| 407 fallBackToLegacy = true; | 407 fallBackToLegacy = true; |
| 408 break; | 408 break; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 420 if (fallBackToLegacy) { | 420 if (fallBackToLegacy) { |
| 421 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve( *fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleRe solve(*toCSSValue)) { | 421 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve( *fromCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleRe solve(*toCSSValue)) { |
| 422 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpola tion. | 422 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpola tion. |
| 423 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSV alue, property); | 423 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSV alue, property); |
| 424 } | 424 } |
| 425 | 425 |
| 426 // FIXME: Remove the use of AnimatableValues and Elements here. | 426 // FIXME: Remove the use of AnimatableValues and Elements here. |
| 427 ASSERT(element); | 427 ASSERT(element); |
| 428 populateAnimatableValue(property, *element, baseStyle); | 428 populateAnimatableValue(property, *element, baseStyle); |
| 429 end.populateAnimatableValue(property, *element, baseStyle); | 429 end.populateAnimatableValue(property, *element, baseStyle); |
| 430 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAni matableValue(), property); | 430 return LegacyStyleInterpolation::create(const_cast<AnimatableValue*>(get AnimatableValue()), const_cast<AnimatableValue*>(end.getAnimatableValue()), prop erty); |
| 431 } | 431 } |
| 432 | 432 |
| 433 ASSERT(AnimatableValue::usesDefaultInterpolation( | 433 ASSERT(AnimatableValue::usesDefaultInterpolation( |
| 434 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper ty, fromCSSValue).get(), | 434 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper ty, fromCSSValue), |
| 435 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper ty, toCSSValue).get())); | 435 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, proper ty, toCSSValue))); |
| 436 | 436 |
| 437 return nullptr; | 437 return nullptr; |
| 438 | 438 |
| 439 } | 439 } |
| 440 | 440 |
| 441 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr opertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction > easing) const | 441 Keyframe::PropertySpecificKeyframe* StringKeyframe::CSSPropertySpecificKeyframe: :neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const |
| 442 { | 442 { |
| 443 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, st atic_cast<CSSValue*>(0), EffectModel::CompositeAdd)); | 443 return new CSSPropertySpecificKeyframe(offset, easing, static_cast<CSSValue* >(0), EffectModel::CompositeAdd); |
| 444 } | 444 } |
| 445 | 445 |
| 446 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr opertySpecificKeyframe::cloneWithOffset(double offset) const | 446 Keyframe::PropertySpecificKeyframe* StringKeyframe::CSSPropertySpecificKeyframe: :cloneWithOffset(double offset) const |
| 447 { | 447 { |
| 448 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra me(offset, m_easing, m_value.get()); | 448 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra me(offset, m_easing, m_value.get()); |
| 449 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab leValueCache; | 449 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab leValueCache; |
| 450 return adoptPtrWillBeNoop(theClone); | 450 return theClone; |
| 451 } | 451 } |
| 452 | 452 |
| 453 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe) | 453 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe) |
| 454 { | 454 { |
| 455 visitor->trace(m_value); | 455 visitor->trace(m_value); |
| 456 visitor->trace(m_animatableValueCache); | 456 visitor->trace(m_animatableValueCache); |
| 457 Keyframe::PropertySpecificKeyframe::trace(visitor); | 457 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 458 } | 458 } |
| 459 | 459 |
| 460 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value, EffectModel::CompositeOperation op) | 460 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value, EffectModel::CompositeOperation op) |
| 461 : Keyframe::PropertySpecificKeyframe(offset, easing, op) | 461 : Keyframe::PropertySpecificKeyframe(offset, easing, op) |
| 462 , m_value(value) | 462 , m_value(value) |
| 463 { | 463 { |
| 464 } | 464 } |
| 465 | 465 |
| 466 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value) | 466 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value) |
| 467 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace) | 467 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace) |
| 468 , m_value(value) | 468 , m_value(value) |
| 469 { | 469 { |
| 470 ASSERT(!isNull(m_offset)); | 470 ASSERT(!isNull(m_offset)); |
| 471 } | 471 } |
| 472 | 472 |
| 473 DEFINE_TRACE(StringKeyframe::SVGPropertySpecificKeyframe) | 473 DEFINE_TRACE(StringKeyframe::SVGPropertySpecificKeyframe) |
| 474 { | 474 { |
| 475 Keyframe::PropertySpecificKeyframe::trace(visitor); | 475 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 476 } | 476 } |
| 477 | 477 |
| 478 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKe yframe::cloneWithOffset(double offset) const | 478 Keyframe::PropertySpecificKeyframe* SVGPropertySpecificKeyframe::cloneWithOffset (double offset) const |
| 479 { | 479 { |
| 480 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset, m_easing, m_value)); | 480 return new SVGPropertySpecificKeyframe(offset, m_easing, m_value); |
| 481 } | 481 } |
| 482 | 482 |
| 483 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKe yframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const | 483 Keyframe::PropertySpecificKeyframe* SVGPropertySpecificKeyframe::neutralKeyframe (double offset, PassRefPtr<TimingFunction> easing) const |
| 484 { | 484 { |
| 485 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset, easing, "" , EffectModel::CompositeAdd)); | 485 return new SVGPropertySpecificKeyframe(offset, easing, "", EffectModel::Comp ositeAdd); |
| 486 } | 486 } |
| 487 | 487 |
| 488 namespace { | 488 namespace { |
| 489 | 489 |
| 490 PassRefPtrWillBeRawPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fr omValue, SVGPropertyBase* toValue, SVGAnimatedPropertyBase* attribute) | 490 Interpolation* createSVGInterpolation(SVGPropertyBase* fromValue, SVGPropertyBas e* toValue, SVGAnimatedPropertyBase* attribute) |
| 491 { | 491 { |
| 492 RefPtrWillBeRawPtr<Interpolation> interpolation = nullptr; | 492 Interpolation* interpolation = nullptr; |
| 493 ASSERT(fromValue->type() == toValue->type()); | 493 ASSERT(fromValue->type() == toValue->type()); |
| 494 switch (fromValue->type()) { | 494 switch (fromValue->type()) { |
| 495 case AnimatedAngle: | 495 case AnimatedAngle: |
| 496 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola tion::canCreateFrom(toValue)) | 496 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola tion::canCreateFrom(toValue)) |
| 497 return AngleSVGInterpolation::create(fromValue, toValue, attribute); | 497 return AngleSVGInterpolation::create(fromValue, toValue, attribute); |
| 498 break; | 498 break; |
| 499 case AnimatedInteger: | 499 case AnimatedInteger: |
| 500 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); | 500 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); |
| 501 case AnimatedIntegerOptionalInteger: { | 501 case AnimatedIntegerOptionalInteger: { |
| 502 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; | 502 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 526 return RectSVGInterpolation::create(fromValue, toValue, attribute); | 526 return RectSVGInterpolation::create(fromValue, toValue, attribute); |
| 527 case AnimatedTransformList: | 527 case AnimatedTransformList: |
| 528 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr eate(fromValue, toValue, attribute); | 528 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr eate(fromValue, toValue, attribute); |
| 529 break; | 529 break; |
| 530 | 530 |
| 531 // TODO(ericwilligers): Support more animation types. | 531 // TODO(ericwilligers): Support more animation types. |
| 532 default: | 532 default: |
| 533 break; | 533 break; |
| 534 } | 534 } |
| 535 if (interpolation) | 535 if (interpolation) |
| 536 return interpolation.release(); | 536 return interpolation; |
| 537 | 537 |
| 538 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); | 538 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); |
| 539 } | 539 } |
| 540 | 540 |
| 541 } // namespace | 541 } // namespace |
| 542 | 542 |
| 543 PassRefPtrWillBeRawPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateIn terpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& e nd, Element* element, const ComputedStyle* baseStyle) const | 543 Interpolation* SVGPropertySpecificKeyframe::maybeCreateInterpolation(PropertyHan dle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, c onst ComputedStyle* baseStyle) const |
| 544 { | 544 { |
| 545 ASSERT(element); | 545 ASSERT(element); |
| 546 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(*propertyHandle.svgAttribute()); | 546 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(*propertyHandle.svgAttribute()); |
| 547 ASSERT(attribute); | 547 ASSERT(attribute); |
| 548 | 548 |
| 549 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); | 549 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); |
| 550 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 550 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 551 | 551 |
| 552 if (!fromValue || !toValue) | 552 if (!fromValue || !toValue) |
| 553 return nullptr; | 553 return nullptr; |
| 554 | 554 |
| 555 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); | 555 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); |
| 556 } | 556 } |
| 557 | 557 |
| 558 } // namespace blink | 558 } // namespace blink |
| OLD | NEW |