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

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

Issue 2765653002: Remove a level of indirection in HTMLCollection. (Closed)
Patch Set: Created 3 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 | « third_party/WebKit/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: third_party/WebKit/Source/core/html/HTMLCollection.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCollection.cpp b/third_party/WebKit/Source/core/html/HTMLCollection.cpp
index 05d54114d36d9ea4453ea1a00c900ead312c77a3..a7c80953224db179c79129dd2744cf5fe7997508 100644
--- a/third_party/WebKit/Source/core/html/HTMLCollection.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCollection.cpp
@@ -419,11 +419,11 @@ Element* HTMLCollection::namedItem(const AtomicString& name) const {
updateIdNameCache();
const NamedItemCache& cache = namedItemCache();
- HeapVector<Member<Element>>* idResults = cache.getElementsById(name);
+ const auto* idResults = cache.getElementsById(name);
if (idResults && !idResults->isEmpty())
return idResults->front();
- HeapVector<Member<Element>>* nameResults = cache.getElementsByName(name);
+ const auto* nameResults = cache.getElementsByName(name);
if (nameResults && !nameResults->isEmpty())
return nameResults->front();
@@ -511,15 +511,10 @@ void HTMLCollection::namedItems(const AtomicString& name,
updateIdNameCache();
const NamedItemCache& cache = namedItemCache();
- if (HeapVector<Member<Element>>* idResults = cache.getElementsById(name)) {
- for (const auto& element : *idResults)
- result.push_back(element);
- }
- if (HeapVector<Member<Element>>* nameResults =
- cache.getElementsByName(name)) {
- for (const auto& element : *nameResults)
- result.push_back(element);
- }
+ if (const auto* idResults = cache.getElementsById(name))
+ result.appendVector(*idResults);
+ if (const auto* nameResults = cache.getElementsByName(name))
+ result.appendVector(*nameResults);
}
HTMLCollection::NamedItemCache::NamedItemCache() {}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698