25 #ifndef SVGAnimationElement_h
26 #define SVGAnimationElement_h
27 #if ENABLE(SVG_ANIMATION)
36 #include "UnitBezier.h"
40 class ConditionEventListener;
43 class SVGAnimationElement :
public SVGSMILElement,
45 public SVGExternalResourcesRequired,
46 public ElementTimeControl
49 SVGAnimationElement(
const QualifiedName&, Document*);
50 virtual ~SVGAnimationElement();
52 virtual void parseMappedAttribute(MappedAttribute*);
53 virtual void attributeChanged(Attribute*,
bool preserveDecls);
56 float getStartTime()
const;
57 float getCurrentTime()
const;
58 float getSimpleDuration(ExceptionCode&)
const;
61 virtual bool beginElement(ExceptionCode&);
62 virtual bool beginElementAt(
float offset, ExceptionCode&);
63 virtual bool endElement(ExceptionCode&);
64 virtual bool endElementAt(
float offset, ExceptionCode&);
66 static bool attributeIsCSS(
const String& attributeName);
70 enum CalcMode { CalcModeDiscrete, CalcModeLinear, CalcModePaced, CalcModeSpline };
71 CalcMode calcMode()
const;
73 enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto };
74 AttributeType attributeType()
const;
80 enum AnimationMode { NoAnimation, ToAnimation, ByAnimation, ValuesAnimation, FromToAnimation, FromByAnimation, PathAnimation };
81 AnimationMode animationMode()
const;
83 virtual bool hasValidTarget()
const;
85 String targetAttributeBaseValue()
const;
86 void setTargetAttributeAnimatedValue(
const String&);
87 bool targetAttributeIsCSS()
const;
89 bool isAdditive()
const;
90 bool isAccumulated()
const;
93 virtual void startedActiveInterval();
94 virtual void updateAnimation(
float percent,
unsigned repeat, SVGSMILElement* resultElement);
95 virtual void endedActiveInterval();
97 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired,
bool, ExternalResourcesRequired, externalResourcesRequired)
99 virtual
bool calculateFromAndToValues(const
String& fromString, const
String& toString) = 0;
100 virtual
bool calculateFromAndByValues(const
String& fromString, const
String& byString) = 0;
101 virtual
void calculateAnimatedValue(
float percentage,
unsigned repeat, SVGSMILElement* resultElement) = 0;
102 virtual
float calculateDistance(const
String& fromString, const
String& toString) {
return -1.f; }
103 virtual Path animationPath()
const {
return Path(); }
105 void currentValuesForValuesAnimation(
float percent,
float& effectivePercent,
String& from,
String& to)
const;
106 void calculateKeyTimesForCalcModePaced();
107 float calculatePercentFromKeyPoints(
float percent)
const;
108 void currentValuesFromKeyPoints(
float percent,
float& effectivePercent,
String& from,
String& to)
const;
109 float calculatePercentForSpline(
float percent,
unsigned splineIndex)
const;
112 bool m_animationValid;
114 Vector<String> m_values;
115 Vector<float> m_keyTimes;
116 Vector<float> m_keyPoints;
117 Vector<UnitBezier> m_keySplines;
118 String m_lastValuesAnimationFrom;
119 String m_lastValuesAnimationTo;
124 #endif // ENABLE(SVG)
125 #endif // SVGAnimationElement_h