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

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: Fix space issue 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 d25e3de81c9b09863c3ba3742008fcf113278e91..0d79680239ede2f72ff7891f2e2018cce1d13585 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();
+ 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