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

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

Issue 1419623009: SVG Web Animations: Add SVGNumberOptionalNumberInterpolationType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 5 years, 1 month 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/AngleSVGInterpolation.h" 9 #include "core/animation/AngleSVGInterpolation.h"
10 #include "core/animation/CSSColorInterpolationType.h" 10 #include "core/animation/CSSColorInterpolationType.h"
(...skipping 15 matching lines...) Expand all
26 #include "core/animation/IntegerSVGInterpolation.h" 26 #include "core/animation/IntegerSVGInterpolation.h"
27 #include "core/animation/InterpolationType.h" 27 #include "core/animation/InterpolationType.h"
28 #include "core/animation/InvalidatableInterpolation.h" 28 #include "core/animation/InvalidatableInterpolation.h"
29 #include "core/animation/LegacyStyleInterpolation.h" 29 #include "core/animation/LegacyStyleInterpolation.h"
30 #include "core/animation/LengthBoxStyleInterpolation.h" 30 #include "core/animation/LengthBoxStyleInterpolation.h"
31 #include "core/animation/LengthPairStyleInterpolation.h" 31 #include "core/animation/LengthPairStyleInterpolation.h"
32 #include "core/animation/LengthSVGInterpolation.h" 32 #include "core/animation/LengthSVGInterpolation.h"
33 #include "core/animation/LengthStyleInterpolation.h" 33 #include "core/animation/LengthStyleInterpolation.h"
34 #include "core/animation/ListSVGInterpolation.h" 34 #include "core/animation/ListSVGInterpolation.h"
35 #include "core/animation/ListStyleInterpolation.h" 35 #include "core/animation/ListStyleInterpolation.h"
36 #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"
42 #include "core/animation/SVGNumberInterpolationType.h" 41 #include "core/animation/SVGNumberInterpolationType.h"
42 #include "core/animation/SVGNumberOptionalNumberInterpolationType.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"
52 #include "platform/RuntimeEnabledFeatures.h" 52 #include "platform/RuntimeEnabledFeatures.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 || attribute == SVGNames::pointsAtYAttr 283 || attribute == SVGNames::pointsAtYAttr
284 || attribute == SVGNames::pointsAtZAttr 284 || attribute == SVGNames::pointsAtZAttr
285 || attribute == SVGNames::scaleAttr 285 || attribute == SVGNames::scaleAttr
286 || attribute == SVGNames::seedAttr 286 || attribute == SVGNames::seedAttr
287 || attribute == SVGNames::slopeAttr 287 || attribute == SVGNames::slopeAttr
288 || attribute == SVGNames::specularConstantAttr 288 || attribute == SVGNames::specularConstantAttr
289 || attribute == SVGNames::specularExponentAttr 289 || attribute == SVGNames::specularExponentAttr
290 || attribute == SVGNames::surfaceScaleAttr 290 || attribute == SVGNames::surfaceScaleAttr
291 || attribute == SVGNames::zAttr) { 291 || attribute == SVGNames::zAttr) {
292 applicableTypes->append(new SVGNumberInterpolationType(attribute)); 292 applicableTypes->append(new SVGNumberInterpolationType(attribute));
293 } else if (attribute == SVGNames::baseFrequencyAttr
294 || attribute == SVGNames::kernelUnitLengthAttr
295 || attribute == SVGNames::radiusAttr
296 || attribute == SVGNames::stdDeviationAttr) {
297 applicableTypes->append(new SVGNumberOptionalNumberInterpolationType (attribute));
293 } else if (attribute == HTMLNames::classAttr 298 } else if (attribute == HTMLNames::classAttr
294 || attribute == SVGNames::clipPathUnitsAttr 299 || attribute == SVGNames::clipPathUnitsAttr
295 || attribute == SVGNames::edgeModeAttr 300 || attribute == SVGNames::edgeModeAttr
296 || attribute == SVGNames::filterUnitsAttr 301 || attribute == SVGNames::filterUnitsAttr
297 || attribute == SVGNames::gradientUnitsAttr 302 || attribute == SVGNames::gradientUnitsAttr
298 || attribute == SVGNames::inAttr 303 || attribute == SVGNames::inAttr
299 || attribute == SVGNames::in2Attr 304 || attribute == SVGNames::in2Attr
300 || attribute == SVGNames::lengthAdjustAttr 305 || attribute == SVGNames::lengthAdjustAttr
301 || attribute == SVGNames::markerUnitsAttr 306 || attribute == SVGNames::markerUnitsAttr
302 || attribute == SVGNames::maskContentUnitsAttr 307 || attribute == SVGNames::maskContentUnitsAttr
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return IntegerSVGInterpolation::create(fromValue, toValue, attribute); 567 return IntegerSVGInterpolation::create(fromValue, toValue, attribute);
563 case AnimatedIntegerOptionalInteger: { 568 case AnimatedIntegerOptionalInteger: {
564 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0; 569 int min = &attribute->attributeName() == &SVGNames::orderAttr ? 1 : 0;
565 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue , attribute, min); 570 return IntegerOptionalIntegerSVGInterpolation::create(fromValue, toValue , attribute, min);
566 } 571 }
567 case AnimatedLength: 572 case AnimatedLength:
568 return LengthSVGInterpolation::create(fromValue, toValue, attribute); 573 return LengthSVGInterpolation::create(fromValue, toValue, attribute);
569 case AnimatedLengthList: 574 case AnimatedLengthList:
570 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat e(fromValue, toValue, attribute); 575 interpolation = ListSVGInterpolation<LengthSVGInterpolation>::maybeCreat e(fromValue, toValue, attribute);
571 break; 576 break;
572 case AnimatedNumberOptionalNumber:
573 return NumberOptionalNumberSVGInterpolation::create(fromValue, toValue, attribute);
574 case AnimatedNumberList: 577 case AnimatedNumberList:
575 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat e(fromValue, toValue, attribute); 578 interpolation = ListSVGInterpolation<NumberSVGInterpolation>::maybeCreat e(fromValue, toValue, attribute);
576 break; 579 break;
577 case AnimatedPath: 580 case AnimatedPath:
578 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at tribute); 581 interpolation = PathSVGInterpolation::maybeCreate(fromValue, toValue, at tribute);
579 break; 582 break;
580 case AnimatedPoints: 583 case AnimatedPoints:
581 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate (fromValue, toValue, attribute); 584 interpolation = ListSVGInterpolation<PointSVGInterpolation>::maybeCreate (fromValue, toValue, attribute);
582 break; 585 break;
583 case AnimatedRect: 586 case AnimatedRect:
584 return RectSVGInterpolation::create(fromValue, toValue, attribute); 587 return RectSVGInterpolation::create(fromValue, toValue, attribute);
585 case AnimatedTransformList: 588 case AnimatedTransformList:
586 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr eate(fromValue, toValue, attribute); 589 interpolation = ListSVGInterpolation<TransformSVGInterpolation>::maybeCr eate(fromValue, toValue, attribute);
587 break; 590 break;
588 591
589 // Handled by SVGInterpolationTypes. 592 // Handled by SVGInterpolationTypes.
590 case AnimatedAngle: 593 case AnimatedAngle:
591 case AnimatedNumber: 594 case AnimatedNumber:
595 case AnimatedNumberOptionalNumber:
592 ASSERT_NOT_REACHED(); 596 ASSERT_NOT_REACHED();
593 // Fallthrough. 597 // Fallthrough.
594 598
595 // TODO(ericwilligers): Support more animation types. 599 // TODO(ericwilligers): Support more animation types.
596 default: 600 default:
597 break; 601 break;
598 } 602 }
599 if (interpolation) 603 if (interpolation)
600 return interpolation.release(); 604 return interpolation.release();
601 605
(...skipping 15 matching lines...) Expand all
617 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value); 621 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase( )->cloneForAnimation(m_value);
618 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); 622 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()- >cloneForAnimation(toSVGPropertySpecificKeyframe(end).value());
619 623
620 if (!fromValue || !toValue) 624 if (!fromValue || !toValue)
621 return nullptr; 625 return nullptr;
622 626
623 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( )); 627 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get( ));
624 } 628 }
625 629
626 } // namespace blink 630 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698