From 57d905a9da4bb7a86feba868ef50549b64edafaa Mon Sep 17 00:00:00 2001 From: "mats.palmgren%bredband.net" Date: Sat, 22 Oct 2005 03:47:00 +0000 Subject: [PATCH] Don't compare the displayed value against the "selected index" in dropped down mode since that is actually the "hovered index". b=313260 r+sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@182769 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsComboboxControlFrame.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 618850a42f7..39130f13605 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -1214,7 +1214,14 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext, // Make sure the displayed text is the same as the selected option, bug 297389. PRInt32 selectedIndex; nsAutoString selectedOptionText; - mListControlFrame->GetSelectedIndex(&selectedIndex); + if (!mDroppedDown) { + mListControlFrame->GetSelectedIndex(&selectedIndex); + } + else { + // In dropped down mode the "selected index" is the hovered menu item, + // we want the last selected item which is |mDisplayedIndex| in this case. + selectedIndex = mDisplayedIndex; + } if (selectedIndex != -1) { mListControlFrame->GetOptionText(selectedIndex, selectedOptionText); }