Commit bb200018 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Revert earlier a11y change

The previous a11y change:

https://chromium-review.googlesource.com/c/chromium/src/+/1955161

didn't work well on Windows. I'm just reverting it since I don't
have time to look into a proper fix.

This had minor conflicts, which may cause an issue merging to M81.

Bug: 1045192 1045199
Change-Id: Idbf00425dcfc8a3a516cd60a8c5338c1faea3e74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036806Reviewed-by: default avatarOrin Jaworski <orinj@chromium.org>
Commit-Queue: Kevin Bailey <krb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738358}
parent 757854e1
...@@ -508,11 +508,8 @@ void LocationBarView::Layout() { ...@@ -508,11 +508,8 @@ void LocationBarView::Layout() {
leading_decorations.AddDecoration(vertical_padding, location_height, false, leading_decorations.AddDecoration(vertical_padding, location_height, false,
kLeadingDecorationMaxFraction, kLeadingDecorationMaxFraction,
edge_padding, selected_keyword_view_); edge_padding, selected_keyword_view_);
// Call this even if keyword doesn't change. Let the View decide what to do if (selected_keyword_view_->keyword() != keyword) {
// about a11y. selected_keyword_view_->SetKeyword(keyword, profile_);
bool keyword_changed = selected_keyword_view_->keyword() != keyword;
selected_keyword_view_->SetKeyword(keyword, profile_);
if (keyword_changed) {
const TemplateURL* template_url = const TemplateURL* template_url =
TemplateURLServiceFactory::GetForProfile(profile_) TemplateURLServiceFactory::GetForProfile(profile_)
->GetTemplateURLForKeyword(keyword); ->GetTemplateURLForKeyword(keyword);
......
...@@ -86,28 +86,25 @@ void SelectedKeywordView::OnThemeChanged() { ...@@ -86,28 +86,25 @@ void SelectedKeywordView::OnThemeChanged() {
void SelectedKeywordView::SetKeyword(const base::string16& keyword, void SelectedKeywordView::SetKeyword(const base::string16& keyword,
Profile* profile) { Profile* profile) {
if (keyword_ != keyword) { keyword_ = keyword;
keyword_ = keyword; if (keyword.empty())
if (keyword.empty()) return;
return;
DCHECK(profile);
DCHECK(profile); TemplateURLService* service =
TemplateURLService* service = TemplateURLServiceFactory::GetForProfile(profile);
TemplateURLServiceFactory::GetForProfile(profile); if (!service)
if (!service) return;
return;
KeywordLabelNames names = GetKeywordLabelNames(keyword, service);
KeywordLabelNames names = GetKeywordLabelNames(keyword, service); full_label_.SetText(names.full_name);
full_label_.SetText(names.full_name); partial_label_.SetText(names.short_name);
partial_label_.SetText(names.short_name);
// Update the label now so ShouldShowLabel() works correctly when the parent
// Update the label now so ShouldShowLabel() works correctly when the parent // class is calculating the preferred size. It will be updated again in
// class is calculating the preferred size. It will be updated again in // Layout(), taking into account how much space has actually been allotted.
// Layout(), taking into account how much space has actually been allotted. SetLabelForCurrentWidth();
SetLabelForCurrentWidth(); NotifyAccessibilityEvent(ax::mojom::Event::kLiveRegionChanged, true);
}
if (!keyword_.empty())
NotifyAccessibilityEvent(ax::mojom::Event::kLiveRegionChanged, true);
} }
int SelectedKeywordView::GetExtraInternalSpacing() const { int SelectedKeywordView::GetExtraInternalSpacing() const {
......
...@@ -888,10 +888,6 @@ void OmniboxViewViews::SetAccessibilityLabel(const base::string16& display_text, ...@@ -888,10 +888,6 @@ void OmniboxViewViews::SetAccessibilityLabel(const base::string16& display_text,
#endif #endif
} }
void OmniboxViewViews::AnnounceText(const base::string16& message) {
GetViewAccessibility().AnnounceText(message);
}
void OmniboxViewViews::SelectAllForUserGesture() { void OmniboxViewViews::SelectAllForUserGesture() {
if (base::FeatureList::IsEnabled(omnibox::kOneClickUnelide) && if (base::FeatureList::IsEnabled(omnibox::kOneClickUnelide) &&
UnapplySteadyStateElisions(UnelisionGesture::OTHER)) { UnapplySteadyStateElisions(UnelisionGesture::OTHER)) {
......
...@@ -194,8 +194,6 @@ class OmniboxViewViews : public OmniboxView, ...@@ -194,8 +194,6 @@ class OmniboxViewViews : public OmniboxView,
void SetAccessibilityLabel(const base::string16& display_text, void SetAccessibilityLabel(const base::string16& display_text,
const AutocompleteMatch& match) override; const AutocompleteMatch& match) override;
void AnnounceText(const base::string16& message) 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.
void SelectAllForUserGesture(); void SelectAllForUserGesture();
......
...@@ -43,9 +43,7 @@ ...@@ -43,9 +43,7 @@
#include "components/search_engines/template_url.h" #include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_prepopulate_data.h" #include "components/search_engines/template_url_prepopulate_data.h"
#include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service.h"
#include "components/strings/grit/components_strings.h"
#include "third_party/metrics_proto/omnibox_event.pb.h" #include "third_party/metrics_proto/omnibox_event.pb.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "url/url_util.h" #include "url/url_util.h"
...@@ -1080,7 +1078,6 @@ void OmniboxEditModel::ClearKeyword() { ...@@ -1080,7 +1078,6 @@ void OmniboxEditModel::ClearKeyword() {
view_->OnAfterPossibleChange(false); view_->OnAfterPossibleChange(false);
} }
view_->AnnounceText(l10n_util::GetStringUTF16(IDS_ACC_EXIT_SEARCH_MODE));
} }
void OmniboxEditModel::OnSetFocus(bool control_down) { void OmniboxEditModel::OnSetFocus(bool control_down) {
......
...@@ -156,9 +156,6 @@ class OmniboxView { ...@@ -156,9 +156,6 @@ class OmniboxView {
virtual void SetAccessibilityLabel(const base::string16& display_text, virtual void SetAccessibilityLabel(const base::string16& display_text,
const AutocompleteMatch& match) {} const AutocompleteMatch& match) {}
// Triggers announcement of immediate |message|.
virtual void AnnounceText(const base::string16& message) {}
// 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
......
...@@ -238,7 +238,4 @@ ...@@ -238,7 +238,4 @@
<message name="IDS_ACC_REMOVE_SUGGESTION_BUTTON" desc="Announcement when remove suggestion button is focused."> <message name="IDS_ACC_REMOVE_SUGGESTION_BUTTON" desc="Announcement when remove suggestion button is focused.">
Remove Suggestion button, press Enter to remove this suggestion Remove Suggestion button, press Enter to remove this suggestion
</message> </message>
<message name="IDS_ACC_EXIT_SEARCH_MODE" desc="Announcement when Omnibox exits keyword search mode.">
Exiting search mode
</message>
</grit-part> </grit-part>
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