Bug 501496 part.6 Don't dispatch keypress events if defaultPrevent() of the keydown event is called on Android r=smaug+nchen

This commit is contained in:
Masayuki Nakano 2013-07-25 15:09:28 +09:00
Родитель 4d5158de01
Коммит 43dc72f530
1 изменённых файлов: 3 добавлений и 4 удалений

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

@ -1687,6 +1687,7 @@ nsWindow::HandleSpecialKey(AndroidGeckoEvent *ae)
} else {
switch (keyCode) {
case AKEYCODE_BACK: {
// XXX Where is the keydown event for this??
nsKeyEvent pressEvent(true, NS_KEY_PRESS, this);
ANPEvent pluginEvent;
InitKeyEvent(pressEvent, *ae, &pluginEvent);
@ -1766,14 +1767,12 @@ nsWindow::OnKeyEvent(AndroidGeckoEvent *ae)
if (Destroyed())
return;
if (!firePress)
if (!firePress || status == nsEventStatus_eConsumeNoDefault) {
return;
}
nsKeyEvent pressEvent(true, NS_KEY_PRESS, this);
InitKeyEvent(pressEvent, *ae, &pluginEvent);
if (status == nsEventStatus_eConsumeNoDefault) {
pressEvent.mFlags.mDefaultPrevented = true;
}
#ifdef DEBUG_ANDROID_WIDGET
__android_log_print(ANDROID_LOG_INFO, "Gecko", "Dispatching key pressEvent with keyCode %d charCode %d shift %d alt %d sym/ctrl %d metamask %d", pressEvent.keyCode, pressEvent.charCode, pressEvent.IsShift(), pressEvent.IsAlt(), pressEvent.IsControl(), ae->MetaState());
#endif