summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGCircleElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGCircleElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGCircleElement.cpp82
1 files changed, 19 insertions, 63 deletions
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> SVGCircleElement::create(const QualifiedName& tagName, Document& document)
+Ref<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Document& document)
{
- return adoptRef(new SVGCircleElement(tagName, document));
-}
-
-bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName)
-{
- DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, 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<SVGAttributeHashTranslator>(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<RenderSVGShape>(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<RenderElement> SVGCircleElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
{
- return cx().isRelative()
- || cy().isRelative()
- || r().isRelative();
+ return createRenderer<RenderSVGEllipse>(*this, WTFMove(style));
}
-RenderPtr<RenderElement> SVGCircleElement::createElementRenderer(PassRef<RenderStyle> style)
-{
- return createRenderer<RenderSVGEllipse>(*this, std::move(style));
}
-
-}
-
-#endif // ENABLE(SVG)