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

Unified Diff: Source/core/dom/TreeScopeAdopter.cpp

Issue 642973003: Introduce typed Node/Element iterators for range-based for loops of C++11. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename `from` to `fromNext`. Make some parameters const references. Created 6 years, 2 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
Index: Source/core/dom/TreeScopeAdopter.cpp
diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
index 6325b47cd6a2e7136bbe9aadf0aa1581cf0a9274..09bad9e687b8b25f609b5f71a7752e2cabbdfe24 100644
--- a/Source/core/dom/TreeScopeAdopter.cpp
+++ b/Source/core/dom/TreeScopeAdopter.cpp
@@ -53,29 +53,29 @@ void TreeScopeAdopter::moveTreeToNewScope(Node& root) const
if (willMoveToNewDocument)
oldDocument.incDOMTreeVersion();
- for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) {
- updateTreeScope(*node);
+ for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
+ updateTreeScope(node);
if (willMoveToNewDocument) {
if (axObjectCache)
- axObjectCache->remove(node);
- moveNodeToNewDocument(*node, oldDocument, newDocument);
- } else if (node->hasRareData()) {
- NodeRareData* rareData = node->rareData();
+ axObjectCache->remove(&node);
+ moveNodeToNewDocument(node, oldDocument, newDocument);
+ } else if (node.hasRareData()) {
+ NodeRareData* rareData = node.rareData();
if (rareData->nodeLists())
rareData->nodeLists()->adoptTreeScope();
}
- if (!node->isElementNode())
+ if (!node.isElementNode())
continue;
- if (node->hasSyntheticAttrChildNodes()) {
- WillBeHeapVector<RefPtrWillBeMember<Attr> >& attrs = *toElement(node)->attrNodeList();
+ if (node.hasSyntheticAttrChildNodes()) {
+ WillBeHeapVector<RefPtrWillBeMember<Attr> >& attrs = *toElement(node).attrNodeList();
for (unsigned i = 0; i < attrs.size(); ++i)
moveTreeToNewScope(*attrs[i]);
}
- for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) {
+ for (ShadowRoot* shadow = node.youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) {
shadow->setParentTreeScope(newScope());
if (willMoveToNewDocument)
moveTreeToNewDocument(*shadow, oldDocument, newDocument);

Powered by Google App Engine
This is Rietveld 408576698