SVGSwitchElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGSwitchElement.h"
#include "NodeRenderingContext.h"
#include "RenderSVGTransformableContainer.h"
#include "SVGNames.h"
namespace WebCore {
DEFINE_ANIMATED_BOOLEAN(SVGSwitchElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired)
BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement)
REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement)
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
END_REGISTER_ANIMATED_PROPERTIES
inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document* document)
: SVGStyledTransformableElement(tagName, document)
{
ASSERT(hasTagName(SVGNames::switchTag));
registerAnimatedPropertiesForSVGSwitchElement();
}
PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new SVGSwitchElement(tagName, document));
}
bool SVGSwitchElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
for (Node* node = firstChild(); node; node = node->nextSibling()) {
if (!node->isSVGElement())
continue;
SVGElement* element = toSVGElement(node);
if (!element || !element->isValid())
continue;
return node == childContext.node(); }
return false;
}
RenderObject* SVGSwitchElement::createRenderer(RenderArena* arena, RenderStyle*)
{
return new (arena) RenderSVGTransformableContainer(this);
}
}
#endif // ENABLE(SVG)