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..8c497432632b35efb52cb35d2f37182737232fcc 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
@@ -1029,11 +1029,8 @@ 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 (!isSVGSVGElement(*this) && !isInSVGSubtree()) |
fs
2017/02/12 10:25:36
Given that we have an override for SVGSVGElement a
|
+ return false; |
if (!isValid()) |
return false; |
@@ -1041,6 +1038,17 @@ bool SVGElement::layoutObjectIsNeeded(const ComputedStyle& style) { |
return Element::layoutObjectIsNeeded(style); |
} |
+bool SVGElement::isValidAndInSVGSubtree() const { |
+ return isInSVGSubtree() && isValid(); |
+} |
+ |
+bool SVGElement::isInSVGSubtree() const { |
fs
2017/02/12 10:25:36
Maybe "hasSVGParent" or "hasSVGAncestor" or someth
|
+ // Should we use the flat tree parent instead? If so, we should probably fix a |
+ // few other checks. |
+ return parentOrShadowHostElement() || |
fs
2017/02/12 10:25:35
&&
|
+ parentOrShadowHostElement()->isSVGElement(); |
+} |
+ |
MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const { |
if (hasSVGRareData()) |
return svgRareData()->animatedSMILStyleProperties(); |