From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/svg/SVGFEDisplacementMapElement.cpp | 51 +++++----------------- 1 file changed, 11 insertions(+), 40 deletions(-) (limited to 'Source/WebCore/svg/SVGFEDisplacementMapElement.cpp') 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::create(const QualifiedName& tagName, Document& document) -{ - return adoptRef(new SVGFEDisplacementMapElement(tagName, document)); -} - -bool SVGFEDisplacementMapElement::isSupportedAttribute(const QualifiedName& attrName) +Ref SVGFEDisplacementMapElement::create(const QualifiedName& tagName, Document& document) { - DEFINE_STATIC_LOCAL(HashSet, 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(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::fromString(value); + auto propertyValue = SVGPropertyTraits::fromString(value); if (propertyValue > 0) setXChannelSelectorBaseValue(propertyValue); return; } if (name == SVGNames::yChannelSelectorAttr) { - ChannelSelectorType propertyValue = SVGPropertyTraits::fromString(value); + auto propertyValue = SVGPropertyTraits::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 SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) +RefPtr SVGFEDisplacementMapElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) { FilterEffect* input1 = filterBuilder->getEffectById(in1()); FilterEffect* input2 = filterBuilder->getEffectById(in2()); if (!input1 || !input2) - return 0; + return nullptr; RefPtr 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) -- cgit v1.2.1