Uses OnTreeDataChanged event throughout the codebase
The AXTreeData might change during an update to the tree and an
`OnTreeDataChanged` event will be fired.
This patch ensures that the right event is utilized in BrowserAccessibilityManager,
whenever the tree data changes. It also makes a copy of the new tree data for use
in followup patches in order to determine the ignored state of nodes.
`AXTree::UpdateTreeData` is changed to indicate that it should only be used for testing
and it is streamlined by having it call `AXTree::Unserialize` instead of implementing its own
logic.
In this way, if we ever change how updates to the tree data are treated,
we won't need to modify `AXTree::UpdateDataForTesting` as well.
[email protected], [email protected]
AX-Relnotes: n/a.
Change-Id: I36366d225c07c77c0f121418fa10feef92ab2aa5
Bug: 1049261
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2903292
Commit-Queue: Nektarios Paisios <[email protected]>
Auto-Submit: Nektarios Paisios <[email protected]>
Reviewed-by: Dominic Mazzoni <[email protected]>
Cr-Commit-Position: refs/heads/master@{#888535}
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h
index 1a836fbd..dcbeb5ca 100644
--- a/ui/accessibility/ax_tree.h
+++ b/ui/accessibility/ax_tree.h
@@ -105,7 +105,9 @@
// should not be trusted any longer.
virtual bool Unserialize(const AXTreeUpdate& update);
- virtual void UpdateData(const AXTreeData& data);
+ // Used by tests to update the tree data without changing any of the nodes in
+ // the tree, notifying all tree observers in the process.
+ virtual void UpdateDataForTesting(const AXTreeData& data);
// Convert any rectangle from the local coordinate space of one node in
// the tree, to bounds in the coordinate space of the tree.