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

Unified Diff: Source/core/html/HTMLCollection.cpp

Issue 69543007: Have NodeTraversal::nextSkippingChildren() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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/editing/markup.cpp ('k') | Source/core/html/HTMLDialogElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCollection.cpp
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp
index 4c40d0bc55a39b4d7f2fdbc70fee9ab48b2da4f0..ff4ce6c0ce60f4936b631b27efffd2bef75d3f56 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -529,16 +529,17 @@ inline Element* firstMatchingChildElement(const HTMLCollection* nodeList, Contai
{
Element* element = ElementTraversal::firstWithin(root);
while (element && !isMatchingElement(nodeList, element))
- element = ElementTraversal::nextSkippingChildren(element, root);
+ element = ElementTraversal::nextSkippingChildren(*element, root);
return element;
}
-inline Element* nextMatchingChildElement(const HTMLCollection* nodeList, Element* current, ContainerNode* root)
+inline Element* nextMatchingChildElement(const HTMLCollection* nodeList, Element& current, ContainerNode* root)
{
+ Element* next = &current;
do {
- current = ElementTraversal::nextSkippingChildren(current, root);
- } while (current && !isMatchingElement(nodeList, current));
- return current;
+ next = ElementTraversal::nextSkippingChildren(*next, root);
+ } while (next && !isMatchingElement(nodeList, next));
+ return next;
}
inline Element* HTMLCollection::traverseFirstElement(unsigned& offsetInArray, ContainerNode* root) const
@@ -557,7 +558,7 @@ inline Element* HTMLCollection::traverseNextElement(unsigned& offsetInArray, Ele
return virtualItemAfter(offsetInArray, &previous);
ASSERT(!offsetInArray);
if (shouldOnlyIncludeDirectChildren())
- return nextMatchingChildElement(this, &previous, root);
+ return nextMatchingChildElement(this, previous, root);
return nextMatchingElement(this, previous, root);
}
@@ -575,7 +576,7 @@ inline Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element
}
if (shouldOnlyIncludeDirectChildren()) {
Element* next = &currentElement;
- while ((next = nextMatchingChildElement(this, next, root))) {
+ while ((next = nextMatchingChildElement(this, *next, root))) {
if (++currentOffset == offset)
return next;
}
« no previous file with comments | « Source/core/editing/markup.cpp ('k') | Source/core/html/HTMLDialogElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698