Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1816)

Unified Diff: Source/core/svg/SVGSwitchElement.cpp

Issue 147213004: Revert of Convert remaining RenderSVG* nodes to RenderObject::isChildAllowed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase; Include r166238. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGSwitchElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/svg/SVGSwitchElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698