Bug 90392: Don't submit forms multiple times when dismissing the 'insecure form submit' warning dialog by pressing Enter. This balances XUL's handling of firing for Enter on KEY_PRESS and firing for space bar on KEY_UP by doing the same for HTML form controls. r=jag@netscape.com, sr=jst@netscape.com

This commit is contained in:
pollmann%netscape.com 2001-07-23 10:24:37 +00:00
Родитель d0ecd30824
Коммит 6ad11804b0
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -1137,14 +1137,17 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
break; // NS_FOCUS_CONTENT
case NS_KEY_PRESS:
case NS_KEY_UP:
{
// For backwards compat, trigger checks/radios/buttons with
// space or enter (bug 25300)
nsKeyEvent * keyEvent = (nsKeyEvent *)aEvent;
if (keyEvent->keyCode == NS_VK_RETURN ||
keyEvent->keyCode == NS_VK_SPACE) {
if ((aEvent->message == NS_KEY_PRESS &&
keyEvent->keyCode == NS_VK_RETURN) ||
(aEvent->message == NS_KEY_UP &&
keyEvent->keyCode == NS_VK_SPACE)) {
switch(type) {
case NS_FORM_INPUT_CHECKBOX:
case NS_FORM_INPUT_RADIO:
@ -1168,7 +1171,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
} // case
} // switch
}
} break;// NS_KEY_PRESS
} break;// NS_KEY_PRESS || NS_KEY_UP
// cancel all of these events for buttons
case NS_MOUSE_MIDDLE_BUTTON_DOWN: