SVGFEMergeNodeElement.cpp [plain text]
#include "config.h"
#if ENABLE(FILTERS)
#include "SVGFEMergeNodeElement.h"
#include "Attribute.h"
#include "RenderObject.h"
#include "RenderSVGResource.h"
#include "SVGElementInstance.h"
#include "SVGFilterElement.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
#include "SVGNames.h"
#include <wtf/NeverDestroyed.h>
namespace WebCore {
DEFINE_ANIMATED_STRING(SVGFEMergeNodeElement, SVGNames::inAttr, In1, in1)
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMergeNodeElement)
REGISTER_LOCAL_ANIMATED_PROPERTY(in1)
END_REGISTER_ANIMATED_PROPERTIES
inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document& document)
: SVGElement(tagName, document)
{
ASSERT(hasTagName(SVGNames::feMergeNodeTag));
registerAnimatedPropertiesForSVGFEMergeNodeElement();
}
PassRefPtr<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(new SVGFEMergeNodeElement(tagName, document));
}
bool SVGFEMergeNodeElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty())
supportedAttributes.get().add(SVGNames::inAttr);
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
void SVGFEMergeNodeElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!isSupportedAttribute(name)) {
SVGElement::parseAttribute(name, value);
return;
}
if (name == SVGNames::inAttr) {
setIn1BaseValue(value);
return;
}
ASSERT_NOT_REACHED();
}
void SVGFEMergeNodeElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
SVGElement::svgAttributeChanged(attrName);
return;
}
SVGElementInstance::InvalidationGuard invalidationGuard(this);
if (attrName == SVGNames::inAttr) {
invalidateFilterPrimitiveParent(this);
return;
}
ASSERT_NOT_REACHED();
}
}
#endif // ENABLE(FILTERS)