Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: Source/core/animation/StringKeyframe.cpp

Issue 1276183004: Oilpan: Unship oilpan from temporary animation objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 PropertyHandleSet properties; 80 PropertyHandleSet properties;
81 for (unsigned i = 0; i < m_propertySet->propertyCount(); ++i) 81 for (unsigned i = 0; i < m_propertySet->propertyCount(); ++i)
82 properties.add(PropertyHandle(m_propertySet->propertyAt(i).id())); 82 properties.add(PropertyHandle(m_propertySet->propertyAt(i).id()));
83 83
84 for (const auto& key: m_svgPropertyMap.keys()) 84 for (const auto& key: m_svgPropertyMap.keys())
85 properties.add(PropertyHandle(*key)); 85 properties.add(PropertyHandle(*key));
86 86
87 return properties; 87 return properties;
88 } 88 }
89 89
90 PassRefPtrWillBeRawPtr<Keyframe> StringKeyframe::clone() const 90 PassRefPtr<Keyframe> StringKeyframe::clone() const
91 { 91 {
92 return adoptRefWillBeNoop(new StringKeyframe(*this)); 92 return adoptRef(new StringKeyframe(*this));
93 } 93 }
94 94
95 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::creat ePropertySpecificKeyframe(PropertyHandle property) const 95 PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::createPropertySpe cificKeyframe(PropertyHandle property) const
96 { 96 {
97 if (property.isCSSProperty()) 97 if (property.isCSSProperty())
98 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset(), &eas ing(), cssPropertyValue(property.cssProperty()), composite())); 98 return adoptPtr(new CSSPropertySpecificKeyframe(offset(), &easing(), css PropertyValue(property.cssProperty()), composite()));
99 99
100 ASSERT(property.isSVGAttribute()); 100 ASSERT(property.isSVGAttribute());
101 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing( ), svgPropertyValue(*property.svgAttribute()), composite())); 101 return adoptPtr(new SVGPropertySpecificKeyframe(offset(), &easing(), svgProp ertyValue(*property.svgAttribute()), composite()));
102 }
103
104 DEFINE_TRACE(StringKeyframe)
105 {
106 visitor->trace(m_propertySet);
107 Keyframe::trace(visitor);
108 } 102 }
109 103
110 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi teOperation op) 104 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::Composi teOperation op)
111 : Keyframe::PropertySpecificKeyframe(offset, easing, op) 105 : Keyframe::PropertySpecificKeyframe(offset, easing, op)
112 , m_value(value) 106 , m_value(value)
113 { } 107 { }
114 108
115 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value) 109 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue* value)
116 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace) 110 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace)
117 , m_value(value) 111 , m_value(value)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 170 }
177 break; 171 break;
178 } 172 }
179 applicableTypes->append(new CSSValueInterpolationType(property)); 173 applicableTypes->append(new CSSValueInterpolationType(property));
180 applicableTypesMap.add(property, applicableTypes); 174 applicableTypesMap.add(property, applicableTypes);
181 return applicableTypes; 175 return applicableTypes;
182 } 176 }
183 177
184 } // namespace 178 } // namespace
185 179
186 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram e::createLegacyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpec ificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const 180 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::createLeg acyStyleInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe & end, Element* element, const ComputedStyle* baseStyle) const
187 { 181 {
188 CSSValue& fromCSSValue = *m_value.get(); 182 CSSValue& fromCSSValue = *m_value.get();
189 CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value(); 183 CSSValue& toCSSValue = *toCSSPropertySpecificKeyframe(end).value();
190 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(from CSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve (toCSSValue)) { 184 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(from CSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve (toCSSValue)) {
191 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation . 185 // FIXME: Handle these cases outside of DeferredLegacyStyleInterpolation .
192 return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSVal ue, property); 186 return DeferredLegacyStyleInterpolation::create(&fromCSSValue, &toCSSVal ue, property);
193 } 187 }
194 188
195 // FIXME: Remove the use of AnimatableValues and Elements here. 189 // FIXME: Remove the use of AnimatableValues and Elements here.
196 ASSERT(element); 190 ASSERT(element);
197 populateAnimatableValue(property, *element, baseStyle); 191 populateAnimatableValue(property, *element, baseStyle);
198 end.populateAnimatableValue(property, *element, baseStyle); 192 end.populateAnimatableValue(property, *element, baseStyle);
199 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimata bleValue(), property); 193 return LegacyStyleInterpolation::create(getAnimatableValue(), end.getAnimata bleValue(), property);
200 } 194 }
201 195
202 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const 196 PassRefPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyframe::maybeCrea teInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyfram e& end, Element* element, const ComputedStyle* baseStyle) const
203 { 197 {
204 CSSPropertyID property = propertyHandle.cssProperty(); 198 CSSPropertyID property = propertyHandle.cssProperty();
205 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor Property(property); 199 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor Property(property);
206 if (applicableTypes) 200 if (applicableTypes)
207 return InvalidatableStyleInterpolation::create(*applicableTypes, *this, toCSSPropertySpecificKeyframe(end)); 201 return InvalidatableStyleInterpolation::create(*applicableTypes, *this, toCSSPropertySpecificKeyframe(end));
208 202
209 // TODO(alancutter): Remove the remainder of this function. 203 // TODO(alancutter): Remove the remainder of this function.
210 204
211 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe ct, and a template parameter specific converter. 205 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe ct, and a template parameter specific converter.
212 CSSValue* fromCSSValue = m_value.get(); 206 CSSValue* fromCSSValue = m_value.get();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 case CSSPropertyFontSizeAdjust: 311 case CSSPropertyFontSizeAdjust:
318 case CSSPropertyOpacity: 312 case CSSPropertyOpacity:
319 case CSSPropertyStopOpacity: 313 case CSSPropertyStopOpacity:
320 case CSSPropertyStrokeOpacity: 314 case CSSPropertyStrokeOpacity:
321 case CSSPropertyStrokeMiterlimit: 315 case CSSPropertyStrokeMiterlimit:
322 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) 316 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue))
323 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, toCSSPrimitiveValue(fromCSSValue)->isNumber(), setRange(property)); 317 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, toCSSPrimitiveValue(fromCSSValue)->isNumber(), setRange(property));
324 break; 318 break;
325 319
326 case CSSPropertyMotionRotation: { 320 case CSSPropertyMotionRotation: {
327 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); 321 RefPtr<Interpolation> interpolation = DoubleStyleInterpolation::maybeCre ateFromMotionRotation(*fromCSSValue, *toCSSValue, property);
328 if (interpolation) 322 if (interpolation)
329 return interpolation.release(); 323 return interpolation.release();
330 break; 324 break;
331 } 325 }
332 case CSSPropertyVisibility: 326 case CSSPropertyVisibility:
333 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) 327 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue)))
334 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); 328 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property);
335 329
336 break; 330 break;
337 331
338 case CSSPropertyBackgroundColor: 332 case CSSPropertyBackgroundColor:
339 case CSSPropertyBorderBottomColor: 333 case CSSPropertyBorderBottomColor:
340 case CSSPropertyBorderLeftColor: 334 case CSSPropertyBorderLeftColor:
341 case CSSPropertyBorderRightColor: 335 case CSSPropertyBorderRightColor:
342 case CSSPropertyBorderTopColor: 336 case CSSPropertyBorderTopColor:
343 case CSSPropertyColor: 337 case CSSPropertyColor:
344 case CSSPropertyFill: 338 case CSSPropertyFill:
345 case CSSPropertyFloodColor: 339 case CSSPropertyFloodColor:
346 case CSSPropertyLightingColor: 340 case CSSPropertyLightingColor:
347 case CSSPropertyOutlineColor: 341 case CSSPropertyOutlineColor:
348 case CSSPropertyStopColor: 342 case CSSPropertyStopColor:
349 case CSSPropertyStroke: 343 case CSSPropertyStroke:
350 case CSSPropertyTextDecorationColor: 344 case CSSPropertyTextDecorationColor:
351 case CSSPropertyWebkitColumnRuleColor: 345 case CSSPropertyWebkitColumnRuleColor:
352 case CSSPropertyWebkitTextStrokeColor: 346 case CSSPropertyWebkitTextStrokeColor:
353 { 347 {
354 RefPtrWillBeRawPtr<Interpolation> interpolation = ColorStyleInterpol ation::maybeCreateFromColor(*fromCSSValue, *toCSSValue, property); 348 RefPtr<Interpolation> interpolation = ColorStyleInterpolation::maybe CreateFromColor(*fromCSSValue, *toCSSValue, property);
355 if (interpolation) 349 if (interpolation)
356 return interpolation.release(); 350 return interpolation.release();
357 351
358 // Current color should use LegacyStyleInterpolation 352 // Current color should use LegacyStyleInterpolation
359 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*from CSSValue, *toCSSValue)) 353 if (ColorStyleInterpolation::shouldUseLegacyStyleInterpolation(*from CSSValue, *toCSSValue))
360 return createLegacyStyleInterpolation(property, end, element, ba seStyle); 354 return createLegacyStyleInterpolation(property, end, element, ba seStyle);
361 355
362 break; 356 break;
363 } 357 }
364 358
(...skipping 11 matching lines...) Expand all
376 case CSSPropertyBorderBottomLeftRadius: 370 case CSSPropertyBorderBottomLeftRadius:
377 case CSSPropertyBorderBottomRightRadius: 371 case CSSPropertyBorderBottomRightRadius:
378 case CSSPropertyBorderTopLeftRadius: 372 case CSSPropertyBorderTopLeftRadius:
379 case CSSPropertyBorderTopRightRadius: 373 case CSSPropertyBorderTopRightRadius:
380 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length PairStyleInterpolation::canCreateFrom(*toCSSValue)) 374 if (LengthPairStyleInterpolation::canCreateFrom(*fromCSSValue) && Length PairStyleInterpolation::canCreateFrom(*toCSSValue))
381 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property, RangeNonNegative); 375 return LengthPairStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property, RangeNonNegative);
382 break; 376 break;
383 377
384 case CSSPropertyPerspectiveOrigin: 378 case CSSPropertyPerspectiveOrigin:
385 case CSSPropertyTransformOrigin: { 379 case CSSPropertyTransformOrigin: {
386 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty, range); 380 RefPtr<Interpolation> interpolation = ListStyleInterpolation<LengthStyle Interpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range) ;
387 if (interpolation) 381 if (interpolation)
388 return interpolation.release(); 382 return interpolation.release();
389 383
390 // FIXME: Handle keywords: top, right, left, center, bottom 384 // FIXME: Handle keywords: top, right, left, center, bottom
391 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 385 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
392 } 386 }
393 387
394 case CSSPropertyBoxShadow: 388 case CSSPropertyBoxShadow:
395 case CSSPropertyTextShadow: { 389 case CSSPropertyTextShadow: {
396 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <ShadowStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty); 390 RefPtr<Interpolation> interpolation = ListStyleInterpolation<ShadowStyle Interpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property);
397 if (interpolation) 391 if (interpolation)
398 return interpolation.release(); 392 return interpolation.release();
399 393
400 // FIXME: AnimatableShadow incorrectly animates between inset and non-in set values so it will never indicate it needs default interpolation 394 // FIXME: AnimatableShadow incorrectly animates between inset and non-in set values so it will never indicate it needs default interpolation
401 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu e, *toCSSValue)) { 395 if (ShadowStyleInterpolation::usesDefaultStyleInterpolation(*fromCSSValu e, *toCSSValue)) {
402 forceDefaultInterpolation = true; 396 forceDefaultInterpolation = true;
403 break; 397 break;
404 } 398 }
405 399
406 // FIXME: Handle interpolation from/to none, unspecified color values 400 // FIXME: Handle interpolation from/to none, unspecified color values
407 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 401 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
408 } 402 }
409 403
410 case CSSPropertyClip: { 404 case CSSPropertyClip: {
411 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue, *toCSSValue)) { 405 if (LengthBoxStyleInterpolation::usesDefaultInterpolation(*fromCSSValue, *toCSSValue)) {
412 forceDefaultInterpolation = true; 406 forceDefaultInterpolation = true;
413 break; 407 break;
414 } 408 }
415 RefPtrWillBeRawPtr<Interpolation> interpolation = LengthBoxStyleInterpol ation::maybeCreateFrom(*fromCSSValue, *toCSSValue, property); 409 RefPtr<Interpolation> interpolation = LengthBoxStyleInterpolation::maybe CreateFrom(*fromCSSValue, *toCSSValue, property);
416 if (interpolation) 410 if (interpolation)
417 return interpolation.release(); 411 return interpolation.release();
418 break; 412 break;
419 } 413 }
420 414
421 case CSSPropertyBorderImageSlice: 415 case CSSPropertyBorderImageSlice:
422 case CSSPropertyWebkitMaskBoxImageSlice: { 416 case CSSPropertyWebkitMaskBoxImageSlice: {
423 RefPtrWillBeRawPtr<Interpolation> interpolation = ImageSliceStyleInterpo lation::maybeCreate(*fromCSSValue, *toCSSValue, property); 417 RefPtr<Interpolation> interpolation = ImageSliceStyleInterpolation::mayb eCreate(*fromCSSValue, *toCSSValue, property);
424 if (interpolation) 418 if (interpolation)
425 return interpolation.release(); 419 return interpolation.release();
426 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue , *toCSSValue)) 420 if (ImageSliceStyleInterpolation::usesDefaultInterpolation(*fromCSSValue , *toCSSValue))
427 forceDefaultInterpolation = true; 421 forceDefaultInterpolation = true;
428 422
429 break; 423 break;
430 } 424 }
431 425
432 case CSSPropertyStrokeDasharray: { 426 case CSSPropertyStrokeDasharray: {
433 RefPtrWillBeRawPtr<Interpolation> interpolation = SVGStrokeDasharrayStyl eInterpolation::maybeCreate(*fromCSSValue, *toCSSValue, property); 427 RefPtr<Interpolation> interpolation = SVGStrokeDasharrayStyleInterpolati on::maybeCreate(*fromCSSValue, *toCSSValue, property);
434 if (interpolation) 428 if (interpolation)
435 return interpolation.release(); 429 return interpolation.release();
436 430
437 break; 431 break;
438 } 432 }
439 433
440 case CSSPropertyWebkitFilter: 434 case CSSPropertyWebkitFilter:
441 case CSSPropertyBackdropFilter: { 435 case CSSPropertyBackdropFilter: {
442 RefPtrWillBeRawPtr<Interpolation> interpolation = FilterStyleInterpolati on::maybeCreateList(*fromCSSValue, *toCSSValue, property); 436 RefPtr<Interpolation> interpolation = FilterStyleInterpolation::maybeCre ateList(*fromCSSValue, *toCSSValue, property);
443 if (interpolation) 437 if (interpolation)
444 return interpolation.release(); 438 return interpolation.release();
445 439
446 // FIXME: Support drop shadow interpolation. 440 // FIXME: Support drop shadow interpolation.
447 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 441 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
448 break; 442 break;
449 } 443 }
450 444
451 case CSSPropertyTranslate: { 445 case CSSPropertyTranslate: {
452 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <LengthStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty, range); 446 RefPtr<Interpolation> interpolation = ListStyleInterpolation<LengthStyle Interpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range) ;
453 if (interpolation) 447 if (interpolation)
454 return interpolation.release(); 448 return interpolation.release();
455 449
456 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length does not match. 450 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length does not match.
457 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 451 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
458 break; 452 break;
459 } 453 }
460 454
461 case CSSPropertyScale: { 455 case CSSPropertyScale: {
462 RefPtrWillBeRawPtr<Interpolation> interpolation = ListStyleInterpolation <DoubleStyleInterpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, prop erty, range); 456 RefPtr<Interpolation> interpolation = ListStyleInterpolation<DoubleStyle Interpolation>::maybeCreateFromList(*fromCSSValue, *toCSSValue, property, range) ;
463 if (interpolation) 457 if (interpolation)
464 return interpolation.release(); 458 return interpolation.release();
465 459
466 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length does not match. 460 // TODO(soonm): Legacy mode is used when from and to cssvaluelist length does not match.
467 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 461 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
468 break; 462 break;
469 } 463 }
470 464
471 default: 465 default:
472 // Fall back to LegacyStyleInterpolation. 466 // Fall back to LegacyStyleInterpolation.
473 return createLegacyStyleInterpolation(property, end, element, baseStyle) ; 467 return createLegacyStyleInterpolation(property, end, element, baseStyle) ;
474 break; 468 break;
475 } 469 }
476 470
477 if (fromCSSValue == toCSSValue) 471 if (fromCSSValue == toCSSValue)
478 return ConstantStyleInterpolation::create(fromCSSValue, property); 472 return ConstantStyleInterpolation::create(fromCSSValue, property);
479 473
480 if (!forceDefaultInterpolation) { 474 if (!forceDefaultInterpolation) {
481 ASSERT(AnimatableValue::usesDefaultInterpolation( 475 ASSERT(AnimatableValue::usesDefaultInterpolation(
482 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, pr operty, fromCSSValue).get(), 476 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, pr operty, fromCSSValue).get(),
483 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, pr operty, toCSSValue).get())); 477 StyleResolver::createAnimatableValueSnapshot(*element, baseStyle, pr operty, toCSSValue).get()));
484 } 478 }
485 479
486 return nullptr; 480 return nullptr;
487 481
488 } 482 }
489 483
490 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr opertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction > easing) const 484 PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecif icKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) co nst
491 { 485 {
492 return adoptPtrWillBeNoop(new CSSPropertySpecificKeyframe(offset, easing, st atic_cast<CSSValue*>(0), EffectModel::CompositeAdd)); 486 return adoptPtr(new CSSPropertySpecificKeyframe(offset, easing, static_cast< CSSValue*>(0), EffectModel::CompositeAdd));
493 } 487 }
494 488
495 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPr opertySpecificKeyframe::cloneWithOffset(double offset) const 489 PassOwnPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecif icKeyframe::cloneWithOffset(double offset) const
496 { 490 {
497 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra me(offset, m_easing, m_value.get()); 491 Keyframe::PropertySpecificKeyframe* theClone = new CSSPropertySpecificKeyfra me(offset, m_easing, m_value.get());
498 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab leValueCache; 492 toCSSPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_animatab leValueCache;
499 return adoptPtrWillBeNoop(theClone); 493 return adoptPtr(theClone);
500 }
501
502 DEFINE_TRACE(StringKeyframe::CSSPropertySpecificKeyframe)
503 {
504 visitor->trace(m_value);
505 visitor->trace(m_animatableValueCache);
506 Keyframe::PropertySpecificKeyframe::trace(visitor);
507 } 494 }
508 495
509 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value, EffectModel::CompositeOperation op) 496 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value, EffectModel::CompositeOperation op)
510 : Keyframe::PropertySpecificKeyframe(offset, easing, op) 497 : Keyframe::PropertySpecificKeyframe(offset, easing, op)
511 , m_value(value) 498 , m_value(value)
512 { 499 {
513 } 500 }
514 501
515 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value) 502 SVGPropertySpecificKeyframe::SVGPropertySpecificKeyframe(double offset, PassRefP tr<TimingFunction> easing, const String& value)
516 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace) 503 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR eplace)
517 , m_value(value) 504 , m_value(value)
518 { 505 {
519 ASSERT(!isNull(m_offset)); 506 ASSERT(!isNull(m_offset));
520 } 507 }
521 508
522 DEFINE_TRACE(StringKeyframe::SVGPropertySpecificKeyframe) 509 PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::clon eWithOffset(double offset) const
523 { 510 {
524 Keyframe::PropertySpecificKeyframe::trace(visitor); 511 return adoptPtr(new SVGPropertySpecificKeyframe(offset, m_easing, m_value));
525 } 512 }
526 513
527 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKe yframe::cloneWithOffset(double offset) const 514 PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
528 { 515 {
529 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset, m_easing, m_value)); 516 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, "", EffectMo del::CompositeAdd));
530 }
531
532 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKe yframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const
533 {
534 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset, easing, "" , EffectModel::CompositeAdd));
535 } 517 }
536 518
537 namespace { 519 namespace {
538 520
539 PassRefPtrWillBeRawPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fr omValue, SVGPropertyBase* toValue, SVGAnimatedPropertyBase* attribute) 521 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG PropertyBase* toValue, SVGAnimatedPropertyBase* attribute)
540 { 522 {
541 RefPtrWillBeRawPtr<Interpolation> interpolation = nullptr; 523 RefPtr<Interpolation> interpolation = nullptr;
542 ASSERT(fromValue->type() == toValue->type()); 524 ASSERT(fromValue->type() == toValue->type());
543 switch (fromValue->type()) { 525 switch (fromValue->type()) {
544 case AnimatedAngle: 526 case AnimatedAngle:
545 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola tion::canCreateFrom(toValue)) 527 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola tion::canCreateFrom(toValue))
546 return AngleSVGInterpolation::create(fromValue, toValue, attribute); 528 return AngleSVGInterpolation::create(fromValue, toValue, attribute);
547 break; 529 break;
548 case AnimatedInteger: 530 case AnimatedInteger:
549 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); 531 return IntegerSVGInterpolation::create(fromValue, toValue, attribute);
550 case AnimatedIntegerOptionalInteger: { 532 case AnimatedIntegerOptionalInteger: {
551 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; 533 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0;
(...skipping 30 matching lines...) Expand all
582 break; 564 break;
583 } 565 }
584 if (interpolation) 566 if (interpolation)
585 return interpolation.release(); 567 return interpolation.release();
586 568
587 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); 569 return DefaultSVGInterpolation::create(fromValue, toValue, attribute);
588 } 570 }
589 571
590 } // namespace 572 } // namespace
591 573
592 PassRefPtrWillBeRawPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateIn terpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& e nd, Element* element, const ComputedStyle* baseStyle) const 574 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation( PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const
593 { 575 {
594 ASSERT(element); 576 ASSERT(element);
595 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(*propertyHandle.svgAttribute()); 577 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute = toSVGElement(element )->propertyFromAttribute(*propertyHandle.svgAttribute());
596 ASSERT(attribute); 578 ASSERT(attribute);
597 579
598 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); 580 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value);
599 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); 581 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value());
600 582
601 if (!fromValue || !toValue) 583 if (!fromValue || !toValue)
602 return nullptr; 584 return nullptr;
603 585
604 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); 586 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( ));
605 } 587 }
606 588
607 } // namespace blink 589 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698