Index: Source/core/svg/SVGSwitchElement.cpp |
diff --git a/Source/core/svg/SVGSwitchElement.cpp b/Source/core/svg/SVGSwitchElement.cpp |
index 539ef59f991d8a9a9a474993bc21988c8716b08c..e9e3faa8c116679f346c58b8917f2bb7a45a94e1 100644 |
--- a/Source/core/svg/SVGSwitchElement.cpp |
+++ b/Source/core/svg/SVGSwitchElement.cpp |
@@ -48,6 +48,26 @@ PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(Document& document) |
return adoptRef(new SVGSwitchElement(document)); |
} |
+bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const |
+{ |
+ // FIXME: This function does not do what the comment below implies it does. |
+ // It will create a renderer for any valid SVG element children, not just the first one. |
+ bool shouldCreateRenderer = false; |
+ for (Node* node = firstChild(); node; node = node->nextSibling()) { |
+ if (!node->isSVGElement()) |
+ continue; |
+ |
+ SVGElement* element = toSVGElement(node); |
+ if (!element || !element->isValid()) |
+ continue; |
+ |
+ shouldCreateRenderer = node == &child; // Only allow this child if it's the first valid child. |
+ break; |
+ } |
+ |
+ return shouldCreateRenderer && SVGGraphicsElement::childShouldCreateRenderer(child); |
+} |
+ |
RenderObject* SVGSwitchElement::createRenderer(RenderStyle*) |
{ |
return new RenderSVGTransformableContainer(this); |