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

Unified Diff: Source/core/rendering/svg/RenderSVGTransformableContainer.cpp

Issue 145333003: Convert remaining RenderSVG* nodes to RenderObject::isChildAllowed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove some instances of childShouldCreateRenderer. 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/rendering/svg/RenderSVGTransformableContainer.h ('k') | Source/core/svg/SVGAElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
diff --git a/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp b/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
index e666e2bb71286b7b4fb33d9e33d8f713ed2340da..c55400cd13260b9cac3f6efe4f2b8717cf9afef4 100644
--- a/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
+++ b/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
@@ -37,6 +37,37 @@ RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGGraphicsElem
{
}
+static bool hasValidPredecessor(const Node* node)
+{
+ ASSERT(node);
+ while ((node = node->previousSibling())) {
+ if (node->isSVGElement() && toSVGElement(node)->isValid())
+ return true;
+ }
+ return false;
+}
+
+bool RenderSVGTransformableContainer::isChildAllowed(RenderObject* child, RenderStyle* style) const
+{
+ if (element()->hasTagName(SVGNames::switchTag)) {
+ Node* node = child->node();
+ // Reject non-SVG/non-valid elements.
+ if (!node->isSVGElement() || !toSVGElement(node)->isValid())
+ return false;
+ // Reject this child if it isn't the first valid node.
+ if (hasValidPredecessor(node))
+ return false;
+ } else if (element()->hasTagName(SVGNames::aTag)) {
+ // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment
+ // The 'a' element may contain any element that its parent may contain, except itself.
+ if (child->node()->hasTagName(SVGNames::aTag))
+ return false;
+ if (parent() && parent()->isSVG())
+ return parent()->isChildAllowed(child, style);
+ }
+ return RenderSVGContainer::isChildAllowed(child, style);
+}
+
bool RenderSVGTransformableContainer::calculateLocalTransform()
{
SVGGraphicsElement* element = toSVGGraphicsElement(this->element());
« no previous file with comments | « Source/core/rendering/svg/RenderSVGTransformableContainer.h ('k') | Source/core/svg/SVGAElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698