initial import
[vuplus_webkit] / Source / WebCore / svg / SVGAnimatorFactory.h
1 /*
2  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef SVGAnimatorFactory_h
21 #define SVGAnimatorFactory_h
22
23 #if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
24 #include "SVGAnimatedAngle.h"
25 #include "SVGAnimatedBoolean.h"
26 #include "SVGAnimatedColor.h"
27 #include "SVGAnimatedInteger.h"
28 #include "SVGAnimatedLength.h"
29 #include "SVGAnimatedLengthList.h"
30 #include "SVGAnimatedNumber.h"
31 #include "SVGAnimatedNumberList.h"
32 #include "SVGAnimatedNumberOptionalNumber.h"
33 #include "SVGAnimatedPath.h"
34 #include "SVGAnimatedPointList.h"
35 #include "SVGAnimatedPreserveAspectRatio.h"
36 #include "SVGAnimatedRect.h"
37 #include "SVGAnimatedString.h"
38
39 namespace WebCore {
40
41 class SVGAnimationElement;
42
43 class SVGAnimatorFactory {
44 public:
45     static PassOwnPtr<SVGAnimatedTypeAnimator> create(SVGAnimationElement* animationElement, SVGElement* contextElement, AnimatedPropertyType attributeType)
46     {
47         ASSERT(animationElement);
48         ASSERT(contextElement);
49
50         switch (attributeType) {
51         case AnimatedAngle:
52             return adoptPtr(new SVGAnimatedAngleAnimator(animationElement, contextElement));
53         case AnimatedBoolean:
54             return adoptPtr(new SVGAnimatedBooleanAnimator(animationElement, contextElement));
55         case AnimatedColor:
56             return adoptPtr(new SVGAnimatedColorAnimator(animationElement, contextElement));
57         case AnimatedInteger:
58             return adoptPtr(new SVGAnimatedIntegerAnimator(animationElement, contextElement));
59         case AnimatedLength:
60             return adoptPtr(new SVGAnimatedLengthAnimator(animationElement, contextElement));
61         case AnimatedLengthList:
62             return adoptPtr(new SVGAnimatedLengthListAnimator(animationElement, contextElement));
63         case AnimatedNumber:
64             return adoptPtr(new SVGAnimatedNumberAnimator(animationElement, contextElement));
65         case AnimatedNumberList:
66             return adoptPtr(new SVGAnimatedNumberListAnimator(animationElement, contextElement));
67         case AnimatedNumberOptionalNumber:
68             return adoptPtr(new SVGAnimatedNumberOptionalNumberAnimator(animationElement, contextElement));
69         case AnimatedPath:
70             return adoptPtr(new SVGAnimatedPathAnimator(animationElement, contextElement));
71         case AnimatedPoints:
72             return adoptPtr(new SVGAnimatedPointListAnimator(animationElement, contextElement));
73         case AnimatedPreserveAspectRatio:
74             return adoptPtr(new SVGAnimatedPreserveAspectRatioAnimator(animationElement, contextElement));
75         case AnimatedRect:
76             return adoptPtr(new SVGAnimatedRectAnimator(animationElement, contextElement));
77         case AnimatedString:
78             return adoptPtr(new SVGAnimatedStringAnimator(animationElement, contextElement));
79         case AnimatedEnumeration: // FIXME: Implementation needed.
80         case AnimatedTransformList: // FIXME: Implementation needed.
81         case AnimatedUnknown:
82             break;
83         }
84
85         ASSERT_NOT_REACHED();
86         return nullptr;
87     }
88
89 private:
90     SVGAnimatorFactory() { }
91
92 };
93     
94 } // namespace WebCore
95
96 #endif // ENABLE(SVG) && ENABLE(SVG_ANIMATION)
97 #endif // SVGAnimatorFactory_h