| 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" | 25 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" |
| 26 #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" |
| 40 #include "core/animation/SVGIntegerInterpolationType.h" |
| 41 #include "core/animation/SVGNumberInterpolationType.h" | 41 #include "core/animation/SVGNumberInterpolationType.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" |
| 49 #include "core/style/ComputedStyle.h" | 49 #include "core/style/ComputedStyle.h" |
| 50 #include "core/svg/SVGElement.h" | 50 #include "core/svg/SVGElement.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 || attribute == SVGNames::pointsAtYAttr | 282 || attribute == SVGNames::pointsAtYAttr |
| 283 || attribute == SVGNames::pointsAtZAttr | 283 || attribute == SVGNames::pointsAtZAttr |
| 284 || attribute == SVGNames::scaleAttr | 284 || attribute == SVGNames::scaleAttr |
| 285 || attribute == SVGNames::seedAttr | 285 || attribute == SVGNames::seedAttr |
| 286 || attribute == SVGNames::slopeAttr | 286 || attribute == SVGNames::slopeAttr |
| 287 || attribute == SVGNames::specularConstantAttr | 287 || attribute == SVGNames::specularConstantAttr |
| 288 || attribute == SVGNames::specularExponentAttr | 288 || attribute == SVGNames::specularExponentAttr |
| 289 || attribute == SVGNames::surfaceScaleAttr | 289 || attribute == SVGNames::surfaceScaleAttr |
| 290 || attribute == SVGNames::zAttr) { | 290 || attribute == SVGNames::zAttr) { |
| 291 applicableTypes->append(new SVGNumberInterpolationType(attribute)); | 291 applicableTypes->append(new SVGNumberInterpolationType(attribute)); |
| 292 } else if (attribute == SVGNames::numOctavesAttr |
| 293 || attribute == SVGNames::targetXAttr |
| 294 || attribute == SVGNames::targetYAttr) { |
| 295 applicableTypes->append(new SVGIntegerInterpolationType(attribute)); |
| 292 } else if (attribute == HTMLNames::classAttr | 296 } else if (attribute == HTMLNames::classAttr |
| 293 || attribute == SVGNames::clipPathUnitsAttr | 297 || attribute == SVGNames::clipPathUnitsAttr |
| 294 || attribute == SVGNames::edgeModeAttr | 298 || attribute == SVGNames::edgeModeAttr |
| 295 || attribute == SVGNames::filterUnitsAttr | 299 || attribute == SVGNames::filterUnitsAttr |
| 296 || attribute == SVGNames::gradientUnitsAttr | 300 || attribute == SVGNames::gradientUnitsAttr |
| 297 || attribute == SVGNames::inAttr | 301 || attribute == SVGNames::inAttr |
| 298 || attribute == SVGNames::in2Attr | 302 || attribute == SVGNames::in2Attr |
| 299 || attribute == SVGNames::lengthAdjustAttr | 303 || attribute == SVGNames::lengthAdjustAttr |
| 300 || attribute == SVGNames::markerUnitsAttr | 304 || attribute == SVGNames::markerUnitsAttr |
| 301 || attribute == SVGNames::maskContentUnitsAttr | 305 || attribute == SVGNames::maskContentUnitsAttr |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 555 |
| 552 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) | 556 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG
PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) |
| 553 { | 557 { |
| 554 RefPtr<Interpolation> interpolation = nullptr; | 558 RefPtr<Interpolation> interpolation = nullptr; |
| 555 ASSERT(fromValue->type() == toValue->type()); | 559 ASSERT(fromValue->type() == toValue->type()); |
| 556 switch (fromValue->type()) { | 560 switch (fromValue->type()) { |
| 557 case AnimatedAngle: | 561 case AnimatedAngle: |
| 558 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola
tion::canCreateFrom(toValue)) | 562 if (AngleSVGInterpolation::canCreateFrom(fromValue) && AngleSVGInterpola
tion::canCreateFrom(toValue)) |
| 559 return AngleSVGInterpolation::create(fromValue, toValue, attribute); | 563 return AngleSVGInterpolation::create(fromValue, toValue, attribute); |
| 560 break; | 564 break; |
| 561 case AnimatedInteger: | |
| 562 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); | |
| 563 case AnimatedIntegerOptionalInteger: { | 565 case AnimatedIntegerOptionalInteger: { |
| 564 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; | 566 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; |
| 565 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue
, attribute, min); | 567 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue
, attribute, min); |
| 566 } | 568 } |
| 567 case AnimatedLength: | 569 case AnimatedLength: |
| 568 return LengthSVGInterpolation::create(fromValue, toValue, attribute); | 570 return LengthSVGInterpolation::create(fromValue, toValue, attribute); |
| 569 case AnimatedLengthList: | 571 case AnimatedLengthList: |
| 570 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); | 572 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
| 571 break; | 573 break; |
| 572 case AnimatedNumberOptionalNumber: | 574 case AnimatedNumberOptionalNumber: |
| 573 return NumberOptionalNumberSVGInterpolation::create(fromValue, toValue,
attribute); | 575 return NumberOptionalNumberSVGInterpolation::create(fromValue, toValue,
attribute); |
| 574 case AnimatedNumberList: | 576 case AnimatedNumberList: |
| 575 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); | 577 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat
e(fromValue, toValue, attribute); |
| 576 break; | 578 break; |
| 577 case AnimatedPath: | 579 case AnimatedPath: |
| 578 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at
tribute); | 580 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at
tribute); |
| 579 break; | 581 break; |
| 580 case AnimatedPoints: | 582 case AnimatedPoints: |
| 581 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate
(fromValue, toValue, attribute); | 583 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate
(fromValue, toValue, attribute); |
| 582 break; | 584 break; |
| 583 case AnimatedRect: | 585 case AnimatedRect: |
| 584 return RectSVGInterpolation::create(fromValue, toValue, attribute); | 586 return RectSVGInterpolation::create(fromValue, toValue, attribute); |
| 585 case AnimatedTransformList: | 587 case AnimatedTransformList: |
| 586 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr
eate(fromValue, toValue, attribute); | 588 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr
eate(fromValue, toValue, attribute); |
| 587 break; | 589 break; |
| 588 | 590 |
| 589 // Handled by SVGInterpolationTypes. | 591 // Handled by SVGInterpolationTypes. |
| 592 case AnimatedInteger: |
| 590 case AnimatedNumber: | 593 case AnimatedNumber: |
| 591 ASSERT_NOT_REACHED(); | 594 ASSERT_NOT_REACHED(); |
| 592 // Fallthrough. | 595 // Fallthrough. |
| 593 | 596 |
| 594 // TODO(ericwilligers): Support more animation types. | 597 // TODO(ericwilligers): Support more animation types. |
| 595 default: | 598 default: |
| 596 break; | 599 break; |
| 597 } | 600 } |
| 598 if (interpolation) | 601 if (interpolation) |
| 599 return interpolation.release(); | 602 return interpolation.release(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 616 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 619 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
| 617 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 620 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 618 | 621 |
| 619 if (!fromValue || !toValue) | 622 if (!fromValue || !toValue) |
| 620 return nullptr; | 623 return nullptr; |
| 621 | 624 |
| 622 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 625 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
| 623 } | 626 } |
| 624 | 627 |
| 625 } // namespace blink | 628 } // namespace blink |
| OLD | NEW |