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/AngleSVGInterpolation.h" | 9 #include "core/animation/AngleSVGInterpolation.h" |
10 #include "core/animation/CSSColorInterpolationType.h" | 10 #include "core/animation/CSSColorInterpolationType.h" |
11 #include "core/animation/CSSImageInterpolationType.h" | 11 #include "core/animation/CSSImageInterpolationType.h" |
12 #include "core/animation/CSSImageListInterpolationType.h" | 12 #include "core/animation/CSSImageListInterpolationType.h" |
13 #include "core/animation/CSSLengthInterpolationType.h" | 13 #include "core/animation/CSSLengthInterpolationType.h" |
14 #include "core/animation/CSSNumberInterpolationType.h" | 14 #include "core/animation/CSSNumberInterpolationType.h" |
15 #include "core/animation/CSSPaintInterpolationType.h" | 15 #include "core/animation/CSSPaintInterpolationType.h" |
16 #include "core/animation/CSSShadowListInterpolationType.h" | 16 #include "core/animation/CSSShadowListInterpolationType.h" |
17 #include "core/animation/CSSValueInterpolationType.h" | 17 #include "core/animation/CSSValueInterpolationType.h" |
18 #include "core/animation/CompositorAnimations.h" | 18 #include "core/animation/CompositorAnimations.h" |
19 #include "core/animation/ConstantStyleInterpolation.h" | 19 #include "core/animation/ConstantStyleInterpolation.h" |
20 #include "core/animation/DefaultSVGInterpolation.h" | 20 #include "core/animation/DefaultSVGInterpolation.h" |
21 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 21 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
22 #include "core/animation/DoubleStyleInterpolation.h" | 22 #include "core/animation/DoubleStyleInterpolation.h" |
23 #include "core/animation/FilterStyleInterpolation.h" | 23 #include "core/animation/FilterStyleInterpolation.h" |
24 #include "core/animation/ImageSliceStyleInterpolation.h" | 24 #include "core/animation/ImageSliceStyleInterpolation.h" |
25 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" | |
26 #include "core/animation/IntegerSVGInterpolation.h" | 25 #include "core/animation/IntegerSVGInterpolation.h" |
27 #include "core/animation/InterpolationType.h" | 26 #include "core/animation/InterpolationType.h" |
28 #include "core/animation/InvalidatableInterpolation.h" | 27 #include "core/animation/InvalidatableInterpolation.h" |
29 #include "core/animation/LegacyStyleInterpolation.h" | 28 #include "core/animation/LegacyStyleInterpolation.h" |
30 #include "core/animation/LengthBoxStyleInterpolation.h" | 29 #include "core/animation/LengthBoxStyleInterpolation.h" |
31 #include "core/animation/LengthPairStyleInterpolation.h" | 30 #include "core/animation/LengthPairStyleInterpolation.h" |
32 #include "core/animation/LengthSVGInterpolation.h" | 31 #include "core/animation/LengthSVGInterpolation.h" |
33 #include "core/animation/LengthStyleInterpolation.h" | 32 #include "core/animation/LengthStyleInterpolation.h" |
34 #include "core/animation/ListSVGInterpolation.h" | 33 #include "core/animation/ListSVGInterpolation.h" |
35 #include "core/animation/ListStyleInterpolation.h" | 34 #include "core/animation/ListStyleInterpolation.h" |
36 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" | 35 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" |
37 #include "core/animation/NumberSVGInterpolation.h" | 36 #include "core/animation/NumberSVGInterpolation.h" |
38 #include "core/animation/PathSVGInterpolation.h" | 37 #include "core/animation/PathSVGInterpolation.h" |
39 #include "core/animation/PointSVGInterpolation.h" | 38 #include "core/animation/PointSVGInterpolation.h" |
40 #include "core/animation/RectSVGInterpolation.h" | 39 #include "core/animation/RectSVGInterpolation.h" |
41 #include "core/animation/SVGAngleInterpolationType.h" | 40 #include "core/animation/SVGAngleInterpolationType.h" |
| 41 #include "core/animation/SVGIntegerOptionalIntegerInterpolationType.h" |
42 #include "core/animation/SVGNumberInterpolationType.h" | 42 #include "core/animation/SVGNumberInterpolationType.h" |
43 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" | 43 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
44 #include "core/animation/SVGValueInterpolationType.h" | 44 #include "core/animation/SVGValueInterpolationType.h" |
45 #include "core/animation/TransformSVGInterpolation.h" | 45 #include "core/animation/TransformSVGInterpolation.h" |
46 #include "core/animation/VisibilityStyleInterpolation.h" | 46 #include "core/animation/VisibilityStyleInterpolation.h" |
47 #include "core/animation/css/CSSAnimations.h" | 47 #include "core/animation/css/CSSAnimations.h" |
48 #include "core/css/CSSPropertyMetadata.h" | 48 #include "core/css/CSSPropertyMetadata.h" |
49 #include "core/css/resolver/StyleResolver.h" | 49 #include "core/css/resolver/StyleResolver.h" |
50 #include "core/style/ComputedStyle.h" | 50 #include "core/style/ComputedStyle.h" |
51 #include "core/svg/SVGElement.h" | 51 #include "core/svg/SVGElement.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 || attribute == SVGNames::stitchTilesAttr | 315 || attribute == SVGNames::stitchTilesAttr |
316 || attribute == SVGNames::targetAttr | 316 || attribute == SVGNames::targetAttr |
317 || attribute == SVGNames::typeAttr | 317 || attribute == SVGNames::typeAttr |
318 || attribute == SVGNames::xChannelSelectorAttr | 318 || attribute == SVGNames::xChannelSelectorAttr |
319 || attribute == SVGNames::yChannelSelectorAttr | 319 || attribute == SVGNames::yChannelSelectorAttr |
320 || attribute == XLinkNames::hrefAttr) { | 320 || attribute == XLinkNames::hrefAttr) { |
321 // Use default SVGValueInterpolationType. | 321 // Use default SVGValueInterpolationType. |
322 applicableTypes->append(new SVGValueInterpolationType(attribute)); | 322 applicableTypes->append(new SVGValueInterpolationType(attribute)); |
323 } else if (attribute == SVGNames::orientAttr) { | 323 } else if (attribute == SVGNames::orientAttr) { |
324 applicableTypes->append(new SVGAngleInterpolationType(attribute)); | 324 applicableTypes->append(new SVGAngleInterpolationType(attribute)); |
| 325 } else if (attribute == SVGNames::orderAttr) { |
| 326 applicableTypes->append(new SVGIntegerOptionalIntegerInterpolationTy
pe(attribute)); |
325 } else { | 327 } else { |
326 fallbackToLegacy = true; | 328 fallbackToLegacy = true; |
327 } | 329 } |
328 | 330 |
329 if (!fallbackToLegacy) | 331 if (!fallbackToLegacy) |
330 applicableTypes->append(new SVGValueInterpolationType(attribute)); | 332 applicableTypes->append(new SVGValueInterpolationType(attribute)); |
331 } | 333 } |
332 | 334 |
333 if (fallbackToLegacy) { | 335 if (fallbackToLegacy) { |
334 delete applicableTypes; | 336 delete applicableTypes; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 555 |
554 namespace { | 556 namespace { |
555 | 557 |
556 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) | 558 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) |
557 { | 559 { |
558 RefPtr<Interpolation> interpolation = nullptr; | 560 RefPtr<Interpolation> interpolation = nullptr; |
559 ASSERT(fromValue->type() == toValue->type()); | 561 ASSERT(fromValue->type() == toValue->type()); |
560 switch (fromValue->type()) { | 562 switch (fromValue->type()) { |
561 case AnimatedInteger: | 563 case AnimatedInteger: |
562 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); | 564 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); |
563 case AnimatedIntegerOptionalInteger: { | |
564 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; | |
565 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue
, attribute, min); | |
566 } | |
567 case AnimatedLength: | 565 case AnimatedLength: |
568 return LengthSVGInterpolation::create(fromValue, toValue, attribute); | 566 return LengthSVGInterpolation::create(fromValue, toValue, attribute); |
569 case AnimatedLengthList: | 567 case AnimatedLengthList: |
570 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); | 568 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
571 break; | 569 break; |
572 case AnimatedNumberOptionalNumber: | 570 case AnimatedNumberOptionalNumber: |
573 return NumberOptionalNumberSVGInterpolation::create(fromValue, toValue,
attribute); | 571 return NumberOptionalNumberSVGInterpolation::create(fromValue, toValue,
attribute); |
574 case AnimatedNumberList: | 572 case AnimatedNumberList: |
575 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); | 573 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
576 break; | 574 break; |
577 case AnimatedPath: | 575 case AnimatedPath: |
578 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at
tribute); | 576 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at
tribute); |
579 break; | 577 break; |
580 case AnimatedPoints: | 578 case AnimatedPoints: |
581 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate
(fromValue, toValue, attribute); | 579 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate
(fromValue, toValue, attribute); |
582 break; | 580 break; |
583 case AnimatedRect: | 581 case AnimatedRect: |
584 return RectSVGInterpolation::create(fromValue, toValue, attribute); | 582 return RectSVGInterpolation::create(fromValue, toValue, attribute); |
585 case AnimatedTransformList: | 583 case AnimatedTransformList: |
586 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr
eate(fromValue, toValue, attribute); | 584 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr
eate(fromValue, toValue, attribute); |
587 break; | 585 break; |
588 | 586 |
589 // Handled by SVGInterpolationTypes. | 587 // Handled by SVGInterpolationTypes. |
590 case AnimatedAngle: | 588 case AnimatedAngle: |
591 case AnimatedNumber: | 589 case AnimatedNumber: |
| 590 case AnimatedIntegerOptionalInteger: |
592 ASSERT_NOT_REACHED(); | 591 ASSERT_NOT_REACHED(); |
593 // Fallthrough. | 592 // Fallthrough. |
594 | 593 |
595 // TODO(ericwilligers): Support more animation types. | 594 // TODO(ericwilligers): Support more animation types. |
596 default: | 595 default: |
597 break; | 596 break; |
598 } | 597 } |
599 if (interpolation) | 598 if (interpolation) |
600 return interpolation.release(); | 599 return interpolation.release(); |
601 | 600 |
(...skipping 15 matching lines...) Expand all Loading... |
617 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 616 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
618 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 617 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
619 | 618 |
620 if (!fromValue || !toValue) | 619 if (!fromValue || !toValue) |
621 return nullptr; | 620 return nullptr; |
622 | 621 |
623 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 622 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
624 } | 623 } |
625 | 624 |
626 } // namespace blink | 625 } // namespace blink |
OLD | NEW |