Commit cbfdc1e3 authored by Sharon Yang's avatar Sharon Yang Committed by Commit Bot

[fuchsia] Handle receiving multiple accessibility trees

A WebContentsObserver may receive updates from multiple AXTrees.
Currently, that isn't supported, so add a fix that ignores updates that
aren't from the first tree that the WebContentsObserver receives.

Test: AccessibilityBridgeTest.MultipleAXTrees
Bug: 1136541
Change-Id: If1fb3de647c150c58bc07b55477452f91abfcef7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2469470
Commit-Queue: Sharon Yang <yangsharon@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820488}
parent 28198c08
...@@ -87,13 +87,19 @@ void AccessibilityBridge::OnCommitComplete() { ...@@ -87,13 +87,19 @@ void AccessibilityBridge::OnCommitComplete() {
void AccessibilityBridge::AccessibilityEventReceived( void AccessibilityBridge::AccessibilityEventReceived(
const content::AXEventNotificationDetails& details) { const content::AXEventNotificationDetails& details) {
if (!enable_semantic_updates_) { // No need to process events if Fuchsia is not receiving them.
// No need to process events if Fuchsia is not receiving them. if (!enable_semantic_updates_)
return; return;
}
// Updates to AXTree must be applied first. // Updates to AXTree must be applied first.
for (const ui::AXTreeUpdate& update : details.updates) { for (const ui::AXTreeUpdate& update : details.updates) {
if (!update.has_tree_data &&
ax_tree_.GetAXTreeID() != ui::AXTreeIDUnknown() &&
ax_tree_.GetAXTreeID() != details.ax_tree_id) {
// TODO(https://crbug.com/1128954): Add support for combining AXTrees.
continue;
}
if (!ax_tree_.Unserialize(update)) { if (!ax_tree_.Unserialize(update)) {
// If this fails, it is a fatal error that will cause an early exit. // If this fails, it is a fatal error that will cause an early exit.
std::move(on_error_callback_).Run(ZX_ERR_INTERNAL); std::move(on_error_callback_).Run(ZX_ERR_INTERNAL);
......
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