| 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 "core/animation/StringKeyframe.h" | 5 #include "core/animation/StringKeyframe.h" |
| 6 | 6 |
| 7 #include "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
| 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/CSSFontWeightInterpolationType.h" | 10 #include "core/animation/CSSFontWeightInterpolationType.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/CSSLengthListInterpolationType.h" | 14 #include "core/animation/CSSLengthListInterpolationType.h" |
| 15 #include "core/animation/CSSNumberInterpolationType.h" | 15 #include "core/animation/CSSNumberInterpolationType.h" |
| 16 #include "core/animation/CSSPaintInterpolationType.h" | 16 #include "core/animation/CSSPaintInterpolationType.h" |
| 17 #include "core/animation/CSSPathInterpolationType.h" | 17 #include "core/animation/CSSPathInterpolationType.h" |
| 18 #include "core/animation/CSSShadowListInterpolationType.h" | 18 #include "core/animation/CSSShadowListInterpolationType.h" |
| 19 #include "core/animation/CSSValueInterpolationType.h" | 19 #include "core/animation/CSSValueInterpolationType.h" |
| 20 #include "core/animation/CSSVisibilityInterpolationType.h" | 20 #include "core/animation/CSSVisibilityInterpolationType.h" |
| 21 #include "core/animation/CompositorAnimations.h" | 21 #include "core/animation/CompositorAnimations.h" |
| 22 #include "core/animation/ConstantStyleInterpolation.h" | 22 #include "core/animation/ConstantStyleInterpolation.h" |
| 23 #include "core/animation/DefaultSVGInterpolation.h" | |
| 24 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 23 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
| 25 #include "core/animation/DoubleStyleInterpolation.h" | 24 #include "core/animation/DoubleStyleInterpolation.h" |
| 26 #include "core/animation/FilterStyleInterpolation.h" | 25 #include "core/animation/FilterStyleInterpolation.h" |
| 27 #include "core/animation/ImageSliceStyleInterpolation.h" | 26 #include "core/animation/ImageSliceStyleInterpolation.h" |
| 28 #include "core/animation/InterpolationType.h" | 27 #include "core/animation/InterpolationType.h" |
| 29 #include "core/animation/InvalidatableInterpolation.h" | 28 #include "core/animation/InvalidatableInterpolation.h" |
| 30 #include "core/animation/LegacyStyleInterpolation.h" | 29 #include "core/animation/LegacyStyleInterpolation.h" |
| 31 #include "core/animation/LengthBoxStyleInterpolation.h" | 30 #include "core/animation/LengthBoxStyleInterpolation.h" |
| 32 #include "core/animation/LengthPairStyleInterpolation.h" | 31 #include "core/animation/LengthPairStyleInterpolation.h" |
| 33 #include "core/animation/LengthStyleInterpolation.h" | 32 #include "core/animation/LengthStyleInterpolation.h" |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::clon
eWithOffset(double offset) const | 617 PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::clon
eWithOffset(double offset) const |
| 619 { | 618 { |
| 620 return adoptPtr(new SVGPropertySpecificKeyframe(offset, m_easing, m_value)); | 619 return adoptPtr(new SVGPropertySpecificKeyframe(offset, m_easing, m_value)); |
| 621 } | 620 } |
| 622 | 621 |
| 623 PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut
ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const | 622 PassOwnPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut
ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const |
| 624 { | 623 { |
| 625 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), Ef
fectModel::CompositeAdd)); | 624 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), Ef
fectModel::CompositeAdd)); |
| 626 } | 625 } |
| 627 | 626 |
| 628 namespace { | 627 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation(
PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*
, const ComputedStyle*) const |
| 629 | |
| 630 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) | |
| 631 { | |
| 632 RefPtr<Interpolation> interpolation = nullptr; | |
| 633 ASSERT(fromValue->type() == toValue->type()); | |
| 634 switch (fromValue->type()) { | |
| 635 // Handled by SVGInterpolationTypes. | |
| 636 case AnimatedAngle: | |
| 637 case AnimatedInteger: | |
| 638 case AnimatedIntegerOptionalInteger: | |
| 639 case AnimatedLength: | |
| 640 case AnimatedLengthList: | |
| 641 case AnimatedNumber: | |
| 642 case AnimatedNumberList: | |
| 643 case AnimatedNumberOptionalNumber: | |
| 644 case AnimatedPath: | |
| 645 case AnimatedPoints: | |
| 646 case AnimatedRect: | |
| 647 case AnimatedTransformList: | |
| 648 ASSERT_NOT_REACHED(); | |
| 649 // Fallthrough. | |
| 650 | |
| 651 // TODO(ericwilligers): Support more animation types. | |
| 652 default: | |
| 653 break; | |
| 654 } | |
| 655 if (interpolation) | |
| 656 return interpolation.release(); | |
| 657 | |
| 658 return DefaultSVGInterpolation::create(fromValue, toValue, attribute); | |
| 659 } | |
| 660 | |
| 661 } // namespace | |
| 662 | |
| 663 PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation(
PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*
element, const ComputedStyle* baseStyle) const | |
| 664 { | 628 { |
| 665 const InterpolationTypes* applicableTypes = applicableTypesForProperty(prope
rtyHandle); | 629 const InterpolationTypes* applicableTypes = applicableTypesForProperty(prope
rtyHandle); |
| 666 if (applicableTypes) | 630 ASSERT(applicableTypes); |
| 667 return InvalidatableInterpolation::create(propertyHandle, *applicableTyp
es, *this, end); | 631 return InvalidatableInterpolation::create(propertyHandle, *applicableTypes,
*this, end); |
| 668 | |
| 669 ASSERT(element); | |
| 670 SVGAnimatedPropertyBase* attribute = toSVGElement(element)->propertyFromAttr
ibute(propertyHandle.svgAttribute()); | |
| 671 ASSERT(attribute); | |
| 672 | |
| 673 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | |
| 674 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | |
| 675 | |
| 676 if (!fromValue || !toValue) | |
| 677 return nullptr; | |
| 678 | |
| 679 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute); | |
| 680 } | 632 } |
| 681 | 633 |
| 682 } // namespace blink | 634 } // namespace blink |
| OLD | NEW |