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()
{
if (SVGElement* targetElement = this->targetElement())
return determineAnimatedPropertyType(targetElement) == AnimatedTransformList;
return false;
}
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(Attribute* attr)
{
if (!isSupportedAttribute(attr->name())) {
SVGAnimateElement::parseAttribute(attr);
return;
}
if (attr->name() == SVGNames::typeAttr) {
m_type = SVGTransformable::parseTransformType(attr->value());
if (m_type == SVGTransform::SVG_TRANSFORM_MATRIX)
m_type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
return;
}
ASSERT_NOT_REACHED();
}
}
#endif // ENABLE(SVG)