#include "config.h"
#if ENABLE(SVG)
#include "SVGGElement.h"
#include "RenderSVGHiddenContainer.h"
#include "RenderSVGResource.h"
#include "RenderSVGTransformableContainer.h"
#include "SVGNames.h"
namespace WebCore {
DEFINE_ANIMATED_BOOLEAN(SVGGElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document)
: SVGStyledTransformableElement(tagName, document)
{
ASSERT(hasTagName(SVGNames::gTag));
}
PassRefPtr<SVGGElement> SVGGElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new SVGGElement(tagName, document));
}
void SVGGElement::parseMappedAttribute(Attribute* 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);
if (SVGTests::handleAttributeChange(this, attrName))
return;
RenderObject* renderer = this->renderer();
if (!renderer)
return;
if (SVGLangSpace::isKnownAttribute(attrName)
|| SVGExternalResourcesRequired::isKnownAttribute(attrName))
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
void SVGGElement::synchronizeProperty(const QualifiedName& attrName)
{
SVGStyledTransformableElement::synchronizeProperty(attrName);
if (attrName == anyQName()) {
synchronizeExternalResourcesRequired();
SVGTests::synchronizeProperties(this, attrName);
return;
}
if (SVGExternalResourcesRequired::isKnownAttribute(attrName))
synchronizeExternalResourcesRequired();
else if (SVGTests::isKnownAttribute(attrName))
SVGTests::synchronizeProperties(this, attrName);
}
AttributeToPropertyTypeMap& SVGGElement::attributeToPropertyTypeMap()
{
DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_attributeToPropertyTypeMap, ());
return s_attributeToPropertyTypeMap;
}
void SVGGElement::fillAttributeToPropertyTypeMap()
{
SVGStyledTransformableElement::fillPassedAttributeToPropertyTypeMap(attributeToPropertyTypeMap());
}
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)