SVGFEOffsetElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG) && ENABLE(FILTERS)
#include "SVGFEOffsetElement.h"
#include "Attr.h"
#include "MappedAttribute.h"
namespace WebCore {
SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document* doc)
: SVGFilterPrimitiveStandardAttributes(tagName, doc)
{
}
SVGFEOffsetElement::~SVGFEOffsetElement()
{
}
void SVGFEOffsetElement::parseMappedAttribute(MappedAttribute* attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::dxAttr)
setDxBaseValue(value.toFloat());
else if (attr->name() == SVGNames::dyAttr)
setDyBaseValue(value.toFloat());
else if (attr->name() == SVGNames::inAttr)
setIn1BaseValue(value);
else
SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
}
void SVGFEOffsetElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGFilterPrimitiveStandardAttributes::synchronizeProperty(attrName);
if (attrName == anyQName()) {
synchronizeDx();
synchronizeDy();
synchronizeIn1();
return;
}
if (attrName == SVGNames::dxAttr)
synchronizeDx();
else if (attrName == SVGNames::dyAttr)
synchronizeDy();
else if (attrName == SVGNames::inAttr)
synchronizeIn1();
}
PassRefPtr<FilterEffect> SVGFEOffsetElement::build(SVGFilterBuilder* filterBuilder)
{
FilterEffect* input1 = filterBuilder->getEffectById(in1());
if (!input1)
return 0;
return FEOffset::create(input1, dx(), dy());
}
}
#endif // ENABLE(SVG)