00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "config.h"
00024 #include "wtf/Platform.h"
00025
00026 #if ENABLE(SVG)
00027 #include "SVGTextPositioningElement.h"
00028
00029 #include "SVGLengthList.h"
00030 #include "SVGNames.h"
00031 #include "SVGNumberList.h"
00032
00033 namespace WebCore {
00034
00035 SVGTextPositioningElement::SVGTextPositioningElement(const QualifiedName& tagName, Document* doc)
00036 : SVGTextContentElement(tagName, doc)
00037 , m_x(SVGLengthList::create(SVGNames::xAttr))
00038 , m_y(SVGLengthList::create(SVGNames::yAttr))
00039 , m_dx(SVGLengthList::create(SVGNames::dxAttr))
00040 , m_dy(SVGLengthList::create(SVGNames::dyAttr))
00041 , m_rotate(SVGNumberList::create(SVGNames::rotateAttr))
00042 {
00043 }
00044
00045 SVGTextPositioningElement::~SVGTextPositioningElement()
00046 {
00047 }
00048
00049 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, X, x, SVGNames::xAttr, m_x.get())
00050 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Y, y, SVGNames::yAttr, m_y.get())
00051 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dx, dx, SVGNames::dxAttr, m_dx.get())
00052 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGLengthList*, LengthList, lengthList, Dy, dy, SVGNames::dyAttr, m_dy.get())
00053 ANIMATED_PROPERTY_DEFINITIONS(SVGTextPositioningElement, SVGNumberList*, NumberList, numberList, Rotate, rotate, SVGNames::rotateAttr, m_rotate.get())
00054
00055 void SVGTextPositioningElement::parseMappedAttribute(MappedAttribute* attr)
00056 {
00057 kDebug() << "parse:" << attr->localName() << attr->value() << endl;
00058 if (attr->name() == SVGNames::xAttr)
00059 xBaseValue()->parse(attr->value(), this, LengthModeWidth);
00060 else if (attr->name() == SVGNames::yAttr)
00061 yBaseValue()->parse(attr->value(), this, LengthModeHeight);
00062 else if (attr->name() == SVGNames::dxAttr)
00063 dxBaseValue()->parse(attr->value(), this, LengthModeWidth);
00064 else if (attr->name() == SVGNames::dyAttr)
00065 dyBaseValue()->parse(attr->value(), this, LengthModeHeight);
00066 else if (attr->name() == SVGNames::rotateAttr)
00067 rotateBaseValue()->parse(attr->value());
00068 else
00069 SVGTextContentElement::parseMappedAttribute(attr);
00070 }
00071
00072 bool SVGTextPositioningElement::isKnownAttribute(const QualifiedName& attrName)
00073 {
00074 return (attrName.matches(SVGNames::xAttr) ||
00075 attrName.matches(SVGNames::yAttr) ||
00076 attrName.matches(SVGNames::dxAttr) ||
00077 attrName.matches(SVGNames::dyAttr) ||
00078 attrName.matches(SVGNames::rotateAttr) ||
00079 SVGTextContentElement::isKnownAttribute(attrName));
00080 }
00081
00082 }
00083
00084 #endif // ENABLE(SVG)