Commit 02a844cd authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Drop traverseNextElement() method from HTMLCollection class

Drop traverseNextElement() method from HTMLCollection class to avoid code
duplication with traverseForwardToOffset(). This method was only used
by supportedPropertyNames() and updateIdNameCache(). Now these methods
uses the standard traversal API (HTMLCollection::length() / item(index)),
and thus the standard code path for HTMLCollection traversal.

I did not see any regression with this change on Dromaeo:
http://dromaeo.com/?id=223149,223150

R=adamk@chromium.org, esprehn@chromium.org

Review URL: https://codereview.chromium.org/336133002

git-svn-id: svn://svn.chromium.org/blink/trunk@176253 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ff62b006
......@@ -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);
......
......@@ -125,8 +125,6 @@ protected:
}
private:
Element* traverseNextElement(Element& previous) const;
void invalidateIdNameCacheMaps(Document* oldDocument = 0) const
{
if (!hasValidIdNameCache())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment