diff options
Diffstat (limited to 'Source/WebCore/svg/SVGFEMorphologyElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGFEMorphologyElement.cpp | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.cpp b/Source/WebCore/svg/SVGFEMorphologyElement.cpp index 784a50d1a..3370e1855 100644 --- a/Source/WebCore/svg/SVGFEMorphologyElement.cpp +++ b/Source/WebCore/svg/SVGFEMorphologyElement.cpp @@ -18,13 +18,9 @@ */ #include "config.h" - -#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEMorphologyElement.h" -#include "Attribute.h" #include "FilterEffect.h" -#include "SVGElementInstance.h" #include "SVGFilterBuilder.h" #include "SVGNames.h" #include "SVGParserUtilities.h" @@ -53,20 +49,20 @@ inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagNa registerAnimatedPropertiesForSVGFEMorphologyElement(); } -PassRefPtr<SVGFEMorphologyElement> SVGFEMorphologyElement::create(const QualifiedName& tagName, Document& document) +Ref<SVGFEMorphologyElement> SVGFEMorphologyElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGFEMorphologyElement(tagName, document)); + return adoptRef(*new SVGFEMorphologyElement(tagName, document)); } const AtomicString& SVGFEMorphologyElement::radiusXIdentifier() { - DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGRadiusX", AtomicString::ConstructFromLiteral)); + static NeverDestroyed<AtomicString> s_identifier("SVGRadiusX", AtomicString::ConstructFromLiteral); return s_identifier; } const AtomicString& SVGFEMorphologyElement::radiusYIdentifier() { - DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGRadiusY", AtomicString::ConstructFromLiteral)); + static NeverDestroyed<AtomicString> s_identifier("SVGRadiusY", AtomicString::ConstructFromLiteral); return s_identifier; } @@ -77,24 +73,8 @@ void SVGFEMorphologyElement::setRadius(float x, float y) invalidate(); } -bool SVGFEMorphologyElement::isSupportedAttribute(const QualifiedName& attrName) -{ - DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { - supportedAttributes.add(SVGNames::inAttr); - supportedAttributes.add(SVGNames::operatorAttr); - supportedAttributes.add(SVGNames::radiusAttr); - } - return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); -} - void SVGFEMorphologyElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); - return; - } - if (name == SVGNames::operatorAttr) { MorphologyOperatorType propertyValue = SVGPropertyTraits<MorphologyOperatorType>::fromString(value); if (propertyValue > 0) @@ -116,7 +96,7 @@ void SVGFEMorphologyElement::parseAttribute(const QualifiedName& name, const Ato return; } - ASSERT_NOT_REACHED(); + SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); } bool SVGFEMorphologyElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName) @@ -137,43 +117,36 @@ bool SVGFEMorphologyElement::setFilterEffectAttribute(FilterEffect* effect, cons void SVGFEMorphologyElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); - return; - } - - SVGElementInstance::InvalidationGuard invalidationGuard(this); - if (attrName == SVGNames::operatorAttr || attrName == SVGNames::radiusAttr) { + InstanceInvalidationGuard guard(*this); primitiveAttributeChanged(attrName); return; } if (attrName == SVGNames::inAttr) { + InstanceInvalidationGuard guard(*this); invalidate(); return; } - ASSERT_NOT_REACHED(); + SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); } -PassRefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) +RefPtr<FilterEffect> SVGFEMorphologyElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) { FilterEffect* input1 = filterBuilder->getEffectById(in1()); float xRadius = radiusX(); float yRadius = radiusY(); if (!input1) - return 0; + return nullptr; if (xRadius < 0 || yRadius < 0) - return 0; + return nullptr; RefPtr<FilterEffect> effect = FEMorphology::create(filter, svgOperator(), xRadius, yRadius); effect->inputEffects().append(input1); - return effect.release(); + return effect; } } // namespace WebCore - -#endif // ENABLE(SVG) |