Chromium Code Reviews| Index: Source/core/html/HTMLCollection.cpp |
| diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp |
| index b6e97846a2b1925cb0561d7564a40462ce690d61..4a86cc321c885531dc5c115afa328a0c26794752 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 = ¤t; |
| 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 = ¤tElement; |
| - while ((next = nextMatchingChildElement(this, next, root))) { |
| + while ((next = nextMatchingChildElement(this, *next, root))) { |
|
adamk
2013/11/12 21:07:43
And more extra parens here.
|
| if (++currentOffset == offset) |
| return next; |
| } |