SVGAnimateElementBase.h [plain text]
#ifndef SVGAnimateElementBase_h
#define SVGAnimateElementBase_h
#include "SVGAnimatedType.h"
#include "SVGAnimatedTypeAnimator.h"
#include "SVGAnimationElement.h"
#include "SVGNames.h"
namespace WebCore {
class SVGAnimateElementBase : public SVGAnimationElement {
public:
virtual ~SVGAnimateElementBase();
AnimatedPropertyType determineAnimatedPropertyType(SVGElement&) const;
protected:
SVGAnimateElementBase(const QualifiedName&, Document&);
virtual void resetAnimatedType() override;
virtual void clearAnimatedType(SVGElement* targetElement) override;
virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override;
virtual bool calculateFromAndToValues(const String& fromString, const String& toString) override;
virtual bool calculateFromAndByValues(const String& fromString, const String& byString) override;
virtual void calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement* resultElement) override;
virtual void applyResultsToTarget() override;
virtual float calculateDistance(const String& fromString, const String& toString) override;
virtual bool isAdditive() const override;
virtual void setTargetElement(SVGElement*) override;
virtual void setAttributeName(const QualifiedName&) override;
virtual void resetAnimatedPropertyType() override;
AnimatedPropertyType m_animatedPropertyType;
private:
SVGAnimatedTypeAnimator* ensureAnimator();
bool animatedPropertyTypeSupportsAddition() const;
virtual bool hasValidAttributeType() override;
std::unique_ptr<SVGAnimatedType> m_fromType;
std::unique_ptr<SVGAnimatedType> m_toType;
std::unique_ptr<SVGAnimatedType> m_toAtEndOfDurationType;
std::unique_ptr<SVGAnimatedType> m_animatedType;
SVGElementAnimatedPropertyList m_animatedProperties;
std::unique_ptr<SVGAnimatedTypeAnimator> m_animator;
};
}
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::SVGAnimateElementBase)
static bool isType(const WebCore::SVGElement& element)
{
return element.hasTagName(WebCore::SVGNames::animateTag) || element.hasTagName(WebCore::SVGNames::animateColorTag)
|| element.hasTagName(WebCore::SVGNames::animateTransformTag) || element.hasTagName(WebCore::SVGNames::setTag);
}
static bool isType(const WebCore::Node& node) { return is<WebCore::SVGElement>(node) && isType(downcast<WebCore::SVGElement>(node)); }
SPECIALIZE_TYPE_TRAITS_END()
#endif // SVGAnimateElementBase_h