Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Unified Diff: ui/base/ime/input_method_chromeos.cc

Issue 1209913002: InputMethod should stop TextInputClient::InsertChar/InsertText calls when the event is stopped prop… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/aura/window_tree_host.cc ('K') | « ui/base/ime/input_method_chromeos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« ui/aura/window_tree_host.cc ('K') | « ui/base/ime/input_method_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698