SVGSwitchElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGSwitchElement.h"
#include "RenderSVGTransformableContainer.h"
#include "SVGNames.h"
namespace WebCore {
DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document* document)
: SVGStyledTransformableElement(tagName, document)
{
ASSERT(hasTagName(SVGNames::switchTag));
}
PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new SVGSwitchElement(tagName, document));
}
bool SVGSwitchElement::childShouldCreateRenderer(Node* child) const
{
for (Node* node = firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = static_cast<SVGElement*>(node);
if (!element || !element->isValid())
continue;
return node == child; }
return false;
}
RenderObject* SVGSwitchElement::createRenderer(RenderArena* arena, RenderStyle*)
{
return new (arena) RenderSVGTransformableContainer(this);
}
void SVGSwitchElement::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& SVGSwitchElement::attributeToPropertyTypeMap()
{
DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_attributeToPropertyTypeMap, ());
return s_attributeToPropertyTypeMap;
}
void SVGSwitchElement::fillAttributeToPropertyTypeMap()
{
SVGStyledTransformableElement::fillPassedAttributeToPropertyTypeMap(attributeToPropertyTypeMap());
}
}
#endif // ENABLE(SVG)