Fix arrow keys in editors. Bug 330133, r=timeless, sr=neil

This commit is contained in:
bzbarsky%mit.edu 2006-03-14 16:58:22 +00:00
parent 0412146c05
commit b8488d8978

View File

@ -197,6 +197,9 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
nsINativeKeyBindings *nativeBindings;
if (isEditor && (nativeBindings = GetEditorKeyBindings())) {
nsNativeKeyEvent nativeEvent;
// Some key events have no useful charCode
nativeEvent.charCode = 0;
keyEvent->GetKeyCode(&nativeEvent.keyCode);
keyEvent->GetAltKey(&nativeEvent.altKey);
keyEvent->GetCtrlKey(&nativeEvent.ctrlKey);
keyEvent->GetShiftKey(&nativeEvent.shiftKey);
@ -218,15 +221,12 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
keyEvent->GetCharCode(&nativeEvent.charCode);
handled = sNativeEditorBindings->KeyPress(nativeEvent,
DoCommandCallback, controllers);
} else if (aEventType == nsXBLAtoms::keyup) {
handled = sNativeEditorBindings->KeyUp(nativeEvent,
DoCommandCallback, controllers);
} else {
keyEvent->GetKeyCode(&nativeEvent.keyCode);
if (aEventType == nsXBLAtoms::keyup) {
handled = sNativeEditorBindings->KeyUp(nativeEvent,
handled = sNativeEditorBindings->KeyDown(nativeEvent,
DoCommandCallback, controllers);
} else {
handled = sNativeEditorBindings->KeyDown(nativeEvent,
DoCommandCallback, controllers);
}
}
if (handled)