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

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

Issue 192143002: Use isSVG*Element() helpers more in SVG code (Part 2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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/SVGTextPathElement.cpp ('k') | Source/core/svg/SVGVKernElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 54b58e3cbe9120b3a98946c0cc2b044aec73f2a6..94bbc4f8fd2df22c4b4890f39baa722c1c27dff5 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -243,10 +243,8 @@ static void dumpInstanceTree(unsigned int& depth, String& text, SVGElementInstan
SVGElement* element = targetInstance->correspondingElement();
ASSERT(element);
- if (element->hasTagName(SVGNames::useTag)) {
- if (toSVGUseElement(element)->resourceIsStillLoading())
- return;
- }
+ if (isSVGUseElement(*element) && toSVGUseElement(*element).resourceIsStillLoading())
+ return;
SVGElement* shadowTreeElement = targetInstance->shadowTreeElement();
ASSERT(shadowTreeElement);
@@ -557,9 +555,9 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta
// 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.
- bool targetHasUseTag = target->hasTagName(SVGNames::useTag);
+ bool targetIsUseElement = isSVGUseElement(*target);
SVGElement* newTarget = 0;
- if (targetHasUseTag) {
+ if (targetIsUseElement) {
foundProblem = hasCycleUseReferencing(toSVGUseElement(target), targetInstance, newTarget);
if (foundProblem)
return;
@@ -602,7 +600,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta
return;
}
- if (!targetHasUseTag || !newTarget)
+ if (!targetIsUseElement || !newTarget)
return;
RefPtr<SVGElementInstance> newInstance = SVGElementInstance::create(this, toSVGUseElement(target), newTarget);
@@ -676,6 +674,7 @@ void SVGUseElement::buildShadowTree(SVGElement* target, SVGElementInstance* targ
void SVGUseElement::expandUseElementsInShadowTree(Node* element)
{
+ ASSERT(element);
// Why expand the <use> elements in the shadow tree here, and not just
// do this directly in buildShadowTree, if we encounter a <use> element?
//
@@ -683,7 +682,7 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element)
// contains <use> tags, we'd miss them. So once we're done with settin' up the
// actual shadow tree (after the special case modification for svg/symbol) we have
// to walk it completely and expand all <use> elements.
- if (element->hasTagName(SVGNames::useTag)) {
+ if (isSVGUseElement(*element)) {
SVGUseElement* use = toSVGUseElement(element);
ASSERT(!use->resourceIsStillLoading());
« no previous file with comments | « Source/core/svg/SVGTextPathElement.cpp ('k') | Source/core/svg/SVGVKernElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698