Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: third_party/WebKit/Source/core/animation/StringKeyframe.cpp

Issue 1535523002: Web Animations: Add SVGLengthListInterpolationType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/InterpolationType.h" 24 #include "core/animation/InterpolationType.h"
25 #include "core/animation/InvalidatableInterpolation.h" 25 #include "core/animation/InvalidatableInterpolation.h"
26 #include "core/animation/LegacyStyleInterpolation.h" 26 #include "core/animation/LegacyStyleInterpolation.h"
27 #include "core/animation/LengthBoxStyleInterpolation.h" 27 #include "core/animation/LengthBoxStyleInterpolation.h"
28 #include "core/animation/LengthPairStyleInterpolation.h" 28 #include "core/animation/LengthPairStyleInterpolation.h"
29 #include "core/animation/LengthSVGInterpolation.h"
30 #include "core/animation/LengthStyleInterpolation.h" 29 #include "core/animation/LengthStyleInterpolation.h"
31 #include "core/animation/ListSVGInterpolation.h"
32 #include "core/animation/ListStyleInterpolation.h" 30 #include "core/animation/ListStyleInterpolation.h"
33 #include "core/animation/PathSVGInterpolation.h" 31 #include "core/animation/PathSVGInterpolation.h"
34 #include "core/animation/SVGAngleInterpolationType.h" 32 #include "core/animation/SVGAngleInterpolationType.h"
35 #include "core/animation/SVGIntegerInterpolationType.h" 33 #include "core/animation/SVGIntegerInterpolationType.h"
36 #include "core/animation/SVGIntegerOptionalIntegerInterpolationType.h" 34 #include "core/animation/SVGIntegerOptionalIntegerInterpolationType.h"
37 #include "core/animation/SVGLengthInterpolationType.h" 35 #include "core/animation/SVGLengthInterpolationType.h"
36 #include "core/animation/SVGLengthListInterpolationType.h"
38 #include "core/animation/SVGNumberInterpolationType.h" 37 #include "core/animation/SVGNumberInterpolationType.h"
39 #include "core/animation/SVGNumberListInterpolationType.h" 38 #include "core/animation/SVGNumberListInterpolationType.h"
40 #include "core/animation/SVGNumberOptionalNumberInterpolationType.h" 39 #include "core/animation/SVGNumberOptionalNumberInterpolationType.h"
41 #include "core/animation/SVGPointListInterpolationType.h" 40 #include "core/animation/SVGPointListInterpolationType.h"
42 #include "core/animation/SVGRectInterpolationType.h" 41 #include "core/animation/SVGRectInterpolationType.h"
43 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" 42 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h"
44 #include "core/animation/SVGTransformListInterpolationType.h" 43 #include "core/animation/SVGTransformListInterpolationType.h"
45 #include "core/animation/SVGValueInterpolationType.h" 44 #include "core/animation/SVGValueInterpolationType.h"
46 #include "core/animation/VisibilityStyleInterpolation.h" 45 #include "core/animation/VisibilityStyleInterpolation.h"
47 #include "core/animation/css/CSSAnimations.h" 46 #include "core/animation/css/CSSAnimations.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 || attribute == SVGNames::markerHeightAttr 281 || attribute == SVGNames::markerHeightAttr
283 || attribute == SVGNames::markerWidthAttr 282 || attribute == SVGNames::markerWidthAttr
284 || attribute == SVGNames::rAttr 283 || attribute == SVGNames::rAttr
285 || attribute == SVGNames::refXAttr 284 || attribute == SVGNames::refXAttr
286 || attribute == SVGNames::refYAttr 285 || attribute == SVGNames::refYAttr
287 || attribute == SVGNames::rxAttr 286 || attribute == SVGNames::rxAttr
288 || attribute == SVGNames::ryAttr 287 || attribute == SVGNames::ryAttr
289 || attribute == SVGNames::startOffsetAttr 288 || attribute == SVGNames::startOffsetAttr
290 || attribute == SVGNames::textLengthAttr 289 || attribute == SVGNames::textLengthAttr
291 || attribute == SVGNames::widthAttr 290 || attribute == SVGNames::widthAttr
292 || attribute == SVGNames::xAttr
293 || attribute == SVGNames::x1Attr 291 || attribute == SVGNames::x1Attr
294 || attribute == SVGNames::x2Attr 292 || attribute == SVGNames::x2Attr
295 || attribute == SVGNames::y1Attr 293 || attribute == SVGNames::y1Attr
296 || attribute == SVGNames::y2Attr) { 294 || attribute == SVGNames::y2Attr) {
297 applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attr ibute))); 295 applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attr ibute)));
296 } else if (attribute == SVGNames::dxAttr
297 || attribute == SVGNames::dyAttr) {
298 applicableTypes->append(adoptPtr(new SVGLengthListInterpolationType( attribute)));
fs 2015/12/16 22:43:29 'dx' and 'dy' can also be numbers (on <feOffset> a
299 } else if (attribute == SVGNames::xAttr
300 || attribute == SVGNames::yAttr) {
301 // 'x' and 'y' may be either a length or a length list
302 applicableTypes->append(adoptPtr(new SVGLengthInterpolationType(attr ibute)));
303 applicableTypes->append(adoptPtr(new SVGLengthListInterpolationType( attribute)));
298 } else if (attribute == SVGNames::amplitudeAttr 304 } else if (attribute == SVGNames::amplitudeAttr
299 || attribute == SVGNames::azimuthAttr 305 || attribute == SVGNames::azimuthAttr
300 || attribute == SVGNames::biasAttr 306 || attribute == SVGNames::biasAttr
301 || attribute == SVGNames::diffuseConstantAttr 307 || attribute == SVGNames::diffuseConstantAttr
302 || attribute == SVGNames::divisorAttr 308 || attribute == SVGNames::divisorAttr
303 || attribute == SVGNames::elevationAttr 309 || attribute == SVGNames::elevationAttr
304 || attribute == SVGNames::exponentAttr 310 || attribute == SVGNames::exponentAttr
305 || attribute == SVGNames::interceptAttr 311 || attribute == SVGNames::interceptAttr
306 || attribute == SVGNames::k1Attr 312 || attribute == SVGNames::k1Attr
307 || attribute == SVGNames::k2Attr 313 || attribute == SVGNames::k2Attr
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), Ef fectModel::CompositeAdd)); 597 return adoptPtr(new SVGPropertySpecificKeyframe(offset, easing, String(), Ef fectModel::CompositeAdd));
592 } 598 }
593 599
594 namespace { 600 namespace {
595 601
596 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG PropertyBase* toValue, SVGAnimatedPropertyBase* attribute) 602 PassRefPtr<Interpolation> createSVGInterpolation(SVGPropertyBase* fromValue, SVG PropertyBase* toValue, SVGAnimatedPropertyBase* attribute)
597 { 603 {
598 RefPtr<Interpolation> interpolation = nullptr; 604 RefPtr<Interpolation> interpolation = nullptr;
599 ASSERT(fromValue->type() == toValue->type()); 605 ASSERT(fromValue->type() == toValue->type());
600 switch (fromValue->type()) { 606 switch (fromValue->type()) {
601 case AnimatedLengthList:
602 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat e(fromValue, toValue, attribute);
603 break;
604 case AnimatedPath: 607 case AnimatedPath:
605 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at tribute); 608 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at tribute);
606 break; 609 break;
607 610
608 // Handled by SVGInterpolationTypes. 611 // Handled by SVGInterpolationTypes.
609 case AnimatedAngle: 612 case AnimatedAngle:
610 case AnimatedInteger: 613 case AnimatedInteger:
611 case AnimatedIntegerOptionalInteger: 614 case AnimatedIntegerOptionalInteger:
612 case AnimatedLength: 615 case AnimatedLength:
616 case AnimatedLengthList:
613 case AnimatedNumber: 617 case AnimatedNumber:
614 case AnimatedNumberList: 618 case AnimatedNumberList:
615 case AnimatedNumberOptionalNumber: 619 case AnimatedNumberOptionalNumber:
616 case AnimatedPoints: 620 case AnimatedPoints:
617 case AnimatedRect: 621 case AnimatedRect:
618 case AnimatedTransformList: 622 case AnimatedTransformList:
619 ASSERT_NOT_REACHED(); 623 ASSERT_NOT_REACHED();
620 // Fallthrough. 624 // Fallthrough.
621 625
622 // TODO(ericwilligers): Support more animation types. 626 // TODO(ericwilligers): Support more animation types.
(...skipping 21 matching lines...) Expand all
644 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); 648 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value);
645 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); 649 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value());
646 650
647 if (!fromValue || !toValue) 651 if (!fromValue || !toValue)
648 return nullptr; 652 return nullptr;
649 653
650 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); 654 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( ));
651 } 655 }
652 656
653 } // namespace blink 657 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698