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

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

Issue 336133002: Drop traverseNextElement() method from HTMLCollection class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/html/HTMLCollection.h ('k') | no next file » | 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 83a79e47374c7e1366ccccaf69d4636b31a4095a..4e921005a204073032dbccbba890c7d6c53f5f58 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -365,15 +365,6 @@ Element* HTMLCollection::traverseToLastElement() const
return lastMatchingElement(*this);
}
-inline Element* HTMLCollection::traverseNextElement(Element& previous) const
-{
- if (overridesItemAfter())
- return virtualItemAfter(&previous);
- if (shouldOnlyIncludeDirectChildren())
- return nextMatchingChildElement(*this, previous);
- return nextMatchingElement(*this, previous);
-}
-
Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset) const
{
ASSERT(currentOffset < offset);
@@ -455,7 +446,9 @@ void HTMLCollection::supportedPropertyNames(Vector<String>& names)
// nor is in result, append element's name attribute value to result.
// 3. Return result.
HashSet<AtomicString> existingNames;
- for (Element* element = traverseToFirstElement(); element; element = traverseNextElement(*element)) {
+ unsigned length = this-> length();
adamk 2014/06/16 20:25:08 Nit: space between "this->" and "length()". Also,
Inactive 2014/06/16 20:41:09 As I said on my other CL, length() is not a trivia
Inactive 2014/06/16 20:45:51 I fixed the space issue, thanks. Let me know if yo
+ for (unsigned i = 0; i < length; ++i) {
+ Element* element = item(i);
const AtomicString& idAttribute = element->getIdAttribute();
if (!idAttribute.isEmpty()) {
HashSet<AtomicString>::AddResult addResult = existingNames.add(idAttribute);
@@ -484,7 +477,9 @@ void HTMLCollection::updateIdNameCache() const
return;
OwnPtrWillBeRawPtr<NamedItemCache> cache = NamedItemCache::create();
- for (Element* element = traverseToFirstElement(); element; element = traverseNextElement(*element)) {
+ unsigned length = this->length();
+ for (unsigned i = 0; i < length; ++i) {
+ Element* element = item(i);
const AtomicString& idAttrVal = element->getIdAttribute();
if (!idAttrVal.isEmpty())
cache->addElementWithId(idAttrVal, element);
« no previous file with comments | « Source/core/html/HTMLCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698