Bug 635857 - nsWindow::ResetInputState() commits duplicated composition string. r=mwu a=blocking-fennec

This commit is contained in:
Makoto Kato
2011-03-08 12:24:31 +09:00
parent 0d4ba88325
commit ac39715eb1
2 changed files with 18 additions and 4 deletions

View File

@@ -428,8 +428,24 @@ public class GeckoAppShell
switch (type) {
case NOTIFY_IME_RESETINPUTSTATE:
GeckoApp.surfaceView.inputConnection.finishComposingText();
IMEStateUpdater.resetIME();
// Composition event is already fired from widget.
// So reset IME flags.
GeckoApp.surfaceView.inputConnection.reset();
// Don't use IMEStateUpdater for reset.
// Because IME may not work showSoftInput()
// after calling restartInput() immediately.
// So we have to call showSoftInput() delay.
InputMethodManager imm = (InputMethodManager)
GeckoApp.surfaceView.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
if (imm == null) {
// no way to reset IME status directly
IMEStateUpdater.resetIME();
} else {
imm.restartInput(GeckoApp.surfaceView);
}
// keep current enabled state
IMEStateUpdater.enableIME();
break;
@@ -439,7 +455,6 @@ public class GeckoAppShell
break;
case NOTIFY_IME_FOCUSCHANGE:
GeckoApp.surfaceView.mIMEFocus = state != 0;
IMEStateUpdater.resetIME();
break;
}