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/XLinkNames.h" | 8 #include "core/XLinkNames.h" |
9 #include "core/animation/CSSColorInterpolationType.h" | 9 #include "core/animation/CSSColorInterpolationType.h" |
10 #include "core/animation/CSSImageInterpolationType.h" | 10 #include "core/animation/CSSImageInterpolationType.h" |
11 #include "core/animation/CSSImageListInterpolationType.h" | 11 #include "core/animation/CSSImageListInterpolationType.h" |
12 #include "core/animation/CSSLengthInterpolationType.h" | 12 #include "core/animation/CSSLengthInterpolationType.h" |
13 #include "core/animation/CSSNumberInterpolationType.h" | 13 #include "core/animation/CSSNumberInterpolationType.h" |
14 #include "core/animation/CSSPaintInterpolationType.h" | 14 #include "core/animation/CSSPaintInterpolationType.h" |
15 #include "core/animation/CSSShadowListInterpolationType.h" | 15 #include "core/animation/CSSShadowListInterpolationType.h" |
16 #include "core/animation/CSSValueInterpolationType.h" | 16 #include "core/animation/CSSValueInterpolationType.h" |
17 #include "core/animation/CompositorAnimations.h" | 17 #include "core/animation/CompositorAnimations.h" |
18 #include "core/animation/ConstantStyleInterpolation.h" | 18 #include "core/animation/ConstantStyleInterpolation.h" |
19 #include "core/animation/DefaultSVGInterpolation.h" | 19 #include "core/animation/DefaultSVGInterpolation.h" |
20 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 20 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
21 #include "core/animation/DoubleStyleInterpolation.h" | 21 #include "core/animation/DoubleStyleInterpolation.h" |
22 #include "core/animation/FilterStyleInterpolation.h" | 22 #include "core/animation/FilterStyleInterpolation.h" |
23 #include "core/animation/ImageSliceStyleInterpolation.h" | 23 #include "core/animation/ImageSliceStyleInterpolation.h" |
24 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" | |
25 #include "core/animation/InterpolationType.h" | 24 #include "core/animation/InterpolationType.h" |
26 #include "core/animation/InvalidatableInterpolation.h" | 25 #include "core/animation/InvalidatableInterpolation.h" |
27 #include "core/animation/LegacyStyleInterpolation.h" | 26 #include "core/animation/LegacyStyleInterpolation.h" |
28 #include "core/animation/LengthBoxStyleInterpolation.h" | 27 #include "core/animation/LengthBoxStyleInterpolation.h" |
29 #include "core/animation/LengthPairStyleInterpolation.h" | 28 #include "core/animation/LengthPairStyleInterpolation.h" |
30 #include "core/animation/LengthSVGInterpolation.h" | 29 #include "core/animation/LengthSVGInterpolation.h" |
31 #include "core/animation/LengthStyleInterpolation.h" | 30 #include "core/animation/LengthStyleInterpolation.h" |
32 #include "core/animation/ListSVGInterpolation.h" | 31 #include "core/animation/ListSVGInterpolation.h" |
33 #include "core/animation/ListStyleInterpolation.h" | 32 #include "core/animation/ListStyleInterpolation.h" |
34 #include "core/animation/NumberSVGInterpolation.h" | 33 #include "core/animation/NumberSVGInterpolation.h" |
35 #include "core/animation/PathSVGInterpolation.h" | 34 #include "core/animation/PathSVGInterpolation.h" |
36 #include "core/animation/RectSVGInterpolation.h" | 35 #include "core/animation/RectSVGInterpolation.h" |
37 #include "core/animation/SVGAngleInterpolationType.h" | 36 #include "core/animation/SVGAngleInterpolationType.h" |
38 #include "core/animation/SVGIntegerInterpolationType.h" | 37 #include "core/animation/SVGIntegerInterpolationType.h" |
| 38 #include "core/animation/SVGIntegerOptionalIntegerInterpolationType.h" |
39 #include "core/animation/SVGNumberInterpolationType.h" | 39 #include "core/animation/SVGNumberInterpolationType.h" |
40 #include "core/animation/SVGNumberOptionalNumberInterpolationType.h" | 40 #include "core/animation/SVGNumberOptionalNumberInterpolationType.h" |
41 #include "core/animation/SVGPointListInterpolationType.h" | 41 #include "core/animation/SVGPointListInterpolationType.h" |
42 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" | 42 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
43 #include "core/animation/SVGValueInterpolationType.h" | 43 #include "core/animation/SVGValueInterpolationType.h" |
44 #include "core/animation/TransformSVGInterpolation.h" | 44 #include "core/animation/TransformSVGInterpolation.h" |
45 #include "core/animation/VisibilityStyleInterpolation.h" | 45 #include "core/animation/VisibilityStyleInterpolation.h" |
46 #include "core/animation/css/CSSAnimations.h" | 46 #include "core/animation/css/CSSAnimations.h" |
47 #include "core/css/CSSPropertyMetadata.h" | 47 #include "core/css/CSSPropertyMetadata.h" |
48 #include "core/css/resolver/StyleResolver.h" | 48 #include "core/css/resolver/StyleResolver.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 applicableTypes->append(adoptPtr(new CSSValueInterpolationType(cssPr
operty))); | 265 applicableTypes->append(adoptPtr(new CSSValueInterpolationType(cssPr
operty))); |
266 | 266 |
267 } else { | 267 } else { |
268 const QualifiedName& attribute = property.svgAttribute(); | 268 const QualifiedName& attribute = property.svgAttribute(); |
269 if (attribute == SVGNames::orientAttr) { | 269 if (attribute == SVGNames::orientAttr) { |
270 applicableTypes->append(adoptPtr(new SVGAngleInterpolationType(attri
bute))); | 270 applicableTypes->append(adoptPtr(new SVGAngleInterpolationType(attri
bute))); |
271 } else if (attribute == SVGNames::numOctavesAttr | 271 } else if (attribute == SVGNames::numOctavesAttr |
272 || attribute == SVGNames::targetXAttr | 272 || attribute == SVGNames::targetXAttr |
273 || attribute == SVGNames::targetYAttr) { | 273 || attribute == SVGNames::targetYAttr) { |
274 applicableTypes->append(adoptPtr(new SVGIntegerInterpolationType(att
ribute))); | 274 applicableTypes->append(adoptPtr(new SVGIntegerInterpolationType(att
ribute))); |
| 275 } else if (attribute == SVGNames::orderAttr) { |
| 276 applicableTypes->append(adoptPtr(new SVGIntegerOptionalIntegerInterp
olationType(attribute))); |
275 } else if (attribute == SVGNames::amplitudeAttr | 277 } else if (attribute == SVGNames::amplitudeAttr |
276 || attribute == SVGNames::azimuthAttr | 278 || attribute == SVGNames::azimuthAttr |
277 || attribute == SVGNames::biasAttr | 279 || attribute == SVGNames::biasAttr |
278 || attribute == SVGNames::diffuseConstantAttr | 280 || attribute == SVGNames::diffuseConstantAttr |
279 || attribute == SVGNames::divisorAttr | 281 || attribute == SVGNames::divisorAttr |
280 || attribute == SVGNames::elevationAttr | 282 || attribute == SVGNames::elevationAttr |
281 || attribute == SVGNames::exponentAttr | 283 || attribute == SVGNames::exponentAttr |
282 || attribute == SVGNames::interceptAttr | 284 || attribute == SVGNames::interceptAttr |
283 || attribute == SVGNames::k1Attr | 285 || attribute == SVGNames::k1Attr |
284 || attribute == SVGNames::k2Attr | 286 || attribute == SVGNames::k2Attr |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), Ef
fectModel::CompositeAdd)); | 559 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), Ef
fectModel::CompositeAdd)); |
558 } | 560 } |
559 | 561 |
560 namespace { | 562 namespace { |
561 | 563 |
562 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) | 564 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) |
563 { | 565 { |
564 RefPtr<Interpolation> interpolation = nullptr; | 566 RefPtr<Interpolation> interpolation = nullptr; |
565 ASSERT(fromValue->type() == toValue->type()); | 567 ASSERT(fromValue->type() == toValue->type()); |
566 switch (fromValue->type()) { | 568 switch (fromValue->type()) { |
567 case AnimatedIntegerOptionalInteger: { | |
568 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; | |
569 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue
, attribute, min); | |
570 } | |
571 case AnimatedLength: | 569 case AnimatedLength: |
572 return LengthSVGInterpolation::create(fromValue, toValue, attribute); | 570 return LengthSVGInterpolation::create(fromValue, toValue, attribute); |
573 case AnimatedLengthList: | 571 case AnimatedLengthList: |
574 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); | 572 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
575 break; | 573 break; |
576 case AnimatedNumberList: | 574 case AnimatedNumberList: |
577 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); | 575 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
578 break; | 576 break; |
579 case AnimatedPath: | 577 case AnimatedPath: |
580 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at
tribute); | 578 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at
tribute); |
581 break; | 579 break; |
582 case AnimatedRect: | 580 case AnimatedRect: |
583 return RectSVGInterpolation::create(fromValue, toValue, attribute); | 581 return RectSVGInterpolation::create(fromValue, toValue, attribute); |
584 case AnimatedTransformList: | 582 case AnimatedTransformList: |
585 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr
eate(fromValue, toValue, attribute); | 583 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr
eate(fromValue, toValue, attribute); |
586 break; | 584 break; |
587 | 585 |
588 // Handled by SVGInterpolationTypes. | 586 // Handled by SVGInterpolationTypes. |
589 case AnimatedAngle: | 587 case AnimatedAngle: |
590 case AnimatedInteger: | 588 case AnimatedInteger: |
| 589 case AnimatedIntegerOptionalInteger: |
591 case AnimatedNumber: | 590 case AnimatedNumber: |
592 case AnimatedNumberOptionalNumber: | 591 case AnimatedNumberOptionalNumber: |
593 case AnimatedPoints: | 592 case AnimatedPoints: |
594 ASSERT_NOT_REACHED(); | 593 ASSERT_NOT_REACHED(); |
595 // Fallthrough. | 594 // Fallthrough. |
596 | 595 |
597 // TODO(ericwilligers): Support more animation types. | 596 // TODO(ericwilligers): Support more animation types. |
598 default: | 597 default: |
599 break; | 598 break; |
600 } | 599 } |
(...skipping 18 matching lines...) Expand all Loading... |
619 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 618 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
620 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 619 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
621 | 620 |
622 if (!fromValue || !toValue) | 621 if (!fromValue || !toValue) |
623 return nullptr; | 622 return nullptr; |
624 | 623 |
625 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 624 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
626 } | 625 } |
627 | 626 |
628 } // namespace blink | 627 } // namespace blink |
OLD | NEW |