Index: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
index edfa1c61e7b2bbb641948c0cfd806718ebb33027..5ca18ac916f25d24352a95b8c070180b0b38edb4 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp |
@@ -873,6 +873,17 @@ void HTMLSelectElement::setSelectedIndex(int index) |
selectOption(item(index), DeselectOtherOptions | MakeOptionDirty); |
} |
+int HTMLSelectElement::selectedListIndex() const |
+{ |
+ int index = 0; |
+ for (const auto& item : listItems()) { |
+ if (isHTMLOptionElement(item) && toHTMLOptionElement(item)->selected()) |
+ return index; |
+ ++index; |
+ } |
+ return -1; |
+} |
+ |
void HTMLSelectElement::setSuggestedOption(HTMLOptionElement* option) |
{ |
if (m_suggestedOption == option) |
@@ -1693,7 +1704,7 @@ HTMLOptionElement* HTMLSelectElement::lastSelectedOption() const |
int HTMLSelectElement::indexOfSelectedOption() const |
{ |
- return optionToListIndex(selectedIndex()); |
+ return selectedListIndex(); |
} |
int HTMLSelectElement::optionCount() const |