Index: ui/base/ime/input_method_chromeos.cc |
diff --git a/ui/base/ime/input_method_chromeos.cc b/ui/base/ime/input_method_chromeos.cc |
index 6763262ecc3174e35f1ff7ef042dc88c1a0f3133..e358cbff39f4ffcb0ac1cf2aa7441b51c7c0f43e 100644 |
--- a/ui/base/ime/input_method_chromeos.cc |
+++ b/ui/base/ime/input_method_chromeos.cc |
@@ -345,15 +345,16 @@ void InputMethodChromeOS::ProcessKeyEventPostIME(const ui::KeyEvent& event, |
return; |
} |
+ bool post_ime_result = false; |
if (event.type() == ET_KEY_PRESSED && handled) |
- ProcessFilteredKeyPressEvent(event); |
+ post_ime_result = ProcessFilteredKeyPressEvent(event); |
// In case the focus was changed by the key event. The |context_| should have |
// been reset when the focused window changed. |
if (client != GetTextInputClient()) |
return; |
- if (HasInputMethodResult()) |
+ if (HasInputMethodResult() && !post_ime_result) |
ProcessInputMethodResult(event, handled); |
// In case the focus was changed when sending input method results to the |
@@ -370,22 +371,21 @@ void InputMethodChromeOS::ProcessKeyEventPostIME(const ui::KeyEvent& event, |
DispatchKeyEventPostIME(event); |
} |
-void InputMethodChromeOS::ProcessFilteredKeyPressEvent( |
+bool InputMethodChromeOS::ProcessFilteredKeyPressEvent( |
const ui::KeyEvent& event) { |
- if (NeedInsertChar()) { |
- DispatchKeyEventPostIME(event); |
- } else { |
- const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
- VKEY_PROCESSKEY, |
- event.flags()); |
- DispatchKeyEventPostIME(fabricated_event); |
- } |
+ if (NeedInsertChar()) |
+ return DispatchKeyEventPostIME(event); |
+ const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
+ VKEY_PROCESSKEY, |
+ event.flags()); |
+ return DispatchKeyEventPostIME(fabricated_event); |
} |
void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
const ui::KeyEvent& event) { |
- const TextInputClient* prev_client = GetTextInputClient(); |
- DispatchKeyEventPostIME(event); |
+ TextInputClient* prev_client = GetTextInputClient(); |
+ if (DispatchKeyEventPostIME(event)) |
+ return; |
// We shouldn't dispatch the character anymore if the key event dispatch |
// caused focus change. For example, in the following scenario, |
@@ -403,11 +403,11 @@ void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
// to send corresponding character to the focused text input client. |
uint16 ch = event.GetCharacter(); |
if (ch) |
- client->InsertChar(ch, event.flags()); |
+ prev_client->InsertChar(ch, event.flags()); |
} |
void InputMethodChromeOS::ProcessInputMethodResult(const ui::KeyEvent& event, |
- bool handled) { |
+ bool handled) { |
TextInputClient* client = GetTextInputClient(); |
DCHECK(client); |