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/SVGEllipseElement.cpp | 89 ++++++++------------------------ 1 file changed, 21 insertions(+), 68 deletions(-) (limited to 'Source/WebCore/svg/SVGEllipseElement.cpp') diff --git a/Source/WebCore/svg/SVGEllipseElement.cpp b/Source/WebCore/svg/SVGEllipseElement.cpp index e8e70f52c..96ec6a50e 100644 --- a/Source/WebCore/svg/SVGEllipseElement.cpp +++ b/Source/WebCore/svg/SVGEllipseElement.cpp @@ -19,17 +19,13 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGEllipseElement.h" -#include "Attribute.h" #include "FloatPoint.h" #include "RenderSVGEllipse.h" #include "RenderSVGPath.h" #include "RenderSVGResource.h" -#include "SVGElementInstance.h" -#include "SVGLength.h" +#include "SVGLengthValue.h" #include "SVGNames.h" namespace WebCore { @@ -61,95 +57,52 @@ inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Docume registerAnimatedPropertiesForSVGEllipseElement(); } -PassRefPtr SVGEllipseElement::create(const QualifiedName& tagName, Document& document) +Ref SVGEllipseElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGEllipseElement(tagName, document)); -} - -bool SVGEllipseElement::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::rxAttr); - supportedAttributes.add(SVGNames::ryAttr); - } - return supportedAttributes.contains(attrName); + return adoptRef(*new SVGEllipseElement(tagName, document)); } void SVGEllipseElement::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::rxAttr) - setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); + setRxBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); else if (name == SVGNames::ryAttr) - setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { - } else - ASSERT_NOT_REACHED(); + setRyBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); reportAttributeParsingError(parseError, name, value); + + SVGGraphicsElement::parseAttribute(name, value); + SVGExternalResourcesRequired::parseAttribute(name, value); } void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); - return; - } - - SVGElementInstance::InvalidationGuard invalidationGuard(this); - - bool isLengthAttribute = attrName == SVGNames::cxAttr - || attrName == SVGNames::cyAttr - || attrName == SVGNames::rxAttr - || attrName == SVGNames::ryAttr; - - if (isLengthAttribute) - updateRelativeLengthsInformation(); - - RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); - if (!renderer) - return; - - if (isLengthAttribute) { - renderer->setNeedsShapeUpdate(); - RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); + if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr || attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr) { + InstanceInvalidationGuard guard(*this); + invalidateSVGPresentationAttributeStyle(); return; } if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { - RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); + if (auto* renderer = downcast(this->renderer())) { + InstanceInvalidationGuard guard(*this); + RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); + } return; } - ASSERT_NOT_REACHED(); -} - -bool SVGEllipseElement::selfHasRelativeLengths() const -{ - return cx().isRelative() - || cy().isRelative() - || rx().isRelative() - || ry().isRelative(); + SVGGraphicsElement::svgAttributeChanged(attrName); } -RenderPtr SVGEllipseElement::createElementRenderer(PassRef style) +RenderPtr SVGEllipseElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - return createRenderer(*this, std::move(style)); + return createRenderer(*this, WTFMove(style)); } } - -#endif // ENABLE(SVG) -- cgit v1.2.1