Commit ae2cda0d authored by Keith Lee's avatar Keith Lee Committed by Commit Bot

Replace isNonePasswordFieldFocused with isPasswordOrNoneInputFieldFocused

Replaced with it's negative to not use a negative for readability.

Change-Id: I9ba712ab0b8a9cf3089c9c5f6d6f09d8b3c73694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2143026
Commit-Queue: Keith Lee <keithlee@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791188}
parent 30065656
...@@ -128,7 +128,7 @@ ui::EventDispatchDetails InputMethodChromeOS::DispatchKeyEvent( ...@@ -128,7 +128,7 @@ ui::EventDispatchDetails InputMethodChromeOS::DispatchKeyEvent(
// normal input field (not a password field). // normal input field (not a password field).
// Note: We need to send the key event to ibus even if the |context_| is not // 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_|. // enabled, so that ibus can have a chance to enable the |context_|.
if (!IsNonPasswordInputFieldFocused() || !GetEngine()) { if (IsPasswordOrNoneInputFieldFocused() || !GetEngine()) {
if (event->type() == ET_KEY_PRESSED) { if (event->type() == ET_KEY_PRESSED) {
if (ExecuteCharacterComposer(*event)) { if (ExecuteCharacterComposer(*event)) {
// Treating as PostIME event if character composer handles key event and // Treating as PostIME event if character composer handles key event and
...@@ -202,7 +202,7 @@ void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) { ...@@ -202,7 +202,7 @@ void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) {
NotifyTextInputCaretBoundsChanged(client); NotifyTextInputCaretBoundsChanged(client);
if (!IsNonPasswordInputFieldFocused()) if (IsPasswordOrNoneInputFieldFocused())
return; return;
// The current text input type should not be NONE if |context_| is focused. // The current text input type should not be NONE if |context_| is focused.
...@@ -269,7 +269,7 @@ void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) { ...@@ -269,7 +269,7 @@ void InputMethodChromeOS::OnCaretBoundsChanged(const TextInputClient* client) {
} }
void InputMethodChromeOS::CancelComposition(const TextInputClient* client) { void InputMethodChromeOS::CancelComposition(const TextInputClient* client) {
if (IsNonPasswordInputFieldFocused() && IsTextInputClientFocused(client)) if (!IsPasswordOrNoneInputFieldFocused() && IsTextInputClientFocused(client))
ResetContext(); ResetContext();
} }
...@@ -392,7 +392,7 @@ void InputMethodChromeOS::ConfirmCompositionText(bool reset_engine, ...@@ -392,7 +392,7 @@ void InputMethodChromeOS::ConfirmCompositionText(bool reset_engine,
} }
void InputMethodChromeOS::ResetContext(bool reset_engine) { void InputMethodChromeOS::ResetContext(bool reset_engine) {
if (!IsNonPasswordInputFieldFocused() || !GetTextInputClient()) if (IsPasswordOrNoneInputFieldFocused() || !GetTextInputClient())
return; return;
pending_composition_ = CompositionText(); pending_composition_ = CompositionText();
...@@ -415,7 +415,7 @@ void InputMethodChromeOS::UpdateContextFocusState() { ...@@ -415,7 +415,7 @@ void InputMethodChromeOS::UpdateContextFocusState() {
chromeos::IMECandidateWindowHandlerInterface* candidate_window = chromeos::IMECandidateWindowHandlerInterface* candidate_window =
ui::IMEBridge::Get()->GetCandidateWindowHandler(); ui::IMEBridge::Get()->GetCandidateWindowHandler();
if (candidate_window) if (candidate_window)
candidate_window->FocusStateChanged(IsNonPasswordInputFieldFocused()); candidate_window->FocusStateChanged(!IsPasswordOrNoneInputFieldFocused());
// Propagate focus event to assistive window handler. // Propagate focus event to assistive window handler.
chromeos::IMEAssistiveWindowHandlerInterface* assistive_window = chromeos::IMEAssistiveWindowHandlerInterface* assistive_window =
...@@ -774,9 +774,9 @@ void InputMethodChromeOS::ExtractCompositionText( ...@@ -774,9 +774,9 @@ void InputMethodChromeOS::ExtractCompositionText(
} }
} }
bool InputMethodChromeOS::IsNonPasswordInputFieldFocused() { bool InputMethodChromeOS::IsPasswordOrNoneInputFieldFocused() {
TextInputType type = GetTextInputType(); TextInputType type = GetTextInputType();
return (type != TEXT_INPUT_TYPE_NONE) && (type != TEXT_INPUT_TYPE_PASSWORD); return type == TEXT_INPUT_TYPE_NONE || type == TEXT_INPUT_TYPE_PASSWORD;
} }
bool InputMethodChromeOS::IsInputFieldFocused() { bool InputMethodChromeOS::IsInputFieldFocused() {
......
...@@ -135,8 +135,7 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS ...@@ -135,8 +135,7 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS
// Called from the engine when it completes processing. // Called from the engine when it completes processing.
void ProcessKeyEventDone(ui::KeyEvent* event, bool is_handled); void ProcessKeyEventDone(ui::KeyEvent* event, bool is_handled);
// Returns whether an non-password input field is focused. bool IsPasswordOrNoneInputFieldFocused();
bool IsNonPasswordInputFieldFocused();
// Returns true if an text input field is focused. // Returns true if an text input field is focused.
bool IsInputFieldFocused(); bool IsInputFieldFocused();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment