Index: ui/base/ime/input_method_win.cc |
diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc |
index 0bc905297b0fed47d3e77b3dd69a238b7f81a0d6..9b04a8d454302406bdd58d88c92b3df35e016238 100644 |
--- a/ui/base/ime/input_method_win.cc |
+++ b/ui/base/ime/input_method_win.cc |
@@ -623,15 +623,16 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { |
} |
void InputMethodWin::DispatchFabricatedKeyEvent(ui::KeyEvent* event) { |
- if (event->is_char()) { |
- if (GetTextInputClient()) { |
- ui::KeyEvent ch_event(*event); |
- ch_event.set_character(static_cast<base::char16>(event->key_code())); |
- GetTextInputClient()->InsertChar(ch_event); |
- return; |
- } |
+ // The key event if from calling input.ime.sendKeyEvent or test. |
+ ui::EventDispatchDetails details = DispatchKeyEventPostIME(event); |
+ if (details.dispatcher_destroyed || details.target_destroyed || |
+ event->stopped_propagation()) { |
+ return; |
} |
- ignore_result(DispatchKeyEventPostIME(event)); |
+ |
+ if ((event->is_char() || event->GetDomKey().IsCharacter()) && |
+ event->type() == ui::ET_KEY_PRESSED && GetTextInputClient()) |
+ GetTextInputClient()->InsertChar(*event); |
} |
void InputMethodWin::ConfirmCompositionText() { |