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

Side by Side Diff: ui/base/ime/input_method_base.cc

Issue 2553603002: New accessibility virtual keyboard behavior in non-sticky mode. (Closed)
Patch Set: fix test crashes Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_base.h" 5 #include "ui/base/ime/input_method_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void InputMethodBase::DetachTextInputClient(TextInputClient* client) { 51 void InputMethodBase::DetachTextInputClient(TextInputClient* client) {
52 if (text_input_client_ != client) 52 if (text_input_client_ != client)
53 return; 53 return;
54 SetFocusedTextInputClientInternal(nullptr); 54 SetFocusedTextInputClientInternal(nullptr);
55 } 55 }
56 56
57 TextInputClient* InputMethodBase::GetTextInputClient() const { 57 TextInputClient* InputMethodBase::GetTextInputClient() const {
58 return text_input_client_; 58 return text_input_client_;
59 } 59 }
60 60
61 void InputMethodBase::SetOnScreenKeyboardBounds(const gfx::Rect& new_bounds) {
62 keyboard_bounds_ = new_bounds;
63 if (text_input_client_)
64 text_input_client_->EnsureCaretNotInRect(keyboard_bounds_);
65 }
66
61 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { 67 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) {
62 if (!IsTextInputClientFocused(client)) 68 if (!IsTextInputClientFocused(client))
63 return; 69 return;
64 NotifyTextInputStateChanged(client); 70 NotifyTextInputStateChanged(client);
65 } 71 }
66 72
67 void InputMethodBase::OnInputLocaleChanged() { 73 void InputMethodBase::OnInputLocaleChanged() {
68 } 74 }
69 75
70 bool InputMethodBase::IsInputLocaleCJK() const { 76 bool InputMethodBase::IsInputLocaleCJK() const {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 146
141 void InputMethodBase::SetFocusedTextInputClientInternal( 147 void InputMethodBase::SetFocusedTextInputClientInternal(
142 TextInputClient* client) { 148 TextInputClient* client) {
143 TextInputClient* old = text_input_client_; 149 TextInputClient* old = text_input_client_;
144 if (old == client) 150 if (old == client)
145 return; 151 return;
146 OnWillChangeFocusedClient(old, client); 152 OnWillChangeFocusedClient(old, client);
147 text_input_client_ = client; // nullptr allowed. 153 text_input_client_ = client; // nullptr allowed.
148 OnDidChangeFocusedClient(old, client); 154 OnDidChangeFocusedClient(old, client);
149 NotifyTextInputStateChanged(text_input_client_); 155 NotifyTextInputStateChanged(text_input_client_);
156
157 // Restore old focused window if moved.
158 if (old)
159 old->OnClientFocusLost();
160 // Move new focused window if necessary.
161 if (text_input_client_)
162 text_input_client_->EnsureCaretNotInRect(keyboard_bounds_);
150 } 163 }
151 164
152 std::vector<gfx::Rect> InputMethodBase::GetCompositionBounds( 165 std::vector<gfx::Rect> InputMethodBase::GetCompositionBounds(
153 const TextInputClient* client) { 166 const TextInputClient* client) {
154 std::vector<gfx::Rect> bounds; 167 std::vector<gfx::Rect> bounds;
155 if (client->HasCompositionText()) { 168 if (client->HasCompositionText()) {
156 uint32_t i = 0; 169 uint32_t i = 0;
157 gfx::Rect rect; 170 gfx::Rect rect;
158 while (client->GetCompositionCharacterBounds(i++, &rect)) 171 while (client->GetCompositionCharacterBounds(i++, &rect))
159 bounds.push_back(rect); 172 bounds.push_back(rect);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 InputMethod* InputMethodBase::GetInputMethod() { 229 InputMethod* InputMethodBase::GetInputMethod() {
217 return this; 230 return this;
218 } 231 }
219 232
220 const std::vector<std::unique_ptr<ui::KeyEvent>>& 233 const std::vector<std::unique_ptr<ui::KeyEvent>>&
221 InputMethodBase::GetKeyEventsForTesting() { 234 InputMethodBase::GetKeyEventsForTesting() {
222 return key_events_for_testing_; 235 return key_events_for_testing_;
223 } 236 }
224 237
225 } // namespace ui 238 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698