2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef SVGAnimateElement_h
24 #define SVGAnimateElement_h
26 #if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
28 #include "SVGAnimatedType.h"
29 #include "SVGAnimatedTypeAnimator.h"
30 #include "SVGAnimationElement.h"
31 #include <wtf/OwnPtr.h>
35 // If we have 'currentColor' or 'inherit' as animation value, we need to grab the value during the animation
36 // since the value can be animated itself.
37 enum AnimatedPropertyValueType {
43 class SVGAnimateElement : public SVGAnimationElement {
45 static PassRefPtr<SVGAnimateElement> create(const QualifiedName&, Document*);
47 virtual ~SVGAnimateElement();
49 static void adjustForCurrentColor(SVGElement* targetElement, Color&);
50 void adjustForInheritance(SVGElement* targetElement, const QualifiedName&, String& value);
52 AnimatedPropertyType determineAnimatedPropertyType(SVGElement*) const;
53 void determinePropertyValueTypes(const String&, const String&);
55 AnimatedPropertyValueType fromPropertyValueType() { return m_fromPropertyValueType; }
56 AnimatedPropertyValueType toPropertyValueType() { return m_toPropertyValueType; }
59 SVGAnimateElement(const QualifiedName&, Document*);
61 virtual void resetToBaseValue(const String&);
62 virtual bool calculateFromAndToValues(const String& fromString, const String& toString);
63 virtual bool calculateFromAndByValues(const String& fromString, const String& byString);
64 virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement);
65 virtual void applyResultsToTarget();
66 virtual float calculateDistance(const String& fromString, const String& toString);
69 SVGAnimatedTypeAnimator* ensureAnimator();
71 virtual bool hasValidAttributeType();
72 AnimatedPropertyType m_animatedPropertyType;
74 AnimatedPropertyValueType m_fromPropertyValueType;
75 AnimatedPropertyValueType m_toPropertyValueType;
77 OwnPtr<SVGAnimatedType> m_fromType;
78 OwnPtr<SVGAnimatedType> m_toType;
79 OwnPtr<SVGAnimatedType> m_animatedType;
81 OwnPtr<SVGAnimatedTypeAnimator> m_animator;
84 } // namespace WebCore
87 #endif // SVGAnimateElement_h