From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/svg/SVGCircleElement.cpp | 82 ++++++++------------------------- 1 file changed, 19 insertions(+), 63 deletions(-) (limited to 'Source/WebCore/svg/SVGCircleElement.cpp') diff --git a/Source/WebCore/svg/SVGCircleElement.cpp b/Source/WebCore/svg/SVGCircleElement.cpp index 0dccf19db..db8364fdb 100644 --- a/Source/WebCore/svg/SVGCircleElement.cpp +++ b/Source/WebCore/svg/SVGCircleElement.cpp @@ -19,19 +19,14 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGCircleElement.h" -#include "Attribute.h" -#include "ExceptionCode.h" #include "FloatPoint.h" #include "RenderSVGEllipse.h" #include "RenderSVGPath.h" #include "RenderSVGResource.h" -#include "SVGElementInstance.h" #include "SVGException.h" -#include "SVGLength.h" +#include "SVGLengthValue.h" #include "SVGNames.h" namespace WebCore { @@ -60,90 +55,51 @@ inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document registerAnimatedPropertiesForSVGCircleElement(); } -PassRefPtr SVGCircleElement::create(const QualifiedName& tagName, Document& document) +Ref SVGCircleElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGCircleElement(tagName, document)); -} - -bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) -{ - DEFINE_STATIC_LOCAL(HashSet, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); - SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); - supportedAttributes.add(SVGNames::cxAttr); - supportedAttributes.add(SVGNames::cyAttr); - supportedAttributes.add(SVGNames::rAttr); - } - return supportedAttributes.contains(attrName); + return adoptRef(*new SVGCircleElement(tagName, document)); } void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { SVGParsingError parseError = NoError; - if (!isSupportedAttribute(name)) - SVGGraphicsElement::parseAttribute(name, value); - else if (name == SVGNames::cxAttr) - setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); + if (name == SVGNames::cxAttr) + setCxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::cyAttr) - setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); + setCyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError)); else if (name == SVGNames::rAttr) - setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { - } else - ASSERT_NOT_REACHED(); + setRBaseValue(SVGLengthValue::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); reportAttributeParsingError(parseError, name, value); + + SVGGraphicsElement::parseAttribute(name, value); + SVGExternalResourcesRequired::parseAttribute(name, value); } void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGraphicsElement::svgAttributeChanged(attrName); + + if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rAttr) { + InstanceInvalidationGuard guard(*this); + invalidateSVGPresentationAttributeStyle(); return; } - SVGElementInstance::InvalidationGuard invalidationGuard(this); - - bool isLengthAttribute = attrName == SVGNames::cxAttr - || attrName == SVGNames::cyAttr - || attrName == SVGNames::rAttr; - - if (isLengthAttribute) - updateRelativeLengthsInformation(); - - RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); + auto* renderer = downcast(this->renderer()); if (!renderer) return; - if (isLengthAttribute) { - renderer->setNeedsShapeUpdate(); - RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); - return; - } - if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + InstanceInvalidationGuard guard(*this); RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); - return; } - - ASSERT_NOT_REACHED(); } -bool SVGCircleElement::selfHasRelativeLengths() const +RenderPtr SVGCircleElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - return cx().isRelative() - || cy().isRelative() - || r().isRelative(); + return createRenderer(*this, WTFMove(style)); } -RenderPtr SVGCircleElement::createElementRenderer(PassRef style) -{ - return createRenderer(*this, std::move(style)); } - -} - -#endif // ENABLE(SVG) -- cgit v1.2.1