summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGEllipseElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGEllipseElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGEllipseElement.cpp89
1 files changed, 21 insertions, 68 deletions
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> SVGEllipseElement::create(const QualifiedName& tagName, Document& document)
+Ref<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, Document& document)
{
- return adoptRef(new SVGEllipseElement(tagName, document));
-}
-
-bool SVGEllipseElement::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::rxAttr);
- supportedAttributes.add(SVGNames::ryAttr);
- }
- return supportedAttributes.contains<SVGAttributeHashTranslator>(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<RenderSVGShape>(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<RenderElement> SVGEllipseElement::createElementRenderer(PassRef<RenderStyle> style)
+RenderPtr<RenderElement> SVGEllipseElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
{
- return createRenderer<RenderSVGEllipse>(*this, std::move(style));
+ return createRenderer<RenderSVGEllipse>(*this, WTFMove(style));
}
}
-
-#endif // ENABLE(SVG)