SVGFEMergeElement.cpp [plain text]
#include "config.h"
#include "SVGFEMergeElement.h"
#include "ElementIterator.h"
#include "FEMerge.h"
#include "FilterEffect.h"
#include "SVGFEMergeNodeElement.h"
#include "SVGFilterBuilder.h"
#include "SVGNames.h"
namespace WebCore {
inline SVGFEMergeElement::SVGFEMergeElement(const QualifiedName& tagName, Document& document)
: SVGFilterPrimitiveStandardAttributes(tagName, document)
{
ASSERT(hasTagName(SVGNames::feMergeTag));
}
Ref<SVGFEMergeElement> SVGFEMergeElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(*new SVGFEMergeElement(tagName, document));
}
RefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilder, Filter& filter)
{
RefPtr<FilterEffect> effect = FEMerge::create(filter);
FilterEffectVector& mergeInputs = effect->inputEffects();
for (auto& mergeNode : childrenOfType<SVGFEMergeNodeElement>(*this)) {
FilterEffect* mergeEffect = filterBuilder->getEffectById(mergeNode.in1());
if (!mergeEffect)
return nullptr;
mergeInputs.append(mergeEffect);
}
if (mergeInputs.isEmpty())
return nullptr;
return effect;
}
}