*/
#include "config.h"
-
#include "core/svg/SVGRectElement.h"
#include "core/rendering/svg/RenderSVGRect.h"
-#include "core/rendering/svg/RenderSVGResource.h"
-#include "core/svg/SVGElementInstance.h"
#include "core/svg/SVGLength.h"
-namespace WebCore {
+namespace blink {
inline SVGRectElement::SVGRectElement(Document& document)
: SVGGeometryElement(SVGNames::rectTag, document)
, m_rx(SVGAnimatedLength::create(this, SVGNames::rxAttr, SVGLength::create(LengthModeWidth), ForbidNegativeLengths))
, m_ry(SVGAnimatedLength::create(this, SVGNames::ryAttr, SVGLength::create(LengthModeHeight), ForbidNegativeLengths))
{
- ScriptWrappable::init(this);
-
addToPropertyMap(m_x);
addToPropertyMap(m_y);
addToPropertyMap(m_width);
addToPropertyMap(m_ry);
}
-PassRefPtr<SVGRectElement> SVGRectElement::create(Document& document)
-{
- return adoptRef(new SVGRectElement(document));
-}
+DEFINE_NODE_FACTORY(SVGRectElement)
bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName)
{
void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(name))
- SVGGeometryElement::parseAttribute(name, value);
- else if (name == SVGNames::xAttr)
- m_x->setBaseValueAsString(value, parseError);
- else if (name == SVGNames::yAttr)
- m_y->setBaseValueAsString(value, parseError);
- else if (name == SVGNames::rxAttr)
- m_rx->setBaseValueAsString(value, parseError);
- else if (name == SVGNames::ryAttr)
- m_ry->setBaseValueAsString(value, parseError);
- else if (name == SVGNames::widthAttr)
- m_width->setBaseValueAsString(value, parseError);
- else if (name == SVGNames::heightAttr)
- m_height->setBaseValueAsString(value, parseError);
- else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, name, value);
+ parseAttributeNew(name, value);
}
void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
- SVGElementInstance::InvalidationGuard invalidationGuard(this);
+ SVGElement::InvalidationGuard invalidationGuard(this);
bool isLengthAttribute = attrName == SVGNames::xAttr
|| attrName == SVGNames::yAttr
if (isLengthAttribute) {
renderer->setNeedsShapeUpdate();
- RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+ markForLayoutAndParentResourceInvalidation(renderer);
return;
}
return new RenderSVGRect(this);
}
-}
+} // namespace blink