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

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

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

Powered by Google App Engine
This is Rietveld 408576698