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

Unified Diff: Source/core/html/HTMLAllCollection.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 | « no previous file | Source/core/html/HTMLCollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLAllCollection.cpp
diff --git a/Source/core/html/HTMLAllCollection.cpp b/Source/core/html/HTMLAllCollection.cpp
index f9bbdf6e70d7640777da35c71d5a23b07f4f1fd6..e3bba65f05aac24ede580eb6a925af7e79eaf52b 100644
--- a/Source/core/html/HTMLAllCollection.cpp
+++ b/Source/core/html/HTMLAllCollection.cpp
@@ -50,15 +50,16 @@ Element* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigne
{
updateIdNameCache();
- if (Vector<Element*>* cache = idCache(name)) {
- if (index < cache->size())
- return cache->at(index);
- index -= cache->size();
+ const NamedItemCache& cache = namedItemCache();
+ if (Vector<Element*>* elements = cache.getElementsById(name)) {
+ if (index < elements->size())
+ return elements->at(index);
+ index -= elements->size();
}
- if (Vector<Element*>* cache = nameCache(name)) {
- if (index < cache->size())
- return cache->at(index);
+ if (Vector<Element*>* elements = cache.getElementsByName(name)) {
+ if (index < elements->size())
+ return elements->at(index);
}
return 0;
« no previous file with comments | « no previous file | Source/core/html/HTMLCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698