SVGAnimateElementBase.h [plain text]
#pragma once
#include "SVGAnimationElement.h"
#include "SVGNames.h"
namespace WebCore {
class SVGAttributeAnimator;
class SVGAnimateElementBase : public SVGAnimationElement {
WTF_MAKE_ISO_ALLOCATED(SVGAnimateElementBase);
public:
bool isDiscreteAnimator() const;
protected:
SVGAnimateElementBase(const QualifiedName&, Document&);
bool hasValidAttributeType() const override;
virtual String animateRangeString(const String& string) const { return string; }
private:
SVGAttributeAnimator* animator() const;
SVGAttributeAnimator* animatorIfExists() const { return m_animator.get(); }
void setTargetElement(SVGElement*) override;
void setAttributeName(const QualifiedName&) override;
void resetAnimation() override;
bool calculateFromAndToValues(const String& fromString, const String& toString) override;
bool calculateFromAndByValues(const String& fromString, const String& byString) override;
bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) override;
void startAnimation() override;
void calculateAnimatedValue(float progress, unsigned repeatCount) override;
void applyResultsToTarget() override;
void stopAnimation(SVGElement* targetElement) override;
Optional<float> calculateDistance(const String& fromString, const String& toString) override;
bool hasInvalidCSSAttributeType() const;
mutable RefPtr<SVGAttributeAnimator> m_animator;
mutable Optional<bool> m_hasInvalidCSSAttributeType;
};
}
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()