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

Unified Diff: third_party/WebKit/Source/web/ExternalPopupMenu.cpp

Issue 2143863003: Simplify protocol between SELECT elements and popups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@select-remove-fixed-args
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/web/ExternalPopupMenu.cpp
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
index c92afdccbeab8105d90c30b27f007eb6ae2a7d7b..7d62cd915242fd9b1d12be51699200d70fef9a8e 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
+++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -194,11 +194,12 @@ void ExternalPopupMenu::didAcceptIndex(int index)
if (m_ownerElement) {
m_ownerElement->popupDidHide();
- m_ownerElement->valueChanged(popupMenuItemIndex);
+ m_ownerElement->selectOptionByPopup(popupMenuItemIndex);
}
m_webExternalPopupMenu = 0;
}
+// Android uses this function even for single SELECT.
void ExternalPopupMenu::didAcceptIndices(const WebVector<int>& indices)
{
if (!m_ownerElement) {
@@ -210,10 +211,15 @@ void ExternalPopupMenu::didAcceptIndices(const WebVector<int>& indices)
ownerElement->popupDidHide();
if (indices.size() == 0) {
- ownerElement->valueChanged(static_cast<unsigned>(-1));
+ ownerElement->selectOptionByPopup(-1);
+ } else if (!ownerElement->multiple()) {
+ ownerElement->selectOptionByPopup(toPopupMenuItemIndex(indices[indices.size() - 1], *ownerElement));
} else {
+ Vector<int> listIndices;
+ listIndices.reserveCapacity(indices.size());
for (size_t i = 0; i < indices.size(); ++i)
- ownerElement->listBoxSelectItem(toPopupMenuItemIndex(indices[i], *ownerElement), (i > 0), (i == indices.size() - 1));
+ listIndices.append(toPopupMenuItemIndex(indices[i], *ownerElement));
+ ownerElement->selectMultipleOptionsByPopup(listIndices);
}
m_webExternalPopupMenu = 0;

Powered by Google App Engine
This is Rietveld 408576698