Commit 18d950ab authored by Nektarios Paisios's avatar Nektarios Paisios Committed by Commit Bot

Accessibility focus should be updated after paint

In crrev.com/c/1930061
the accessibility focus event in TableView was tweaked so that it would always
fire after the accessibility information had been updated.
However, there are instances when the accessibility information is updated more than one time.
We need to fire the focus event after paint, to ensure that the accessibility tree has become stable and won't update
right away again.

The order of the problematic operations are:
1. The Task Manager refreshes its contents at a constant interval.
OnItemsChanged is called which calls SortItemsAndUpdateMapping and which in turn calls UpdateVirtualAccessibilityChildren.
This would update the accessibility focus as well.
2. OnPaint is called and in some cases, whenever the contents of the Task Manager are sorted, SortItemsAndUpdateMapping would also be called,
which updates the virtual accessibility children a second time without updating the focus,
since the focus had already been updated.

R=sky@chromium.org, dmazzoni@chromium.org

Bug: 811277
Change-Id: Ifbf8a6908f3411030912f30981aa3c22f1874f8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946691
Auto-Submit: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722504}
parent c8dfb92a
......@@ -815,6 +815,9 @@ void TableView::OnPaint(gfx::Canvas* canvas) {
grouping_flags);
i = last + 1;
}
if (needs_update_accessibility_focus_)
UpdateAccessibilityFocus();
}
void TableView::OnFocus() {
......@@ -1179,13 +1182,8 @@ GroupRange TableView::GetGroupRange(int model_index) const {
void TableView::UpdateVirtualAccessibilityChildren() {
GetViewAccessibility().RemoveAllVirtualChildViews();
if (!GetRowCount() || visible_columns_.empty()) {
NotifyAccessibilityEvent(ax::mojom::Event::kChildrenChanged, true);
if (needs_update_accessibility_focus_)
UpdateAccessibilityFocus();
if (!GetRowCount() || visible_columns_.empty())
return;
}
const base::Optional<int> primary_sorted_column_id =
sort_descriptors().empty()
......@@ -1339,11 +1337,6 @@ void TableView::UpdateVirtualAccessibilityChildren() {
GetViewAccessibility().AddVirtualChildView(std::move(ax_row));
}
NotifyAccessibilityEvent(ax::mojom::Event::kChildrenChanged, true);
if (needs_update_accessibility_focus_)
UpdateAccessibilityFocus();
}
void TableView::UpdateAccessibilityFocus() {
......
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