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..1513d68d1713902e3820afc1a8bed6210727015e 100644 |
--- a/ui/base/ime/input_method_chromeos.cc |
+++ b/ui/base/ime/input_method_chromeos.cc |
@@ -345,8 +345,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. |
@@ -370,22 +374,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); |
+ TextInputClient* prev_client = GetTextInputClient(); |
+ 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, |
@@ -403,11 +408,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()); |
James Su
2015/06/26 03:41:26
this change is not necessary.
Shu Chen
2015/06/26 04:00:00
Done.
|
} |
void InputMethodChromeOS::ProcessInputMethodResult(const ui::KeyEvent& event, |
- bool handled) { |
+ bool handled) { |
TextInputClient* client = GetTextInputClient(); |
DCHECK(client); |