#include "config.h"
#if ENABLE(SVG)
#include "SVGGElement.h"
#include "RenderSVGHiddenContainer.h"
#include "RenderSVGTransformableContainer.h"
namespace WebCore {
SVGGElement::SVGGElement(const QualifiedName& tagName, Document* doc)
: SVGStyledTransformableElement(tagName, doc)
, SVGTests()
, SVGLangSpace()
, SVGExternalResourcesRequired()
{
}
SVGGElement::~SVGGElement()
{
}
void SVGGElement::parseMappedAttribute(MappedAttribute* attr)
{
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGLangSpace::parseMappedAttribute(attr))
return;
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
SVGStyledTransformableElement::parseMappedAttribute(attr);
}
void SVGGElement::svgAttributeChanged(const QualifiedName& attrName)
{
SVGStyledTransformableElement::svgAttributeChanged(attrName);
RenderObject* renderer = this->renderer();
if (!renderer)
return;
if (SVGStyledTransformableElement::isKnownAttribute(attrName)) {
renderer->setNeedsTransformUpdate();
renderer->setNeedsLayout(true);
return;
}
if (SVGTests::isKnownAttribute(attrName)
|| SVGLangSpace::isKnownAttribute(attrName)
|| SVGExternalResourcesRequired::isKnownAttribute(attrName))
renderer->setNeedsLayout(true);
}
void SVGGElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGStyledTransformableElement::synchronizeProperty(attrName);
if (attrName == anyQName() || SVGExternalResourcesRequired::isKnownAttribute(attrName))
synchronizeExternalResourcesRequired();
}
RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
if (style->display() == NONE)
return new (arena) RenderSVGHiddenContainer(this);
return new (arena) RenderSVGTransformableContainer(this);
}
bool SVGGElement::rendererIsNeeded(RenderStyle*)
{
return parentNode() && parentNode()->isSVGElement();
}
}
#endif // ENABLE(SVG)