diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp index b0e4aeda679..f2a83e94c64 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp @@ -24,48 +24,31 @@ #include "core/rendering/svg/RenderSVGEllipse.h" #include "core/rendering/svg/RenderSVGResource.h" -#include "core/svg/SVGElementInstance.h" #include "core/svg/SVGLength.h" namespace WebCore { -// Animated property definitions -DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cxAttr, Cx, cx) -DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::cyAttr, Cy, cy) -DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::rxAttr, Rx, rx) -DEFINE_ANIMATED_LENGTH(SVGEllipseElement, SVGNames::ryAttr, Ry, ry) -DEFINE_ANIMATED_BOOLEAN(SVGEllipseElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) - -BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) - REGISTER_LOCAL_ANIMATED_PROPERTY(cx) - REGISTER_LOCAL_ANIMATED_PROPERTY(cy) - REGISTER_LOCAL_ANIMATED_PROPERTY(rx) - REGISTER_LOCAL_ANIMATED_PROPERTY(ry) - REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) - REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) -END_REGISTER_ANIMATED_PROPERTIES - inline SVGEllipseElement::SVGEllipseElement(Document& document) : SVGGeometryElement(SVGNames::ellipseTag, document) - , m_cx(LengthModeWidth) - , m_cy(LengthModeHeight) - , m_rx(LengthModeWidth) - , m_ry(LengthModeHeight) + , m_cx(SVGAnimatedLength::create(this, SVGNames::cxAttr, SVGLength::create(LengthModeWidth), AllowNegativeLengths)) + , m_cy(SVGAnimatedLength::create(this, SVGNames::cyAttr, SVGLength::create(LengthModeHeight), AllowNegativeLengths)) + , m_rx(SVGAnimatedLength::create(this, SVGNames::rxAttr, SVGLength::create(LengthModeWidth), ForbidNegativeLengths)) + , m_ry(SVGAnimatedLength::create(this, SVGNames::ryAttr, SVGLength::create(LengthModeHeight), ForbidNegativeLengths)) { ScriptWrappable::init(this); - registerAnimatedPropertiesForSVGEllipseElement(); -} -PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(Document& document) -{ - return adoptRef(new SVGEllipseElement(document)); + addToPropertyMap(m_cx); + addToPropertyMap(m_cy); + addToPropertyMap(m_rx); + addToPropertyMap(m_ry); } +DEFINE_NODE_FACTORY(SVGEllipseElement) + bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::cxAttr); supportedAttributes.add(SVGNames::cyAttr); supportedAttributes.add(SVGNames::rxAttr); @@ -81,15 +64,14 @@ void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt if (!isSupportedAttribute(name)) SVGGeometryElement::parseAttribute(name, value); else if (name == SVGNames::cxAttr) - setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); + m_cx->setBaseValueAsString(value, parseError); else if (name == SVGNames::cyAttr) - setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); + m_cy->setBaseValueAsString(value, parseError); else if (name == SVGNames::rxAttr) - setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); + m_rx->setBaseValueAsString(value, parseError); else if (name == SVGNames::ryAttr) - setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { - } else + m_ry->setBaseValueAsString(value, parseError); + else ASSERT_NOT_REACHED(); reportAttributeParsingError(parseError, name, value); @@ -102,7 +84,7 @@ void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) return; } - SVGElementInstance::InvalidationGuard invalidationGuard(this); + SVGElement::InvalidationGuard invalidationGuard(this); bool isLengthAttribute = attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr @@ -122,20 +104,15 @@ void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) return; } - if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { - RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); - return; - } - ASSERT_NOT_REACHED(); } bool SVGEllipseElement::selfHasRelativeLengths() const { - return cxCurrentValue().isRelative() - || cyCurrentValue().isRelative() - || rxCurrentValue().isRelative() - || ryCurrentValue().isRelative(); + return m_cx->currentValue()->isRelative() + || m_cy->currentValue()->isRelative() + || m_rx->currentValue()->isRelative() + || m_ry->currentValue()->isRelative(); } RenderObject* SVGEllipseElement::createRenderer(RenderStyle*) |