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

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

Issue 665903003: Magnifier needs to follow the focus of the textfield. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test cases. Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_chromeos.h" 5 #include "ui/base/ime/input_method_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 engine->FocusOut(); 168 engine->FocusOut();
169 chromeos::IMEEngineHandlerInterface::InputContext context( 169 chromeos::IMEEngineHandlerInterface::InputContext context(
170 GetTextInputType(), GetTextInputMode()); 170 GetTextInputType(), GetTextInputMode());
171 engine->FocusIn(context); 171 engine->FocusIn(context);
172 } 172 }
173 173
174 InputMethodBase::OnTextInputTypeChanged(client); 174 InputMethodBase::OnTextInputTypeChanged(client);
175 } 175 }
176 176
177 void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) { 177 void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) {
178 if (!IsInputFieldFocused() || !IsTextInputClientFocused(client)) 178 if (!IsTextInputFieldFocused() || !IsTextInputClientFocused(client))
179 return;
180
181 NotifyTextInputCaretBoundsChanged(client);
182
183 if (!IsInputFieldFocused())
179 return; 184 return;
180 185
181 // The current text input type should not be NONE if |context_| is focused. 186 // The current text input type should not be NONE if |context_| is focused.
182 DCHECK(!IsTextInputTypeNone()); 187 DCHECK(!IsTextInputTypeNone());
183 const gfx::Rect rect = GetTextInputClient()->GetCaretBounds(); 188 const gfx::Rect rect = GetTextInputClient()->GetCaretBounds();
184 189
185 gfx::Rect composition_head; 190 gfx::Rect composition_head;
186 if (!GetTextInputClient()->GetCompositionCharacterBounds(0, 191 if (!GetTextInputClient()->GetCompositionCharacterBounds(0,
187 &composition_head)) { 192 &composition_head)) {
188 composition_head = rect; 193 composition_head = rect;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 out_composition->underlines.push_back(CompositionUnderline( 657 out_composition->underlines.push_back(CompositionUnderline(
653 0, length, SK_ColorBLACK, false /* thick */, SK_ColorTRANSPARENT)); 658 0, length, SK_ColorBLACK, false /* thick */, SK_ColorTRANSPARENT));
654 } 659 }
655 } 660 }
656 661
657 bool InputMethodChromeOS::IsInputFieldFocused() { 662 bool InputMethodChromeOS::IsInputFieldFocused() {
658 TextInputType type = GetTextInputType(); 663 TextInputType type = GetTextInputType();
659 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); 664 return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD);
660 } 665 }
661 666
667 bool InputMethodChromeOS::IsTextInputFieldFocused() {
668 return GetTextInputType() != TEXT_INPUT_TYPE_NONE;
669 }
670
662 } // namespace ui 671 } // namespace ui
OLDNEW
« ui/base/ime/input_method_chromeos.h ('K') | « ui/base/ime/input_method_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698