summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGFEGaussianBlurElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGFEGaussianBlurElement.cpp60
1 files changed, 14 insertions, 46 deletions
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> SVGFEGaussianBlurElement::create(const QualifiedName& tagName, Document& document)
+Ref<SVGFEGaussianBlurElement> 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<AtomicString> s_identifier("SVGStdDeviationX", AtomicString::ConstructFromLiteral);
return s_identifier;
}
const AtomicString& SVGFEGaussianBlurElement::stdDeviationYIdentifier()
{
- DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGStdDeviationY", AtomicString::ConstructFromLiteral));
+ static NeverDestroyed<AtomicString> 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<QualifiedName>, supportedAttributes, ());
- if (supportedAttributes.isEmpty()) {
- supportedAttributes.add(SVGNames::inAttr);
- supportedAttributes.add(SVGNames::stdDeviationAttr);
- supportedAttributes.add(SVGNames::edgeModeAttr);
- }
- return supportedAttributes.contains<SVGAttributeHashTranslator>(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<EdgeModeType>::fromString(value);
+ auto propertyValue = SVGPropertyTraits<EdgeModeType>::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<FilterEffect> SVGFEGaussianBlurElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
+RefPtr<FilterEffect> 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<FilterEffect> effect = FEGaussianBlur::create(filter, stdDeviationX(), stdDeviationY(), edgeMode());
effect->inputEffects().append(input1);
- return effect.release();
+ return effect;
}
}
-
-#endif // ENABLE(SVG)