1/*
2 * Copyright (C) Research In Motion Limited 2011, 2012. 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#include "core/svg/SVGAnimatedAngle.h"
24#include "core/svg/SVGAnimatedBoolean.h"
25#include "core/svg/SVGAnimatedColor.h"
26#include "core/svg/SVGAnimatedEnumeration.h"
27#include "core/svg/SVGAnimatedInteger.h"
28#include "core/svg/SVGAnimatedIntegerOptionalInteger.h"
29#include "core/svg/SVGAnimatedLength.h"
30#include "core/svg/SVGAnimatedLengthList.h"
31#include "core/svg/SVGAnimatedNumber.h"
32#include "core/svg/SVGAnimatedNumberList.h"
33#include "core/svg/SVGAnimatedNumberOptionalNumber.h"
34#include "core/svg/SVGAnimatedPath.h"
35#include "core/svg/SVGAnimatedPointList.h"
36#include "core/svg/SVGAnimatedPreserveAspectRatio.h"
37#include "core/svg/SVGAnimatedRect.h"
38#include "core/svg/SVGAnimatedString.h"
39#include "core/svg/SVGAnimatedTransformList.h"
40
41namespace WebCore {
42
43class SVGAnimationElement;
44
45class SVGAnimatorFactory {
46public:
47    static PassOwnPtr<SVGAnimatedTypeAnimator> create(SVGAnimationElement* animationElement, SVGElement* contextElement, AnimatedPropertyType attributeType)
48    {
49        ASSERT(animationElement);
50        ASSERT(contextElement);
51
52        switch (attributeType) {
53        case AnimatedAngle:
54            return adoptPtr(new SVGAnimatedAngleAnimator(animationElement, contextElement));
55        case AnimatedBoolean:
56            return adoptPtr(new SVGAnimatedBooleanAnimator(animationElement, contextElement));
57        case AnimatedColor:
58            return adoptPtr(new SVGAnimatedColorAnimator(animationElement, contextElement));
59        case AnimatedEnumeration:
60            return adoptPtr(new SVGAnimatedEnumerationAnimator(animationElement, contextElement));
61        case AnimatedInteger:
62            return adoptPtr(new SVGAnimatedIntegerAnimator(animationElement, contextElement));
63        case AnimatedIntegerOptionalInteger:
64            return adoptPtr(new SVGAnimatedIntegerOptionalIntegerAnimator(animationElement, contextElement));
65        case AnimatedLength:
66            return adoptPtr(new SVGAnimatedLengthAnimator(animationElement, contextElement));
67        case AnimatedLengthList:
68            return adoptPtr(new SVGAnimatedLengthListAnimator(animationElement, contextElement));
69        case AnimatedNumber:
70            return adoptPtr(new SVGAnimatedNumberAnimator(animationElement, contextElement));
71        case AnimatedNumberList:
72            return adoptPtr(new SVGAnimatedNumberListAnimator(animationElement, contextElement));
73        case AnimatedNumberOptionalNumber:
74            return adoptPtr(new SVGAnimatedNumberOptionalNumberAnimator(animationElement, contextElement));
75        case AnimatedPath:
76            return adoptPtr(new SVGAnimatedPathAnimator(animationElement, contextElement));
77        case AnimatedPoints:
78            return adoptPtr(new SVGAnimatedPointListAnimator(animationElement, contextElement));
79        case AnimatedPreserveAspectRatio:
80            return adoptPtr(new SVGAnimatedPreserveAspectRatioAnimator(animationElement, contextElement));
81        case AnimatedRect:
82            return adoptPtr(new SVGAnimatedRectAnimator(animationElement, contextElement));
83        case AnimatedString:
84            return adoptPtr(new SVGAnimatedStringAnimator(animationElement, contextElement));
85        case AnimatedTransformList:
86            return adoptPtr(new SVGAnimatedTransformListAnimator(animationElement, contextElement));
87        case AnimatedUnknown:
88            break;
89        }
90
91        ASSERT_NOT_REACHED();
92        return nullptr;
93    }
94
95private:
96    SVGAnimatorFactory() { }
97
98};
99
100} // namespace WebCore
101
102#endif // SVGAnimatorFactory_h
103