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 c951b4398489902ea3706c2236b476345d9f8e7b..0132413b05a8d50b28f91878137702e5b0f210e7 100644 |
--- a/ui/base/ime/input_method_chromeos.cc |
+++ b/ui/base/ime/input_method_chromeos.cc |
@@ -438,6 +438,14 @@ bool InputMethodChromeOS::HasInputMethodResult() const { |
return result_text_.length() || composition_changed_; |
} |
+void InputMethodChromeOS::SendFakeProcessKeyEvent(bool pressed) const { |
+ KeyEvent evt(pressed ? ET_KEY_PRESSED : ET_KEY_RELEASED, |
+ VKEY_PROCESSKEY, |
+ 0, |
+ false); |
+ DispatchKeyEventPostIME(evt); |
+} |
+ |
void InputMethodChromeOS::AbandonAllPendingKeyEvents() { |
pending_key_events_.clear(); |
} |
@@ -463,7 +471,9 @@ void InputMethodChromeOS::CommitText(const std::string& text) { |
// If we are not handling key event, do not bother sending text result if the |
// focused text input client does not support text input. |
if (pending_key_events_.empty() && !IsTextInputTypeNone()) { |
+ SendFakeProcessKeyEvent(true); |
GetTextInputClient()->InsertText(utf16_text); |
+ SendFakeProcessKeyEvent(false); |
Yuki
2014/05/26 06:29:29
Do we really want to send a PROCESSKEY event for k
Shu Chen
2014/05/26 06:35:59
I think it would be better to keep the events sequ
Yuki
2014/05/26 06:56:08
http://www.w3.org/TR/DOM-Level-3-Events/
6.5.2 Leg
|
result_text_.clear(); |
} |
} |
@@ -505,7 +515,9 @@ void InputMethodChromeOS::UpdateCompositionText( |
// If we receive a composition text without pending key event, then we need to |
// send it to the focused text input client directly. |
if (pending_key_events_.empty()) { |
+ SendFakeProcessKeyEvent(true); |
GetTextInputClient()->SetCompositionText(composition_); |
+ SendFakeProcessKeyEvent(false); |
composition_changed_ = false; |
composition_.Clear(); |
} |
@@ -521,8 +533,11 @@ void InputMethodChromeOS::HidePreeditText() { |
if (pending_key_events_.empty()) { |
TextInputClient* client = GetTextInputClient(); |
- if (client && client->HasCompositionText()) |
+ if (client && client->HasCompositionText()) { |
+ SendFakeProcessKeyEvent(true); |
client->ClearCompositionText(); |
+ SendFakeProcessKeyEvent(false); |
+ } |
composition_changed_ = false; |
} |
} |