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

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
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..d18346a6ed1756ab9d39a6f016b031270335721c 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);
+ 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,
@@ -407,7 +412,7 @@ void InputMethodChromeOS::ProcessUnfilteredKeyPressEvent(
}
void InputMethodChromeOS::ProcessInputMethodResult(const ui::KeyEvent& event,
- bool handled) {
+ bool handled) {
TextInputClient* client = GetTextInputClient();
DCHECK(client);

Powered by Google App Engine
This is Rietveld 408576698