| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/ime/input_method_tsf.h" | 5 #include "ui/base/ime/input_method_tsf.h" |
| 6 | 6 |
| 7 #include "ui/base/ime/text_input_client.h" | 7 #include "ui/base/ime/text_input_client.h" |
| 8 #include "ui/base/ime/win/tsf_bridge.h" | 8 #include "ui/base/ime/win/tsf_bridge.h" |
| 9 #include "ui/base/ime/win/tsf_event_router.h" | 9 #include "ui/base/ime/win/tsf_event_router.h" |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 original_result = OnDeadChar( | 91 original_result = OnDeadChar( |
| 92 event.message, event.wParam, event.lParam, &handled); | 92 event.message, event.wParam, event.lParam, &handled); |
| 93 break; | 93 break; |
| 94 } | 94 } |
| 95 if (result) | 95 if (result) |
| 96 *result = original_result; | 96 *result = original_result; |
| 97 return !!handled; | 97 return !!handled; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void InputMethodTSF::OnTextInputTypeChanged(const TextInputClient* client) { | 100 void InputMethodTSF::OnTextInputTypeChanged(const TextInputClient* client) { |
| 101 if (IsTextInputClientFocused(client) && IsWindowFocused(client)) { | 101 if (!IsTextInputClientFocused(client) || !IsWindowFocused(client)) |
| 102 ui::TSFBridge::GetInstance()->CancelComposition(); | 102 return; |
| 103 ui::TSFBridge::GetInstance()->OnTextInputTypeChanged(client); | 103 ui::TSFBridge::GetInstance()->CancelComposition(); |
| 104 } | 104 ui::TSFBridge::GetInstance()->OnTextInputTypeChanged(client); |
| 105 InputMethodWin::OnTextInputTypeChanged(client); | |
| 106 } | 105 } |
| 107 | 106 |
| 108 void InputMethodTSF::OnCaretBoundsChanged(const TextInputClient* client) { | 107 void InputMethodTSF::OnCaretBoundsChanged(const TextInputClient* client) { |
| 109 if (IsTextInputClientFocused(client) && IsWindowFocused(client)) | 108 if (!IsTextInputClientFocused(client) || !IsWindowFocused(client)) |
| 110 ui::TSFBridge::GetInstance()->OnTextLayoutChanged(); | 109 return; |
| 111 InputMethodWin::OnCaretBoundsChanged(client); | 110 ui::TSFBridge::GetInstance()->OnTextLayoutChanged(); |
| 112 } | 111 } |
| 113 | 112 |
| 114 void InputMethodTSF::CancelComposition(const TextInputClient* client) { | 113 void InputMethodTSF::CancelComposition(const TextInputClient* client) { |
| 115 if (IsTextInputClientFocused(client) && IsWindowFocused(client)) | 114 if (IsTextInputClientFocused(client) && IsWindowFocused(client)) |
| 116 ui::TSFBridge::GetInstance()->CancelComposition(); | 115 ui::TSFBridge::GetInstance()->CancelComposition(); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void InputMethodTSF::DetachTextInputClient(TextInputClient* client) { | 118 void InputMethodTSF::DetachTextInputClient(TextInputClient* client) { |
| 120 InputMethodWin::DetachTextInputClient(client); | 119 InputMethodWin::DetachTextInputClient(client); |
| 121 ui::TSFBridge::GetInstance()->RemoveFocusedClient(client); | 120 ui::TSFBridge::GetInstance()->RemoveFocusedClient(client); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 150 } | 149 } |
| 151 InputMethodWin::OnDidChangeFocusedClient(focused_before, focused); | 150 InputMethodWin::OnDidChangeFocusedClient(focused_before, focused); |
| 152 } | 151 } |
| 153 | 152 |
| 154 void InputMethodTSF::ConfirmCompositionText() { | 153 void InputMethodTSF::ConfirmCompositionText() { |
| 155 if (!IsTextInputTypeNone()) | 154 if (!IsTextInputTypeNone()) |
| 156 ui::TSFBridge::GetInstance()->ConfirmComposition(); | 155 ui::TSFBridge::GetInstance()->ConfirmComposition(); |
| 157 } | 156 } |
| 158 | 157 |
| 159 } // namespace ui | 158 } // namespace ui |
| OLD | NEW |