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

Unified Diff: third_party/WebKit/Source/core/svg/SVGUseElement.cpp

Issue 1754693002: Remove redundant check in SVGUseElement::buildShadowTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGUseElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
index 848977a8c55afef5d40533597c9cc9bee470dcb2..a729dbd6fa17cf14f72deb7affcff23adccee23f 100644
--- a/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGUseElement.cpp
@@ -411,15 +411,12 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
// SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it!
// Non-appearing <use> content is easier to debug, then half-appearing content.
- if (!buildShadowTree(target, m_targetElementInstance.get(), false)) {
- clearShadowTree();
- return;
- }
+ buildShadowTree(target, m_targetElementInstance.get(), false);
if (instanceTreeIsLoading(m_targetElementInstance.get()))
return;
- // Assure shadow tree building was successfull
+ // Assure shadow tree building was successful.
ASSERT(m_targetElementInstance);
ASSERT(m_targetElementInstance->correspondingUseElement() == this);
ASSERT(m_targetElementInstance->correspondingElement() == target);
@@ -502,10 +499,11 @@ SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const
return &toSVGGraphicsElement(element);
}
-bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstance, bool foundUse)
+void SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstance, bool foundUse)
{
ASSERT(target);
ASSERT(targetInstance);
+ ASSERT(!isDisallowedElement(target));
// Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced
// object, the instance tree will contain recursive expansion of the indirect references to form a complete tree.
@@ -516,8 +514,6 @@ bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan
addReferenceTo(target);
foundUse = true;
}
- } else if (isDisallowedElement(target)) {
- return false;
}
targetInstance->setCorrespondingElement(target);
@@ -533,11 +529,9 @@ bool SVGUseElement::buildShadowTree(SVGElement* target, SVGElement* targetInstan
targetInstance->appendChild(newChild.get());
if (newChild->isSVGElement()) {
// Enter recursion, appending new instance tree nodes to the "instance" object.
- if (!buildShadowTree(toSVGElement(child), toSVGElement(newChild), foundUse))
- return false;
+ buildShadowTree(toSVGElement(child), toSVGElement(newChild), foundUse);
}
}
- return true;
}
bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, ContainerNode* targetInstance, SVGElement*& newTarget)
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698