This source file includes following definitions.
- create
- build
#include "config.h"
#include "core/svg/SVGFEMergeElement.h"
#include "SVGNames.h"
#include "platform/graphics/filters/FilterEffect.h"
#include "core/svg/SVGFEMergeNodeElement.h"
#include "core/svg/graphics/filters/SVGFilterBuilder.h"
namespace WebCore {
inline SVGFEMergeElement::SVGFEMergeElement(Document& document)
: SVGFilterPrimitiveStandardAttributes(SVGNames::feMergeTag, document)
{
ScriptWrappable::init(this);
}
PassRefPtr<SVGFEMergeElement> SVGFEMergeElement::create(Document& document)
{
return adoptRef(new SVGFEMergeElement(document));
}
PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilder, Filter* filter)
{
RefPtr<FilterEffect> effect = FEMerge::create(filter);
FilterEffectVector& mergeInputs = effect->inputEffects();
for (SVGFEMergeNodeElement* element = Traversal<SVGFEMergeNodeElement>::firstChild(*this); element; element = Traversal<SVGFEMergeNodeElement>::nextSibling(*element)) {
FilterEffect* mergeEffect = filterBuilder->getEffectById(AtomicString(element->in1()->currentValue()->value()));
if (!mergeEffect)
return nullptr;
mergeInputs.append(mergeEffect);
}
if (mergeInputs.isEmpty())
return nullptr;
return effect.release();
}
}