Bug 211846. alt+down not working consistently for dropdowns. Also fixes bug 110801 and bug 205942, dropdown from alt+down not showing in the right place. r=jkieser, sr=bz

git-svn-id: svn://10.0.0.236/trunk@144635 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronl%netscape.com
2003-07-09 06:36:33 +00:00
parent 66a7ef3ecf
commit 42c64b76d5
6 changed files with 40 additions and 76 deletions

View File

@@ -3243,6 +3243,17 @@ nsListControlFrame::GetIncrementalString()
return incrementalString;
}
void
nsListControlFrame::DropDownToggleKey(nsIDOMEvent* aKeyEvent)
{
if (IsInDropDownMode()) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
mComboboxFrame->ShowDropDown(!isDroppedDown);
aKeyEvent->PreventDefault();
}
}
nsresult
nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
{
@@ -3269,23 +3280,9 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
keyEvent->GetAltKey(&isAlt);
if (isAlt) {
#ifdef FIX_FOR_BUG_62425
if (code == nsIDOMKeyEvent::DOM_VK_UP || code == nsIDOMKeyEvent::DOM_VK_DOWN) {
if (IsInDropDownMode() == PR_TRUE) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
mComboboxFrame->ShowDropDown(!isDroppedDown);
aKeyEvent->PreventDefault();
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
if (nsevent) {
nsevent->PreventCapture();
nsevent->PreventBubble();
}
}
if (keycode == nsIDOMKeyEvent::DOM_VK_UP || keycode == nsIDOMKeyEvent::DOM_VK_DOWN) {
DropDownToggleKey(aKeyEvent);
}
#endif
return NS_OK;
}
@@ -3388,19 +3385,9 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
#if defined(XP_WIN) || defined(XP_OS2)
case nsIDOMKeyEvent::DOM_VK_F4: {
if (IsInDropDownMode() == PR_TRUE) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
mComboboxFrame->ShowDropDown(!isDroppedDown);
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
if (nsevent) {
nsevent->PreventCapture();
nsevent->PreventBubble();
}
}
} break;
DropDownToggleKey(aKeyEvent);
return NS_OK;
} break;
#endif
case nsIDOMKeyEvent::DOM_VK_TAB: {