diff options
Diffstat (limited to 'Source/WebCore/svg/SVGClipPathElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGClipPathElement.cpp | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/Source/WebCore/svg/SVGClipPathElement.cpp b/Source/WebCore/svg/SVGClipPathElement.cpp index 446dabeac..fa1876347 100644 --- a/Source/WebCore/svg/SVGClipPathElement.cpp +++ b/Source/WebCore/svg/SVGClipPathElement.cpp @@ -20,17 +20,13 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGClipPathElement.h" -#include "Attribute.h" #include "Document.h" #include "RenderSVGResourceClipper.h" -#include "SVGElementInstance.h" #include "SVGNames.h" -#include "SVGTransformList.h" #include "StyleResolver.h" +#include <wtf/NeverDestroyed.h> namespace WebCore { @@ -52,42 +48,33 @@ inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu registerAnimatedPropertiesForSVGClipPathElement(); } -PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document& document) +Ref<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGClipPathElement(tagName, document)); + return adoptRef(*new SVGClipPathElement(tagName, document)); } bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) { - DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { + static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; + if (supportedAttributes.get().isEmpty()) { SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); - supportedAttributes.add(SVGNames::clipPathUnitsAttr); + supportedAttributes.get().add(SVGNames::clipPathUnitsAttr); } - return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); + return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); } void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGGraphicsElement::parseAttribute(name, value); - return; - } - if (name == SVGNames::clipPathUnitsAttr) { - SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); + auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); if (propertyValue > 0) setClipPathUnitsBaseValue(propertyValue); return; } - if (SVGLangSpace::parseAttribute(name, value)) - return; - if (SVGExternalResourcesRequired::parseAttribute(name, value)) - return; - - ASSERT_NOT_REACHED(); + SVGGraphicsElement::parseAttribute(name, value); + SVGExternalResourcesRequired::parseAttribute(name, value); } void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) @@ -97,7 +84,7 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) return; } - SVGElementInstance::InvalidationGuard invalidationGuard(this); + InstanceInvalidationGuard guard(*this); if (RenderObject* object = renderer()) object->setNeedsLayout(); @@ -114,11 +101,9 @@ void SVGClipPathElement::childrenChanged(const ChildChange& change) object->setNeedsLayout(); } -RenderPtr<RenderElement> SVGClipPathElement::createElementRenderer(PassRef<RenderStyle> style) +RenderPtr<RenderElement> SVGClipPathElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - return createRenderer<RenderSVGResourceClipper>(*this, std::move(style)); + return createRenderer<RenderSVGResourceClipper>(*this, WTFMove(style)); } } - -#endif // ENABLE(SVG) |