Commit 30a6be77 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Narrow SetSelectedLineState() side-effects

When an Omnibox line goes to state button-selected, we called
OnTemporaryTextMaybeChanged(). We did this because it happened to
call SetAccessibilityLabel() and wasn't harmful in the general case.
But it turns out to be harmful in some corner RTL cases, so this
narrows it to solely the accessibility call.

This required adding a sibling virtual method to OnTemporary...()
of OmniboxView::SetAccessibilityLabel(). This only affects desktop
platforms.

Change-Id: If09b6870415522ce69caaf746186b7867611b7da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895967Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Commit-Queue: Kevin Bailey <krb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712262}
parent 28f8f599
...@@ -187,7 +187,7 @@ class OmniboxViewViews : public OmniboxView, ...@@ -187,7 +187,7 @@ class OmniboxViewViews : public OmniboxView,
void ClearAccessibilityLabel(); void ClearAccessibilityLabel();
void SetAccessibilityLabel(const base::string16& display_text, void SetAccessibilityLabel(const base::string16& display_text,
const AutocompleteMatch& match); const AutocompleteMatch& match) override;
// Selects the whole omnibox contents as a result of the user gesture. This // Selects the whole omnibox contents as a result of the user gesture. This
// may also unapply steady state elisions depending on user preferences. // may also unapply steady state elisions depending on user preferences.
......
...@@ -203,8 +203,8 @@ void OmniboxPopupModel::SetSelectedLineState(LineState state) { ...@@ -203,8 +203,8 @@ void OmniboxPopupModel::SetSelectedLineState(LineState state) {
// Ensures update of accessibility data for button text. // Ensures update of accessibility data for button text.
if (state == BUTTON_FOCUSED) { if (state == BUTTON_FOCUSED) {
edit_model_->view()->OnTemporaryTextMaybeChanged( edit_model_->view()->SetAccessibilityLabel(edit_model_->view()->GetText(),
edit_model_->view()->GetText(), match, false, false); match);
} }
} }
......
...@@ -152,6 +152,10 @@ class OmniboxView { ...@@ -152,6 +152,10 @@ class OmniboxView {
// true. // true.
virtual void ApplyCaretVisibility() = 0; virtual void ApplyCaretVisibility() = 0;
// Updates the accessibility state by enunciating any on-focus text.
virtual void SetAccessibilityLabel(const base::string16& display_text,
const AutocompleteMatch& match) {}
// Called when the temporary text in the model may have changed. // Called when the temporary text in the model may have changed.
// |display_text| is the new text to show; |match_type| is the type of the // |display_text| is the new text to show; |match_type| is the type of the
// match the new text came from. |save_original_selection| is true when there // match the new text came from. |save_original_selection| is true when there
......
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