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

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

Issue 215073003: Move HTMLCollection's id / name cache to a new NamedItemCache class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLFormControlsCollection.cpp
diff --git a/Source/core/html/HTMLFormControlsCollection.cpp b/Source/core/html/HTMLFormControlsCollection.cpp
index 2d23716f5e38813ab133f0e4d6c11adbe5e4c19f..580f3288bfb66fcc9bff09589b575a62926b723b 100644
--- a/Source/core/html/HTMLFormControlsCollection.cpp
+++ b/Source/core/html/HTMLFormControlsCollection.cpp
@@ -153,6 +153,7 @@ void HTMLFormControlsCollection::updateIdNameCache() const
if (hasValidIdNameCache())
return;
+ NamedItemCache& cache = createNamedItemCache();
HashSet<StringImpl*> foundInputElements;
const Vector<FormAssociatedElement*>& elementsArray = formControlElements();
@@ -164,11 +165,11 @@ void HTMLFormControlsCollection::updateIdNameCache() const
const AtomicString& idAttrVal = element->getIdAttribute();
const AtomicString& nameAttrVal = element->getNameAttribute();
if (!idAttrVal.isEmpty()) {
- appendIdCache(idAttrVal, element);
+ cache.addElementWithId(idAttrVal, element);
foundInputElements.add(idAttrVal.impl());
}
if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal) {
- appendNameCache(nameAttrVal, element);
+ cache.addElementWithName(nameAttrVal, element);
foundInputElements.add(nameAttrVal.impl());
}
}
@@ -181,13 +182,11 @@ void HTMLFormControlsCollection::updateIdNameCache() const
const AtomicString& idAttrVal = element->getIdAttribute();
const AtomicString& nameAttrVal = element->getNameAttribute();
if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl()))
- appendIdCache(idAttrVal, element);
+ cache.addElementWithId(idAttrVal, element);
if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInputElements.contains(nameAttrVal.impl()))
- appendNameCache(nameAttrVal, element);
+ cache.addElementWithName(nameAttrVal, element);
}
}
-
- setHasValidIdNameCache();
}
void HTMLFormControlsCollection::namedGetter(const AtomicString& name, bool& radioNodeListEnabled, RefPtr<RadioNodeList>& radioNodeList, bool& elementEnabled, RefPtr<Element>& element)
« no previous file with comments | « Source/core/html/HTMLCollection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698