diff options
Diffstat (limited to 'Source/WebCore/svg/SVGFEDisplacementMapElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGFEDisplacementMapElement.cpp | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp b/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp index 95eb4cd88..e989b9ce3 100644 --- a/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp +++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp @@ -18,13 +18,9 @@ */ #include "config.h" - -#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEDisplacementMapElement.h" -#include "Attribute.h" #include "FilterEffect.h" -#include "SVGElementInstance.h" #include "SVGFilterBuilder.h" #include "SVGNames.h" @@ -55,40 +51,22 @@ inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedN registerAnimatedPropertiesForSVGFEDisplacementMapElement(); } -PassRefPtr<SVGFEDisplacementMapElement> SVGFEDisplacementMapElement::create(const QualifiedName& tagName, Document& document) -{ - return adoptRef(new SVGFEDisplacementMapElement(tagName, document)); -} - -bool SVGFEDisplacementMapElement::isSupportedAttribute(const QualifiedName& attrName) +Ref<SVGFEDisplacementMapElement> SVGFEDisplacementMapElement::create(const QualifiedName& tagName, Document& document) { - DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { - supportedAttributes.add(SVGNames::inAttr); - supportedAttributes.add(SVGNames::in2Attr); - supportedAttributes.add(SVGNames::xChannelSelectorAttr); - supportedAttributes.add(SVGNames::yChannelSelectorAttr); - supportedAttributes.add(SVGNames::scaleAttr); - } - return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); + return adoptRef(*new SVGFEDisplacementMapElement(tagName, document)); } void SVGFEDisplacementMapElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); - return; - } - if (name == SVGNames::xChannelSelectorAttr) { - ChannelSelectorType propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); + auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); if (propertyValue > 0) setXChannelSelectorBaseValue(propertyValue); return; } if (name == SVGNames::yChannelSelectorAttr) { - ChannelSelectorType propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); + auto propertyValue = SVGPropertyTraits<ChannelSelectorType>::fromString(value); if (propertyValue > 0) setYChannelSelectorBaseValue(propertyValue); return; @@ -109,7 +87,7 @@ void SVGFEDisplacementMapElement::parseAttribute(const QualifiedName& name, cons return; } - ASSERT_NOT_REACHED(); + SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); } bool SVGFEDisplacementMapElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName) @@ -128,42 +106,35 @@ bool SVGFEDisplacementMapElement::setFilterEffectAttribute(FilterEffect* effect, void SVGFEDisplacementMapElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); - return; - } - - SVGElementInstance::InvalidationGuard invalidationGuard(this); - if (attrName == SVGNames::xChannelSelectorAttr || attrName == SVGNames::yChannelSelectorAttr || attrName == SVGNames::scaleAttr) { + InstanceInvalidationGuard guard(*this); primitiveAttributeChanged(attrName); return; } if (attrName == SVGNames::inAttr || attrName == SVGNames::in2Attr) { + InstanceInvalidationGuard guard(*this); invalidate(); return; } - ASSERT_NOT_REACHED(); + SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); } -PassRefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) +RefPtr<FilterEffect> SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) { FilterEffect* input1 = filterBuilder->getEffectById(in1()); FilterEffect* input2 = filterBuilder->getEffectById(in2()); if (!input1 || !input2) - return 0; + return nullptr; RefPtr<FilterEffect> effect = FEDisplacementMap::create(filter, xChannelSelector(), yChannelSelector(), scale()); FilterEffectVector& inputEffects = effect->inputEffects(); inputEffects.reserveCapacity(2); inputEffects.append(input1); inputEffects.append(input2); - return effect.release(); + return effect; } } - -#endif // ENABLE(SVG) |