| Index: Source/core/layout/LayoutMenuList.cpp
|
| diff --git a/Source/core/layout/LayoutMenuList.cpp b/Source/core/layout/LayoutMenuList.cpp
|
| index 2c696e7b02aa4e781a70919ef8429e2991d34cc4..03fb69df686c6b072067483976dca090b9ba83bb 100644
|
| --- a/Source/core/layout/LayoutMenuList.cpp
|
| +++ b/Source/core/layout/LayoutMenuList.cpp
|
| @@ -59,6 +59,7 @@ LayoutMenuList::LayoutMenuList(Element* element)
|
| , m_optionsWidth(0)
|
| , m_lastActiveIndex(-1)
|
| , m_popupIsVisible(false)
|
| + , m_popupTemporarySelectedIndex(-1)
|
| {
|
| ASSERT(isHTMLSelectElement(element));
|
| }
|
| @@ -210,7 +211,9 @@ void LayoutMenuList::updateFromElement()
|
| if (m_popupIsVisible)
|
| m_popup->updateFromElement();
|
|
|
| - if (selectElement()->suggestedIndex() >= 0)
|
| + if (m_popupTemporarySelectedIndex >= 0)
|
| + setTextFromOption(selectElement()->listToOptionIndex(m_popupTemporarySelectedIndex));
|
| + else if (selectElement()->suggestedIndex() >= 0)
|
| setTextFromOption(selectElement()->suggestedIndex());
|
| else
|
| setTextFromOption(selectElement()->selectedIndex());
|
| @@ -571,6 +574,10 @@ int LayoutMenuList::selectedIndex() const
|
| void LayoutMenuList::popupDidHide()
|
| {
|
| m_popupIsVisible = false;
|
| + if (m_popupTemporarySelectedIndex >= 0) {
|
| + valueChanged(m_popupTemporarySelectedIndex);
|
| + m_popupTemporarySelectedIndex = -1;
|
| + }
|
| }
|
|
|
| bool LayoutMenuList::itemIsSeparator(unsigned listIndex) const
|
| @@ -594,9 +601,10 @@ bool LayoutMenuList::itemIsSelected(unsigned listIndex) const
|
| return isHTMLOptionElement(*element) && toHTMLOptionElement(*element).selected();
|
| }
|
|
|
| -void LayoutMenuList::setTextFromItem(unsigned listIndex)
|
| +void LayoutMenuList::setProvisionallySelectedListIndex(unsigned listIndex)
|
| {
|
| - setTextFromOption(selectElement()->listToOptionIndex(listIndex));
|
| + m_popupTemporarySelectedIndex = listIndex;
|
| + setTextFromOption(selectElement()->listToOptionIndex(m_popupTemporarySelectedIndex));
|
| }
|
|
|
| } // namespace blink
|
|
|