Commit c975f708 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Don't update FindBar UI on no-op update

This both saves us the effort of updating the UI, and greatly reduces
the number of live region changed accessibility events sent for the
match count status area.

Bug: 1015818
Change-Id: I1a63d635fcb85f9f401a8fd3f065f4cf49be0d77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879433
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709545}
parent 55d1462c
......@@ -38,6 +38,14 @@ class FindNotificationDetails {
bool final_update() const { return final_update_; }
bool operator==(const FindNotificationDetails& other) const {
return std::tie(request_id_, number_of_matches_, selection_rect_,
active_match_ordinal_, final_update_) ==
std::tie(other.request_id_, other.number_of_matches_,
other.selection_rect_, other.active_match_ordinal_,
other.final_update_);
}
private:
int request_id_; // The find-in-page request whose results we're returning.
int number_of_matches_; // How many matches were found.
......
......@@ -88,6 +88,9 @@ class FindBarView::MatchCountLabel : public views::Label {
}
void SetResult(const FindNotificationDetails& result) {
if (last_result_ && result == *last_result_)
return;
last_result_ = result;
SetText(l10n_util::GetStringFUTF16(
IDS_FIND_IN_PAGE_COUNT,
......
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