Commit 3535531b authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

[Mfill Android] Show all suggestions when focused with talkback

When talkback is turned on, there would be a deferred focus event. This
triggered hiding autofill suggestions which is wrong for the keyboard
accessory.

This CL ensures that the keyboard accessory relies fully on its own
logic to decide when to hide autofill suggestions.

Bug: 969202
Change-Id: I88d2c1456990d4e4ed8e292d37b7c8eb10d29797
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790889Reviewed-by: default avatarChristos Froussios <cfroussios@chromium.org>
Commit-Queue: Friedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694809}
parent 2bbcf75e
...@@ -203,7 +203,7 @@ void AutofillAgent::DidChangeScrollOffset() { ...@@ -203,7 +203,7 @@ void AutofillAgent::DidChangeScrollOffset() {
->PostTask(FROM_HERE, ->PostTask(FROM_HERE,
base::BindOnce(&AutofillAgent::DidChangeScrollOffsetImpl, base::BindOnce(&AutofillAgent::DidChangeScrollOffsetImpl,
weak_ptr_factory_.GetWeakPtr(), element_)); weak_ptr_factory_.GetWeakPtr(), element_));
} else if (!IsKeyboardAccessoryEnabled()) { } else {
HidePopup(); HidePopup();
} }
} }
...@@ -224,8 +224,7 @@ void AutofillAgent::DidChangeScrollOffsetImpl( ...@@ -224,8 +224,7 @@ void AutofillAgent::DidChangeScrollOffsetImpl(
} }
// Ignore subsequent scroll offset changes. // Ignore subsequent scroll offset changes.
if (!IsKeyboardAccessoryEnabled()) HidePopup();
HidePopup();
} }
void AutofillAgent::FocusedElementChanged(const WebElement& element) { void AutofillAgent::FocusedElementChanged(const WebElement& element) {
...@@ -639,8 +638,7 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, ...@@ -639,8 +638,7 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
// criteria are not met. // criteria are not met.
WebString value = element.EditingValue(); WebString value = element.EditingValue();
if (value.length() > kMaxDataLength || if (value.length() > kMaxDataLength ||
(!IsKeyboardAccessoryEnabled() && !options.autofill_on_empty_values && (!options.autofill_on_empty_values && value.IsEmpty()) ||
value.IsEmpty()) ||
(options.requires_caret_at_end && (options.requires_caret_at_end &&
(element.SelectionStart() != element.SelectionEnd() || (element.SelectionStart() != element.SelectionEnd() ||
element.SelectionEnd() != static_cast<int>(value.length())))) { element.SelectionEnd() != static_cast<int>(value.length())))) {
...@@ -840,6 +838,10 @@ void AutofillAgent::HidePopup() { ...@@ -840,6 +838,10 @@ void AutofillAgent::HidePopup() {
is_popup_possibly_visible_ = false; is_popup_possibly_visible_ = false;
is_generation_popup_possibly_visible_ = false; is_generation_popup_possibly_visible_ = false;
// The keyboard accessory has a separate, more complex hiding logic.
if (IsKeyboardAccessoryEnabled())
return;
GetAutofillDriver()->HidePopup(); GetAutofillDriver()->HidePopup();
} }
......
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