Index: third_party/WebKit/Source/core/svg/SVGElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
index 961d67e3d0c115786343754399437aa026e4dc1b..d6b1fec83182a18db1c090445c82620478f66b18 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
@@ -1027,18 +1027,14 @@ PassRefPtr<ComputedStyle> SVGElement::customStyleForLayoutObject() { |
} |
bool SVGElement::layoutObjectIsNeeded(const ComputedStyle& style) { |
- // SVG elements only render when inside <svg>, or if the element is an <svg> |
- // itself. |
- if (!isSVGSVGElement(*this)) { |
- ContainerNode* parent = FlatTreeTraversal::parent(*this); |
- if (!parent || !parent->isSVGElement()) |
- return false; |
- } |
- |
- if (!isValid()) |
- return false; |
+ return isValid() && hasSVGParent() && Element::layoutObjectIsNeeded(style); |
+} |
- return Element::layoutObjectIsNeeded(style); |
+bool SVGElement::hasSVGParent() const { |
+ // Should we use the flat tree parent instead? If so, we should probably fix a |
+ // few other checks. |
+ return parentOrShadowHostElement() && |
+ parentOrShadowHostElement()->isSVGElement(); |
} |
MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const { |