SVGTextPositioningElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGTextPositioningElement.h"
#include "MappedAttribute.h"
#include "SVGLengthList.h"
#include "SVGNames.h"
#include "SVGNumberList.h"
namespace WebCore {
char SVGTextPositioningElementIdentifier[] = "SVGTextPositioningElement";
SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document* doc)
: SVGTextContentElement(tagName, doc)
, m_x(this, SVGNames::xAttr, SVGLengthList::create(SVGNames::xAttr))
, m_y(this, SVGNames::yAttr, SVGLengthList::create(SVGNames::yAttr))
, m_dx(this, SVGNames::dxAttr, SVGLengthList::create(SVGNames::dxAttr))
, m_dy(this, SVGNames::dyAttr, SVGLengthList::create(SVGNames::dyAttr))
, m_rotate(this, SVGNames::rotateAttr, SVGNumberList::create(SVGNames::rotateAttr))
{
}
SVGTextPositioningElement::~SVGTextPositioningElement()
{
}
void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == SVGNames::xAttr)
xBaseValue()->parse(attr->value(), LengthModeWidth);
else if (attr->name() == SVGNames::yAttr)
yBaseValue()->parse(attr->value(), LengthModeHeight);
else if (attr->name() == SVGNames::dxAttr)
dxBaseValue()->parse(attr->value(), LengthModeWidth);
else if (attr->name() == SVGNames::dyAttr)
dyBaseValue()->parse(attr->value(), LengthModeHeight);
else if (attr->name() == SVGNames::rotateAttr)
rotateBaseValue()->parse(attr->value());
else
SVGTextContentElement::parseMappedAttribute(attr);
}
bool SVGTextPositioningElement::isKnownAttribute(const QualifiedName& attrName)
{
return (attrName.matches(SVGNames::xAttr) ||
attrName.matches(SVGNames::yAttr) ||
attrName.matches(SVGNames::dxAttr) ||
attrName.matches(SVGNames::dyAttr) ||
attrName.matches(SVGNames::rotateAttr) ||
SVGTextContentElement::isKnownAttribute(attrName));
}
}
#endif // ENABLE(SVG)