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

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

Issue 2259033003: New accessibility virtual keyboard behavior in non-sticky mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make patch relative to previous CL Created 4 years, 4 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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void InputMethodBase::DetachTextInputClient(TextInputClient* client) { 52 void InputMethodBase::DetachTextInputClient(TextInputClient* client) {
53 if (text_input_client_ != client) 53 if (text_input_client_ != client)
54 return; 54 return;
55 SetFocusedTextInputClientInternal(nullptr); 55 SetFocusedTextInputClientInternal(nullptr);
56 } 56 }
57 57
58 TextInputClient* InputMethodBase::GetTextInputClient() const { 58 TextInputClient* InputMethodBase::GetTextInputClient() const {
59 return text_input_client_; 59 return text_input_client_;
60 } 60 }
61 61
62 void InputMethodBase::SetAvailableBounds(const gfx::Rect& new_bounds) {
63 available_bounds_ = new_bounds;
64 if (text_input_client_)
65 text_input_client_->EnsureCaretInRect(available_bounds_);
66 }
67
62 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { 68 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) {
63 if (!IsTextInputClientFocused(client)) 69 if (!IsTextInputClientFocused(client))
64 return; 70 return;
65 NotifyTextInputStateChanged(client); 71 NotifyTextInputStateChanged(client);
66 } 72 }
67 73
68 TextInputType InputMethodBase::GetTextInputType() const { 74 TextInputType InputMethodBase::GetTextInputType() const {
69 TextInputClient* client = GetTextInputClient(); 75 TextInputClient* client = GetTextInputClient();
70 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; 76 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE;
71 } 77 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 140
135 void InputMethodBase::SetFocusedTextInputClientInternal( 141 void InputMethodBase::SetFocusedTextInputClientInternal(
136 TextInputClient* client) { 142 TextInputClient* client) {
137 TextInputClient* old = text_input_client_; 143 TextInputClient* old = text_input_client_;
138 if (old == client) 144 if (old == client)
139 return; 145 return;
140 OnWillChangeFocusedClient(old, client); 146 OnWillChangeFocusedClient(old, client);
141 text_input_client_ = client; // nullptr allowed. 147 text_input_client_ = client; // nullptr allowed.
142 OnDidChangeFocusedClient(old, client); 148 OnDidChangeFocusedClient(old, client);
143 NotifyTextInputStateChanged(text_input_client_); 149 NotifyTextInputStateChanged(text_input_client_);
150
151 if (available_bounds_.IsEmpty())
152 return;
153
154 // Restore old focused window if moved.
155 if (old)
156 old->EnsureCaretInRect(available_bounds_);
157 // Move new focused window if necessary.
158 if (text_input_client_)
159 text_input_client_->EnsureCaretInRect(available_bounds_);
144 } 160 }
145 161
146 std::vector<gfx::Rect> InputMethodBase::GetCompositionBounds( 162 std::vector<gfx::Rect> InputMethodBase::GetCompositionBounds(
147 const TextInputClient* client) { 163 const TextInputClient* client) {
148 std::vector<gfx::Rect> bounds; 164 std::vector<gfx::Rect> bounds;
149 if (client->HasCompositionText()) { 165 if (client->HasCompositionText()) {
150 uint32_t i = 0; 166 uint32_t i = 0;
151 gfx::Rect rect; 167 gfx::Rect rect;
152 while (client->GetCompositionCharacterBounds(i++, &rect)) 168 while (client->GetCompositionCharacterBounds(i++, &rect))
153 bounds.push_back(rect); 169 bounds.push_back(rect);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 InputMethod* InputMethodBase::GetInputMethod() { 226 InputMethod* InputMethodBase::GetInputMethod() {
211 return this; 227 return this;
212 } 228 }
213 229
214 const std::vector<std::unique_ptr<ui::KeyEvent>>& 230 const std::vector<std::unique_ptr<ui::KeyEvent>>&
215 InputMethodBase::GetKeyEventsForTesting() { 231 InputMethodBase::GetKeyEventsForTesting() {
216 return key_events_for_testing_; 232 return key_events_for_testing_;
217 } 233 }
218 234
219 } // namespace ui 235 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698