SVGAnimateTransformElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGAnimateTransformElement.h"
#include "Attribute.h"
#include "SVGNames.h"
#include "SVGTransformable.h"
namespace WebCore {
inline SVGAnimateTransformElement::SVGAnimateTransformElement(const QualifiedName& tagName, Document* document)
: SVGAnimateElement(tagName, document)
, m_type(SVGTransform::SVG_TRANSFORM_UNKNOWN)
{
ASSERT(hasTagName(SVGNames::animateTransformTag));
}
PassRefPtr<SVGAnimateTransformElement> SVGAnimateTransformElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new SVGAnimateTransformElement(tagName, document));
}
bool SVGAnimateTransformElement::hasValidAttributeType()
{
SVGElement* targetElement = this->targetElement();
if (!targetElement)
return false;
return m_animatedPropertyType == AnimatedTransformList;
}
bool SVGAnimateTransformElement::isSupportedAttribute(const QualifiedName& attrName)
{
DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
if (supportedAttributes.isEmpty())
supportedAttributes.add(SVGNames::typeAttr);
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
void SVGAnimateTransformElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!isSupportedAttribute(name)) {
SVGAnimateElement::parseAttribute(name, value);
return;
}
if (name == SVGNames::typeAttr) {
m_type = SVGTransformable::parseTransformType(value);
if (m_type == SVGTransform::SVG_TRANSFORM_MATRIX)
m_type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
return;
}
ASSERT_NOT_REACHED();
}
}
#endif // ENABLE(SVG)