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

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

Issue 205983004: Use new Traversal<*Element> API in svg code for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo 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/SVGSVGElement.cpp ('k') | no next file » | 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 6135db12db673f5a251a44b6671e25cea82c851f..108d4784cf5beb598468ab73fe31e681a06cd7ba 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -580,13 +580,9 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta
// is the SVGGElement object for the 'g', and then two child SVGElementInstance objects, each of which has
// its correspondingElement that is an SVGRectElement object.
- for (Node* node = target->firstChild(); node; node = node->nextSibling()) {
- SVGElement* element = 0;
- if (node->isSVGElement())
- element = toSVGElement(node);
-
- // Skip any non-svg nodes or any disallowed element.
- if (!element || isDisallowedElement(element))
+ for (SVGElement* element = Traversal<SVGElement>::firstChild(*target); element; element = Traversal<SVGElement>::nextSibling(*element)) {
+ // Skip any disallowed element.
+ if (isDisallowedElement(element))
continue;
// Create SVGElementInstance object, for both container/non-container nodes.
@@ -820,17 +816,10 @@ void SVGUseElement::associateInstancesWithShadowTreeElements(Node* target, SVGEl
targetInstance->setShadowTreeElement(element);
element->setCorrespondingElement(originalElement);
- Node* node = target->firstChild();
- for (SVGElementInstance* instance = targetInstance->firstChild(); node && instance; instance = instance->nextSibling()) {
- // Skip any non-svg elements in shadow tree
- while (node && !node->isSVGElement())
- node = node->nextSibling();
-
- if (!node)
- break;
-
- associateInstancesWithShadowTreeElements(node, instance);
- node = node->nextSibling();
+ SVGElement* child = Traversal<SVGElement>::firstChild(*target);
+ for (SVGElementInstance* instance = targetInstance->firstChild(); child && instance; instance = instance->nextSibling()) {
+ associateInstancesWithShadowTreeElements(child, instance);
+ child = Traversal<SVGElement>::nextSibling(*child);
}
}
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698