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 72b0c8e23ff19b7d4d22901b85be6bf4b59cb549..17c33d5a2aa0c366b4997d1e1b80ef092ccea519 100644 |
--- a/ui/base/ime/input_method_chromeos.cc |
+++ b/ui/base/ime/input_method_chromeos.cc |
@@ -346,8 +346,12 @@ void InputMethodChromeOS::ProcessKeyEventPostIME(const ui::KeyEvent& event, |
return; |
} |
- if (event.type() == ET_KEY_PRESSED && handled) |
- ProcessFilteredKeyPressEvent(event); |
+ if (event.type() == ET_KEY_PRESSED && handled) { |
+ if (ProcessFilteredKeyPressEvent(event)) { |
+ ResetContext(); |
+ return; |
+ } |
+ } |
// In case the focus was changed by the key event. The |context_| should have |
// been reset when the focused window changed. |
@@ -371,22 +375,23 @@ 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); |
+ if (DispatchKeyEventPostIME(event)) { |
+ ResetContext(); |
+ return; |
+ } |
// We shouldn't dispatch the character anymore if the key event dispatch |
// caused focus change. For example, in the following scenario, |
@@ -408,7 +413,7 @@ void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent( |
} |
void InputMethodChromeOS::ProcessInputMethodResult(const ui::KeyEvent& event, |
- bool handled) { |
+ bool handled) { |
TextInputClient* client = GetTextInputClient(); |
DCHECK(client); |