SVGAnimateTransformElement.cpp [plain text]
#include "config.h"
#include "SVGAnimateTransformElement.h"
#include "SVGNames.h"
#include "SVGTransformable.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(SVGAnimateTransformElement);
inline SVGAnimateTransformElement::SVGAnimateTransformElement(const QualifiedName& tagName, Document& document)
: SVGAnimateElementBase(tagName, document)
, m_type(SVGTransformValue::SVG_TRANSFORM_UNKNOWN)
{
ASSERT(hasTagName(SVGNames::animateTransformTag));
}
Ref<SVGAnimateTransformElement> SVGAnimateTransformElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(*new SVGAnimateTransformElement(tagName, document));
}
bool SVGAnimateTransformElement::hasValidAttributeType() const
{
if (!this->targetElement())
return false;
if (attributeType() == AttributeType::CSS)
return false;
return SVGAnimateElementBase::hasValidAttributeType();
}
void SVGAnimateTransformElement::parseAttribute(const QualifiedName& name, const AtomString& value)
{
if (name == SVGNames::typeAttr) {
m_type = SVGTransformable::parseTransformType(value).valueOr(SVGTransformValue::SVG_TRANSFORM_UNKNOWN);
if (m_type == SVGTransformValue::SVG_TRANSFORM_MATRIX)
m_type = SVGTransformValue::SVG_TRANSFORM_UNKNOWN;
return;
}
SVGAnimateElementBase::parseAttribute(name, value);
}
String SVGAnimateTransformElement::animateRangeString(const String& string) const
{
return SVGTransformValue::prefixForTransfromType(m_type) + string + ')';
}
}