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/SVGFEGaussianBlurElement.cpp | 60 ++++++------------------- 1 file changed, 14 insertions(+), 46 deletions(-) (limited to 'Source/WebCore/svg/SVGFEGaussianBlurElement.cpp') diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp b/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp index b58210726..7b21de836 100644 --- a/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp +++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp @@ -19,13 +19,9 @@ */ #include "config.h" - -#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFEGaussianBlurElement.h" -#include "Attribute.h" #include "FilterEffect.h" -#include "SVGElementInstance.h" #include "SVGFilterBuilder.h" #include "SVGNames.h" #include "SVGParserUtilities.h" @@ -54,20 +50,20 @@ inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& t registerAnimatedPropertiesForSVGFEGaussianBlurElement(); } -PassRefPtr SVGFEGaussianBlurElement::create(const QualifiedName& tagName, Document& document) +Ref SVGFEGaussianBlurElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGFEGaussianBlurElement(tagName, document)); + return adoptRef(*new SVGFEGaussianBlurElement(tagName, document)); } const AtomicString& SVGFEGaussianBlurElement::stdDeviationXIdentifier() { - DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGStdDeviationX", AtomicString::ConstructFromLiteral)); + static NeverDestroyed s_identifier("SVGStdDeviationX", AtomicString::ConstructFromLiteral); return s_identifier; } const AtomicString& SVGFEGaussianBlurElement::stdDeviationYIdentifier() { - DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGStdDeviationY", AtomicString::ConstructFromLiteral)); + static NeverDestroyed s_identifier("SVGStdDeviationY", AtomicString::ConstructFromLiteral); return s_identifier; } @@ -78,24 +74,8 @@ void SVGFEGaussianBlurElement::setStdDeviation(float x, float y) invalidate(); } -bool SVGFEGaussianBlurElement::isSupportedAttribute(const QualifiedName& attrName) -{ - DEFINE_STATIC_LOCAL(HashSet, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { - supportedAttributes.add(SVGNames::inAttr); - supportedAttributes.add(SVGNames::stdDeviationAttr); - supportedAttributes.add(SVGNames::edgeModeAttr); - } - return supportedAttributes.contains(attrName); -} - void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); - return; - } - if (name == SVGNames::stdDeviationAttr) { float x, y; if (parseNumberOptionalNumber(value, x, y)) { @@ -111,53 +91,41 @@ void SVGFEGaussianBlurElement::parseAttribute(const QualifiedName& name, const A } if (name == SVGNames::edgeModeAttr) { - EdgeModeType propertyValue = SVGPropertyTraits::fromString(value); + auto propertyValue = SVGPropertyTraits::fromString(value); if (propertyValue > 0) setEdgeModeBaseValue(propertyValue); else - document().accessSVGExtensions()->reportWarning( - "feGaussianBlur: problem parsing edgeMode=\"" + value - + "\". Filtered element will not be displayed."); + document().accessSVGExtensions().reportWarning("feGaussianBlur: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); return; } - ASSERT_NOT_REACHED(); + SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); } void SVGFEGaussianBlurElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); - return; - } - - SVGElementInstance::InvalidationGuard invalidationGuard(this); - - if (attrName == SVGNames::inAttr - || attrName == SVGNames::stdDeviationAttr - || attrName == SVGNames::edgeModeAttr) { + if (attrName == SVGNames::inAttr || attrName == SVGNames::stdDeviationAttr || attrName == SVGNames::edgeModeAttr) { + InstanceInvalidationGuard guard(*this); invalidate(); return; } - ASSERT_NOT_REACHED(); + SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); } -PassRefPtr SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) +RefPtr SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter& filter) { FilterEffect* input1 = filterBuilder->getEffectById(in1()); if (!input1) - return 0; + return nullptr; if (stdDeviationX() < 0 || stdDeviationY() < 0) - return 0; + return nullptr; RefPtr effect = FEGaussianBlur::create(filter, stdDeviationX(), stdDeviationY(), edgeMode()); effect->inputEffects().append(input1); - return effect.release(); + return effect; } } - -#endif // ENABLE(SVG) -- cgit v1.2.1