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

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

Issue 2131073002: SELECT element: Avoid to use listItems() in HTMLSelectElement::selectOption() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
index 3f85a53534bdc75a37565030ea4201e165bcdc38..77af524708ff1d5fb6bc3500898b73c3539035f4 100644
--- a/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLOptionElement.cpp
@@ -183,13 +183,8 @@ int HTMLOptionElement::index() const
return 0;
int optionIndex = 0;
-
- const HeapVector<Member<HTMLElement>>& items = selectElement->listItems();
- size_t length = items.size();
- for (size_t i = 0; i < length; ++i) {
- if (!isHTMLOptionElement(*items[i]))
- continue;
- if (items[i].get() == this)
+ for (const auto& option : selectElement->optionList()) {
+ if (option == this)
return optionIndex;
++optionIndex;
}

Powered by Google App Engine
This is Rietveld 408576698