SVGForeignObjectElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)
#include "SVGForeignObjectElement.h"
#include "CSSPropertyNames.h"
#include "RenderForeignObject.h"
#include "SVGNames.h"
#include "SVGLength.h"
#include <wtf/Assertions.h>
namespace WebCore {
SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document *doc)
: SVGStyledTransformableElement(tagName, doc)
, SVGTests()
, SVGLangSpace()
, SVGExternalResourcesRequired()
, m_x(this, LengthModeWidth)
, m_y(this, LengthModeHeight)
, m_width(this, LengthModeWidth)
, m_height(this, LengthModeHeight)
{
}
SVGForeignObjectElement::~SVGForeignObjectElement()
{
}
ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, X, x, SVGNames::xAttr, m_x)
ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Y, y, SVGNames::yAttr, m_y)
ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Width, width, SVGNames::widthAttr, m_width)
ANIMATED_PROPERTY_DEFINITIONS(SVGForeignObjectElement, SVGLength, Length, length, Height, height, SVGNames::heightAttr, m_height)
void SVGForeignObjectElement::parseMappedAttribute(MappedAttribute *attr)
{
const AtomicString& value = attr->value();
if (attr->name() == SVGNames::xAttr)
setXBaseValue(SVGLength(this, LengthModeWidth, value));
else if (attr->name() == SVGNames::yAttr)
setYBaseValue(SVGLength(this, LengthModeHeight, value));
else if (attr->name() == SVGNames::widthAttr) {
setWidthBaseValue(SVGLength(this, LengthModeWidth, value));
addCSSProperty(attr, CSS_PROP_WIDTH, value);
} else if (attr->name() == SVGNames::heightAttr) {
setHeightBaseValue(SVGLength(this, LengthModeHeight, value));
addCSSProperty(attr, CSS_PROP_HEIGHT, value);
} else {
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGLangSpace::parseMappedAttribute(attr))
return;
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
SVGStyledTransformableElement::parseMappedAttribute(attr);
}
}
RenderObject* SVGForeignObjectElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
return new (arena) RenderForeignObject(this);
}
bool SVGForeignObjectElement::childShouldCreateRenderer(Node* child) const
{
return StyledElement::childShouldCreateRenderer(child);
}
}
#endif // ENABLE(SVG) && ENABLE(SVG_FOREIGN_OBJECT)