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" |
11 #include "core/animation/ConstantStyleInterpolation.h" | 11 #include "core/animation/ConstantStyleInterpolation.h" |
12 #include "core/animation/DefaultSVGInterpolation.h" | 12 #include "core/animation/DefaultSVGInterpolation.h" |
13 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 13 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
14 #include "core/animation/DoubleStyleInterpolation.h" | 14 #include "core/animation/DoubleStyleInterpolation.h" |
15 #include "core/animation/ImageSliceStyleInterpolation.h" | 15 #include "core/animation/ImageSliceStyleInterpolation.h" |
16 #include "core/animation/ImageStyleInterpolation.h" | 16 #include "core/animation/ImageStyleInterpolation.h" |
17 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" | 17 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" |
18 #include "core/animation/LegacyStyleInterpolation.h" | 18 #include "core/animation/LegacyStyleInterpolation.h" |
19 #include "core/animation/LengthBoxStyleInterpolation.h" | 19 #include "core/animation/LengthBoxStyleInterpolation.h" |
20 #include "core/animation/LengthPairStyleInterpolation.h" | 20 #include "core/animation/LengthPairStyleInterpolation.h" |
21 #include "core/animation/LengthStyleInterpolation.h" | 21 #include "core/animation/LengthStyleInterpolation.h" |
22 #include "core/animation/ListSVGInterpolation.h" | 22 #include "core/animation/ListSVGInterpolation.h" |
23 #include "core/animation/ListStyleInterpolation.h" | 23 #include "core/animation/ListStyleInterpolation.h" |
| 24 #include "core/animation/NumberSVGInterpolation.h" |
24 #include "core/animation/PointSVGInterpolation.h" | 25 #include "core/animation/PointSVGInterpolation.h" |
25 #include "core/animation/RectSVGInterpolation.h" | 26 #include "core/animation/RectSVGInterpolation.h" |
26 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" | 27 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
27 #include "core/animation/ShadowStyleInterpolation.h" | 28 #include "core/animation/ShadowStyleInterpolation.h" |
28 #include "core/animation/VisibilityStyleInterpolation.h" | 29 #include "core/animation/VisibilityStyleInterpolation.h" |
29 #include "core/animation/css/CSSAnimations.h" | 30 #include "core/animation/css/CSSAnimations.h" |
30 #include "core/css/CSSPropertyMetadata.h" | 31 #include "core/css/CSSPropertyMetadata.h" |
31 #include "core/css/resolver/StyleResolver.h" | 32 #include "core/css/resolver/StyleResolver.h" |
32 #include "core/style/ComputedStyle.h" | 33 #include "core/style/ComputedStyle.h" |
33 #include "core/svg/SVGElement.h" | 34 #include "core/svg/SVGElement.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 474 |
474 PassRefPtrWillBeRawPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fr
omValue, SVGPropertyBase* toValue, SVGAnimatedPropertyBase* attribute) | 475 PassRefPtrWillBeRawPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fr
omValue, SVGPropertyBase* toValue, SVGAnimatedPropertyBase* attribute) |
475 { | 476 { |
476 RefPtrWillBeRawPtr<Interpolation> interpolation = nullptr; | 477 RefPtrWillBeRawPtr<Interpolation> interpolation = nullptr; |
477 ASSERT(fromValue->type() == toValue->type()); | 478 ASSERT(fromValue->type() == toValue->type()); |
478 switch (fromValue->type()) { | 479 switch (fromValue->type()) { |
479 case AnimatedAngle: | 480 case AnimatedAngle: |
480 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola
tion::canCreateFrom(toValue)) | 481 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola
tion::canCreateFrom(toValue)) |
481 return AngleSVGInterpolation::create(fromValue, toValue, attribute); | 482 return AngleSVGInterpolation::create(fromValue, toValue, attribute); |
482 break; | 483 break; |
483 case AnimatedIntegerOptionalInteger: | 484 case AnimatedIntegerOptionalInteger: { |
484 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue
, attribute); | 485 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; |
| 486 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue
, attribute, min); |
| 487 } |
| 488 case AnimatedNumber: { |
| 489 SVGNumberNegativeValuesMode negativeValuesMode = &attribute->attributeNa
me() == &SVGNames::pathLengthAttr ? ForbidNegativeNumbers : AllowNegativeNumbers
; |
| 490 return NumberSVGInterpolation::create(fromValue, toValue, attribute, neg
ativeValuesMode); |
| 491 } |
| 492 case AnimatedNumberList: |
| 493 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
| 494 break; |
485 case AnimatedPoints: | 495 case AnimatedPoints: |
486 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate
(fromValue, toValue, attribute); | 496 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate
(fromValue, toValue, attribute); |
487 break; | 497 break; |
488 case AnimatedRect: | 498 case AnimatedRect: |
489 return RectSVGInterpolation::create(fromValue, toValue, attribute); | 499 return RectSVGInterpolation::create(fromValue, toValue, attribute); |
490 | 500 |
491 // TODO(ericwilligers): Support more animation types. | 501 // TODO(ericwilligers): Support more animation types. |
492 default: | 502 default: |
493 break; | 503 break; |
494 } | 504 } |
(...skipping 14 matching lines...) Expand all Loading... |
509 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 519 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
510 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 520 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
511 | 521 |
512 if (!fromValue || !toValue) | 522 if (!fromValue || !toValue) |
513 return nullptr; | 523 return nullptr; |
514 | 524 |
515 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 525 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
516 } | 526 } |
517 | 527 |
518 } | 528 } |
OLD | NEW |