25 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
37 SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(
const QualifiedName& tagName, Document* doc)
38 : SVGStyledElement(tagName, doc)
39 , m_x(this, LengthModeWidth)
40 , m_y(this, LengthModeHeight)
41 , m_width(this, LengthModeWidth)
42 , m_height(this, LengthModeHeight)
45 setXBaseValue(SVGLength(
this, LengthModeWidth,
"0%"));
46 setYBaseValue(SVGLength(
this, LengthModeHeight,
"0%"));
49 setWidthBaseValue(SVGLength(
this, LengthModeWidth,
"100%"));
50 setHeightBaseValue(SVGLength(
this, LengthModeHeight,
"100%"));
53 SVGFilterPrimitiveStandardAttributes::~SVGFilterPrimitiveStandardAttributes()
57 ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength, Length, length, X, x,
SVGNames::xAttr, m_x)
58 ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength, Length, length, Y, y, SVGNames::
yAttr, m_y)
59 ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength, Length, length, Width, width, SVGNames::
widthAttr, m_width)
60 ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes, SVGLength, Length, length, Height, height, SVGNames::
heightAttr, m_height)
61 ANIMATED_PROPERTY_DEFINITIONS(SVGFilterPrimitiveStandardAttributes,
String, String,
string, Result, result, SVGNames::
resultAttr, m_result)
63 void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(MappedAttribute* attr)
65 const AtomicString& value = attr->value();
67 setXBaseValue(SVGLength(
this, LengthModeWidth, value));
69 setYBaseValue(SVGLength(
this, LengthModeHeight, value));
71 setWidthBaseValue(SVGLength(
this, LengthModeWidth, value));
73 setHeightBaseValue(SVGLength(
this, LengthModeHeight, value));
75 setResultBaseValue(value);
77 return SVGStyledElement::parseMappedAttribute(attr);
80 void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(SVGFilterEffect* filterEffect)
const
86 ASSERT(filterEffect->filter());
88 float _x, _y, _width, _height;
90 if (filterEffect->filter()->effectBoundingBoxMode()) {
91 _x = x().valueAsPercentage();
92 _y = y().valueAsPercentage();
93 _width = width().valueAsPercentage();
94 _height = height().valueAsPercentage();
97 if (x().unitType() == LengthTypePercentage) {
98 filterEffect->setXBoundingBoxMode(
true);
99 _x = x().valueAsPercentage();
101 filterEffect->setXBoundingBoxMode(
false);
105 if (y().unitType() == LengthTypePercentage) {
106 filterEffect->setYBoundingBoxMode(
true);
107 _y = y().valueAsPercentage();
109 filterEffect->setYBoundingBoxMode(
false);
113 if (width().unitType() == LengthTypePercentage) {
114 filterEffect->setWidthBoundingBoxMode(
true);
115 _width = width().valueAsPercentage();
117 filterEffect->setWidthBoundingBoxMode(
false);
118 _width = width().value();
121 if (height().unitType() == LengthTypePercentage) {
122 filterEffect->setHeightBoundingBoxMode(
true);
123 _height = height().valueAsPercentage();
125 filterEffect->setHeightBoundingBoxMode(
false);
126 _height = height().value();
130 filterEffect->setSubRegion(FloatRect(_x, _y, _width, _height));
131 filterEffect->setResult(result());
136 #endif // ENABLE(SVG)
DOM::QualifiedName widthAttr
DOM::QualifiedName resultAttr
DOM::QualifiedName heightAttr