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

Unified 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: Address code review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/ime/input_method_chromeos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/input_method_chromeos.cc
diff --git a/ui/base/ime/input_method_chromeos.cc b/ui/base/ime/input_method_chromeos.cc
index 6930968f7db6d043ea92027ce2904119914238e4..990ccfa61cef3f2a2c064a4f6ea3815dba422438 100644
--- a/ui/base/ime/input_method_chromeos.cc
+++ b/ui/base/ime/input_method_chromeos.cc
@@ -123,7 +123,7 @@ bool InputMethodChromeOS::DispatchKeyEvent(const ui::KeyEvent& event) {
// normal input field (not a password field).
// Note: We need to send the key event to ibus even if the |context_| is not
// enabled, so that ibus can have a chance to enable the |context_|.
- if (!IsInputFieldFocused() || !GetEngine()) {
+ if (!IsNonPasswordInputFieldFocused() || !GetEngine()) {
if (event.type() == ET_KEY_PRESSED) {
if (ExecuteCharacterComposer(event)) {
// Treating as PostIME event if character composer handles key event and
@@ -178,6 +178,11 @@ void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) {
if (!IsInputFieldFocused() || !IsTextInputClientFocused(client))
return;
+ NotifyTextInputCaretBoundsChanged(client);
+
+ if (!IsNonPasswordInputFieldFocused())
+ return;
+
// The current text input type should not be NONE if |context_| is focused.
DCHECK(!IsTextInputTypeNone());
const gfx::Rect rect = GetTextInputClient()->GetCaretBounds();
@@ -230,7 +235,7 @@ void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) {
}
void InputMethodChromeOS::CancelComposition(const TextInputClient* client) {
- if (IsInputFieldFocused() && IsTextInputClientFocused(client))
+ if (IsNonPasswordInputFieldFocused() && IsTextInputClientFocused(client))
ResetContext();
}
@@ -285,7 +290,7 @@ void InputMethodChromeOS::ConfirmCompositionText() {
}
void InputMethodChromeOS::ResetContext() {
- if (!IsInputFieldFocused() || !GetTextInputClient())
+ if (!IsNonPasswordInputFieldFocused() || !GetTextInputClient())
return;
DCHECK(system_toplevel_window_focused());
@@ -319,7 +324,7 @@ void InputMethodChromeOS::UpdateContextFocusState() {
chromeos::IMECandidateWindowHandlerInterface* candidate_window =
chromeos::IMEBridge::Get()->GetCandidateWindowHandler();
if (candidate_window)
- candidate_window->FocusStateChanged(IsInputFieldFocused());
+ candidate_window->FocusStateChanged(IsNonPasswordInputFieldFocused());
chromeos::IMEBridge::Get()->SetCurrentTextInputType(GetTextInputType());
@@ -654,9 +659,13 @@ void InputMethodChromeOS::ExtractCompositionText(
}
}
-bool InputMethodChromeOS::IsInputFieldFocused() {
+bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() {
TextInputType type = GetTextInputType();
return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD);
}
+bool InputMethodChromeOS::IsInputFieldFocused() {
+ return GetTextInputType() != TEXT_INPUT_TYPE_NONE;
+}
+
} // namespace ui
« no previous file with comments | « 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