24 #include "wtf/Platform.h"
30 #include "RenderPath.h"
35 SVGCircleElement::SVGCircleElement(
const QualifiedName& tagName, Document* doc)
36 : SVGStyledTransformableElement(tagName, doc)
39 , SVGExternalResourcesRequired()
40 , m_cx(SVGLength(this, LengthModeWidth))
41 , m_cy(SVGLength(this, LengthModeHeight))
42 , m_r(SVGLength(this, LengthModeOther))
46 SVGCircleElement::~SVGCircleElement()
50 ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, Cx, cx,
SVGNames::cxAttr, m_cx)
51 ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, Cy, cy, SVGNames::
cyAttr, m_cy)
52 ANIMATED_PROPERTY_DEFINITIONS(SVGCircleElement, SVGLength, Length, length, R, r, SVGNames::
rAttr, m_r)
54 void SVGCircleElement::parseMappedAttribute(MappedAttribute* attr)
57 setCxBaseValue(SVGLength(
this, LengthModeWidth, attr->value()));
59 setCyBaseValue(SVGLength(
this, LengthModeHeight, attr->value()));
61 setRBaseValue(SVGLength(
this, LengthModeOther, attr->value()));
62 if (r().value() < 0.0)
63 document()->accessSVGExtensions()->reportError(
"A negative value for circle <r> is not allowed");
65 if (SVGTests::parseMappedAttribute(attr))
67 if (SVGLangSpace::parseMappedAttribute(attr))
69 if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
71 SVGStyledTransformableElement::parseMappedAttribute(attr);
75 void SVGCircleElement::svgAttributeChanged(
const QualifiedName& attrName)
77 SVGStyledTransformableElement::svgAttributeChanged(attrName);
84 SVGTests::isKnownAttribute(attrName) ||
85 SVGLangSpace::isKnownAttribute(attrName) ||
86 SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
87 SVGStyledTransformableElement::isKnownAttribute(attrName))
88 renderer()->setNeedsLayout(
true);
91 Path SVGCircleElement::toPathData()
const
93 return Path::createCircle(FloatPoint(cx().value(), cy().value()), r().value());
96 bool SVGCircleElement::hasRelativeValues()
const
98 return (cx().isRelative() || cy().isRelative() || r().isRelative());
102 quint32 SVGCircleElement::id()
const
109 #endif // ENABLE(SVG)
DOM::QualifiedName circleTag
DOM::QualifiedName cyAttr
DOM::QualifiedName cxAttr