blob: 9994e21d96101120c214c51f3ee3d850b88ed4d6 [file] [log] [blame]
[email protected]4b02bbca2013-11-22 08:59:031// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_ACCESSIBILITY_AX_TREE_H_
6#define UI_ACCESSIBILITY_AX_TREE_H_
7
avi9c81217b2015-12-24 23:40:058#include <stdint.h>
9
Lei Zhanga06144782020-03-13 09:28:4710#include <map>
Chris Hall34208182019-03-13 02:26:1811#include <memory>
[email protected]d4e273462013-12-04 04:37:5812#include <set>
Lei Zhanga06144782020-03-13 09:28:4713#include <string>
Takuto Ikutaadf31eb2019-01-05 00:32:4814#include <unordered_map>
Lei Zhanga06144782020-03-13 09:28:4715#include <vector>
[email protected]4b02bbca2013-11-22 08:59:0316
Dominic Mazzoni8549eb682018-12-11 23:48:3217#include "base/observer_list.h"
James Cook36cab7c2019-10-29 23:26:4018#include "ui/accessibility/ax_enums.mojom-forward.h"
[email protected]4b02bbca2013-11-22 08:59:0319#include "ui/accessibility/ax_export.h"
Dominic Mazzoniecfb4fd2018-10-23 07:34:2020#include "ui/accessibility/ax_node.h"
dmazzoni329fd012015-10-22 20:05:3521#include "ui/accessibility/ax_node_data.h"
22#include "ui/accessibility/ax_tree_data.h"
[email protected]4b02bbca2013-11-22 08:59:0323#include "ui/accessibility/ax_tree_update.h"
24
25namespace ui {
26
Dominic Mazzoni3d9b5b92018-04-18 21:36:3827class AXTableInfo;
Dominic Mazzoni8549eb682018-12-11 23:48:3228class AXTreeObserver;
[email protected]e736e81b2014-02-24 07:15:5829struct AXTreeUpdateState;
Chris Hall697d99b2019-07-09 02:36:1130class AXLanguageDetectionManager;
[email protected]e736e81b2014-02-24 07:15:5831
[email protected]4b02bbca2013-11-22 08:59:0332// AXTree is a live, managed tree of AXNode objects that can receive
33// updates from another AXTreeSource via AXTreeUpdates, and it can be
34// used as a source for sending updates to another client tree.
35// It's designed to be subclassed to implement support for native
36// accessibility APIs on a specific platform.
Dominic Mazzoniecfb4fd2018-10-23 07:34:2037class AX_EXPORT AXTree : public AXNode::OwnerTree {
[email protected]4b02bbca2013-11-22 08:59:0338 public:
Lei Zhanga06144782020-03-13 09:28:4739 using IntReverseRelationMap =
40 std::map<ax::mojom::IntAttribute, std::map<int32_t, std::set<int32_t>>>;
41 using IntListReverseRelationMap =
42 std::map<ax::mojom::IntListAttribute,
43 std::map<int32_t, std::set<int32_t>>>;
David Tsengef6b480d2018-02-19 12:48:4244
[email protected]4b02bbca2013-11-22 08:59:0345 AXTree();
dmazzoni329fd012015-10-22 20:05:3546 explicit AXTree(const AXTreeUpdate& initial_state);
[email protected]4b02bbca2013-11-22 08:59:0347 virtual ~AXTree();
48
Lei Zhanga06144782020-03-13 09:28:4749 // AXTree owns pointers so copying is non-trivial.
50 AXTree(const AXTree&) = delete;
51 AXTree& operator=(const AXTree&) = delete;
52
Dominic Mazzoni8549eb682018-12-11 23:48:3253 void AddObserver(AXTreeObserver* observer);
54 bool HasObserver(AXTreeObserver* observer);
Nektarios Paisiosdb7b5ee2020-02-18 21:28:1155 void RemoveObserver(AXTreeObserver* observer);
Dominic Mazzoni8549eb682018-12-11 23:48:3256
57 base::ObserverList<AXTreeObserver>& observers() { return observers_; }
[email protected]e736e81b2014-02-24 07:15:5858
tfarina6b1c1e082015-02-20 23:47:0759 AXNode* root() const { return root_; }
60
Joanmarie Diggs58b67c982020-11-13 15:33:2861 const AXTreeData& data() const override;
dmazzoni329fd012015-10-22 20:05:3562
Nektarios Paisiosdb7b5ee2020-02-18 21:28:1163 // Destroys the tree and notifies all observers.
64 void Destroy();
65
Dominic Mazzoniecfb4fd2018-10-23 07:34:2066 // AXNode::OwnerTree override.
Adam Ettenberger86af2532019-09-17 20:04:4667 // Returns the globally unique ID of this accessibility tree.
68 AXTreeID GetAXTreeID() const override;
69
70 // AXNode::OwnerTree override.
tfarina6b1c1e082015-02-20 23:47:0771 // Returns the AXNode with the given |id| if it is part of this AXTree.
Dominic Mazzoniecfb4fd2018-10-23 07:34:2072 AXNode* GetFromId(int32_t id) const override;
[email protected]4b02bbca2013-11-22 08:59:0373
[email protected]d4e273462013-12-04 04:37:5874 // Returns true on success. If it returns false, it's a fatal error
75 // and this tree should be destroyed, and the source of the tree update
76 // should not be trusted any longer.
dmazzoni329fd012015-10-22 20:05:3577 virtual bool Unserialize(const AXTreeUpdate& update);
78
79 virtual void UpdateData(const AXTreeData& data);
[email protected]4b02bbca2013-11-22 08:59:0380
Dominic Mazzoni2410fc62017-06-09 22:19:1881 // Convert any rectangle from the local coordinate space of one node in
82 // the tree, to bounds in the coordinate space of the tree.
Katie Dektar2c6052d2017-09-27 00:32:3283 // If set, updates |offscreen| boolean to be true if the node is offscreen
84 // relative to its rootWebArea. Callers should initialize |offscreen|
85 // to false: this method may get called multiple times in a row and
86 // |offscreen| will be propagated.
Katie Dektardb71ad942017-11-29 20:07:4887 // If |clip_bounds| is true, result bounds will be clipped.
Dominic Mazzoni2410fc62017-06-09 22:19:1888 gfx::RectF RelativeToTreeBounds(const AXNode* node,
Katie Dektar2c6052d2017-09-27 00:32:3289 gfx::RectF node_bounds,
Katie Dektardb71ad942017-11-29 20:07:4890 bool* offscreen = nullptr,
91 bool clip_bounds = true) const;
Dominic Mazzoni2410fc62017-06-09 22:19:1892
93 // Get the bounds of a node in the coordinate space of the tree.
Katie Dektar2c6052d2017-09-27 00:32:3294 // If set, updates |offscreen| boolean to be true if the node is offscreen
95 // relative to its rootWebArea. Callers should initialize |offscreen|
96 // to false: this method may get called multiple times in a row and
97 // |offscreen| will be propagated.
Katie Dektardb71ad942017-11-29 20:07:4898 // If |clip_bounds| is true, result bounds will be clipped.
99 gfx::RectF GetTreeBounds(const AXNode* node,
100 bool* offscreen = nullptr,
101 bool clip_bounds = true) const;
Dominic Mazzoni2410fc62017-06-09 22:19:18102
Dominic Mazzoni35f2a5252017-09-26 00:56:04103 // Given a node ID attribute (one where IsNodeIdIntAttribute is true),
104 // and a destination node ID, return a set of all source node IDs that
105 // have that relationship attribute between them and the destination.
Dominic Mazzonidcef1b732018-01-26 17:57:04106 std::set<int32_t> GetReverseRelations(ax::mojom::IntAttribute attr,
Dominic Mazzoni94a4da62017-12-22 22:49:38107 int32_t dst_id) const;
Dominic Mazzoni35f2a5252017-09-26 00:56:04108
109 // Given a node ID list attribute (one where
110 // IsNodeIdIntListAttribute is true), and a destination node ID,
111 // return a set of all source node IDs that have that relationship
112 // attribute between them and the destination.
Dominic Mazzonidcef1b732018-01-26 17:57:04113 std::set<int32_t> GetReverseRelations(ax::mojom::IntListAttribute attr,
Dominic Mazzoni94a4da62017-12-22 22:49:38114 int32_t dst_id) const;
Dominic Mazzoni35f2a5252017-09-26 00:56:04115
Dominic Mazzoniaa774822018-08-29 20:33:58116 // Given a child tree ID, return the node IDs of all nodes in the tree who
117 // have a kChildTreeId int attribute with that value.
Dominic Mazzoni336bc0062018-09-23 16:46:43118 std::set<int32_t> GetNodeIdsForChildTreeId(AXTreeID child_tree_id) const;
Dominic Mazzoniaa774822018-08-29 20:33:58119
Dominic Mazzoni748888c2018-11-01 22:34:59120 // Get all of the child tree IDs referenced by any node in this tree.
121 const std::set<AXTreeID> GetAllChildTreeIds() const;
122
David Tsengef6b480d2018-02-19 12:48:42123 // Map from a relation attribute to a map from a target id to source ids.
124 const IntReverseRelationMap& int_reverse_relations() {
125 return int_reverse_relations_;
126 }
127 const IntListReverseRelationMap& intlist_reverse_relations() {
128 return intlist_reverse_relations_;
129 }
Dominic Mazzoni3d9b5b92018-04-18 21:36:38130
[email protected]5eec2f52014-01-06 22:30:54131 // Return a multi-line indented string representation, for logging.
132 std::string ToString() const;
133
[email protected]d4e273462013-12-04 04:37:58134 // A string describing the error from an unsuccessful Unserialize,
135 // for testing and debugging.
tfarinad0bfb4b62015-02-18 17:20:32136 const std::string& error() const { return error_; }
[email protected]d4e273462013-12-04 04:37:58137
dmazzoniee2eaca2015-03-18 18:13:07138 int size() { return static_cast<int>(id_map_.size()); }
139
Dominic Mazzonid42e00a2018-06-27 23:14:23140 // Call this to enable support for extra Mac nodes - for each table,
141 // a table column header and a node for each column.
142 void SetEnableExtraMacNodes(bool enabled);
143 bool enable_extra_mac_nodes() const { return enable_extra_mac_nodes_; }
144
145 // Return a negative number that's suitable to use for a node ID for
146 // internal nodes created automatically by an AXTree, so as not to
147 // conflict with positive-numbered node IDs from tree sources.
148 int32_t GetNextNegativeInternalNodeId();
149
Akihiro Otaf42a7d02020-06-12 19:07:56150 // Returns the PosInSet of |node|. Looks in node_set_size_pos_in_set_info_map_
151 // for cached value. Calls |ComputeSetSizePosInSetAndCache|if no value is
152 // present in the cache.
153 base::Optional<int> GetPosInSet(const AXNode& node) override;
154 // Returns the SetSize of |node|. Looks in node_set_size_pos_in_set_info_map_
155 // for cached value. Calls |ComputeSetSizePosInSetAndCache|if no value is
156 // present in the cache.
157 base::Optional<int> GetSetSize(const AXNode& node) override;
Akihiro Ota413ca722018-12-03 23:29:00158
Jacques Newman339afc62019-08-14 00:49:22159 Selection GetUnignoredSelection() const override;
160
Akihiro Otae3e420e2019-04-17 19:57:40161 bool GetTreeUpdateInProgressState() const override;
162 void SetTreeUpdateInProgressState(bool set_tree_update_value);
163
Kurt Catti-Schmidtc8445a12019-08-07 18:52:58164 // AXNode::OwnerTree override.
165 // Returns true if the tree represents a paginated document
166 bool HasPaginationSupport() const override;
167
Chris Hall697d99b2019-07-09 02:36:11168 // Language detection manager, entry point to language detection features.
169 // TODO(chrishall): Should this be stored by pointer or value?
170 // When should we initialize this?
171 std::unique_ptr<AXLanguageDetectionManager> language_detection_manager;
Chris Hall34208182019-03-13 02:26:18172
David Tsengb0d43662020-05-20 20:47:28173 // A list of intents active during a tree update/unserialization.
174 const std::vector<AXEventIntent>& event_intents() const {
175 return event_intents_;
176 }
177
Benjamin Beaudrye8f23a22020-12-17 20:08:02178 // Notify the delegate that the tree manager for |previous_tree_id| will be
179 // removed from the AXTreeManagerMap. Because we sometimes remove the tree
180 // manager after the tree's id has been modified, we need to pass the (old)
181 // tree id associated with the manager we are removing even though it is the
182 // same tree.
183 void NotifyTreeManagerWillBeRemoved(AXTreeID previous_tree_id);
184
[email protected]e736e81b2014-02-24 07:15:58185 private:
Dominic Mazzoniecfb4fd2018-10-23 07:34:20186 friend class AXTableInfoTest;
187
Aaron Leventhala674d632020-09-30 07:05:36188 // Accumulate errors as there can be more than one before Chrome is crashed
189 // via AccessibilityFatalError();
190 void RecordError(std::string new_error);
191
Dominic Mazzoniecfb4fd2018-10-23 07:34:20192 // AXNode::OwnerTree override.
193 //
194 // Given a node in this accessibility tree that corresponds to a table
195 // or grid, return an object containing information about the
196 // table structure. This object is computed lazily on-demand and
197 // cached until the next time the tree is updated. Clients should
198 // not retain this pointer, they should just request it every time
199 // it's needed.
200 //
201 // Returns nullptr if the node is not a valid table.
202 AXTableInfo* GetTableInfo(const AXNode* table_node) const override;
203
dtseng5a7b3d92016-09-08 06:35:58204 AXNode* CreateNode(AXNode* parent,
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08205 AXNode::AXID id,
Peter Kasting94a07a12019-05-22 19:26:28206 size_t index_in_parent,
dtseng5a7b3d92016-09-08 06:35:58207 AXTreeUpdateState* update_state);
[email protected]4b02bbca2013-11-22 08:59:03208
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08209 // Accumulates the work that will be required to update the AXTree.
210 // This allows us to notify observers of structure changes when the
211 // tree is still in a stable and unchanged state.
212 bool ComputePendingChanges(const AXTreeUpdate& update,
Lei Zhanga06144782020-03-13 09:28:47213 AXTreeUpdateState* update_state);
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08214
215 // Populates |update_state| with information about actions that will
216 // be performed on the tree during the update, such as adding or
217 // removing nodes in the tree. Returns true on success.
218 // Nothing within this call should modify tree structure or node data.
219 bool ComputePendingChangesToNode(const AXNodeData& new_data,
220 bool is_new_root,
221 AXTreeUpdateState* update_state);
222
[email protected]4b02bbca2013-11-22 08:59:03223 // This is called from within Unserialize(), it returns true on success.
dmazzoni67b4db22016-04-23 00:40:04224 bool UpdateNode(const AXNodeData& src,
225 bool is_new_root,
226 AXTreeUpdateState* update_state);
[email protected]4b02bbca2013-11-22 08:59:03227
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08228 // Notify the delegate that the subtree rooted at |node| will be
229 // destroyed or reparented.
230 void NotifySubtreeWillBeReparentedOrDeleted(
231 AXNode* node,
232 const AXTreeUpdateState* update_state);
233
234 // Notify the delegate that |node| will be destroyed or reparented.
235 void NotifyNodeWillBeReparentedOrDeleted(
236 AXNode* node,
237 const AXTreeUpdateState* update_state);
238
239 // Notify the delegate that |node| and all of its descendants will be
Victor Feie3cce4c2019-11-14 18:35:41240 // destroyed. This function is called during AXTree teardown.
241 void RecursivelyNotifyNodeDeletedForTreeTeardown(AXNode* node);
242
243 // Notify the delegate that the node marked by |node_id| has been deleted.
244 // We are passing the node id instead of ax node is because by the time this
245 // function is called, the ax node in the tree will already have been
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08246 // destroyed.
Victor Feie3cce4c2019-11-14 18:35:41247 void NotifyNodeHasBeenDeleted(AXNode::AXID node_id);
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08248
249 // Notify the delegate that |node| has been created or reparented.
250 void NotifyNodeHasBeenReparentedOrCreated(
251 AXNode* node,
252 const AXTreeUpdateState* update_state);
253
Adam Ettenberger05afcec2019-08-06 17:11:29254 // Notify the delegate that a node will change its data.
255 void NotifyNodeDataWillChange(const AXNodeData& old_data,
256 const AXNodeData& new_data);
257
258 // Notify the delegate that |node| has changed its data.
259 void NotifyNodeDataHasBeenChanged(AXNode* node,
260 const AXNodeData& old_data,
261 const AXNodeData& new_data);
dmazzoni3ab5385c2017-03-13 18:07:03262
Dominic Mazzoni35f2a5252017-09-26 00:56:04263 void UpdateReverseRelations(AXNode* node, const AXNodeData& new_data);
264
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08265 // Returns true if all pending changes in the |update_state| have been
266 // handled. If this returns false, the |error_| message will be populated.
267 // It's a fatal error to have pending changes after exhausting
268 // the AXTreeUpdate.
269 bool ValidatePendingChangesComplete(const AXTreeUpdateState& update_state);
[email protected]4b02bbca2013-11-22 08:59:03270
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08271 // Modifies |update_state| so that it knows what subtree and nodes are
272 // going to be destroyed for the subtree rooted at |node|.
273 void MarkSubtreeForDestruction(AXNode::AXID node_id,
274 AXTreeUpdateState* update_state);
275
276 // Modifies |update_state| so that it knows what nodes are
277 // going to be destroyed for the subtree rooted at |node|.
278 void MarkNodesForDestructionRecursive(AXNode::AXID node_id,
279 AXTreeUpdateState* update_state);
280
281 // Validates that destroying the subtree rooted at |node| has required
282 // information in |update_state|, then calls DestroyNodeAndSubtree on it.
dmazzonie3b7faf2015-06-01 17:56:36283 void DestroySubtree(AXNode* node, AXTreeUpdateState* update_state);
dmazzonia4b48912015-01-24 00:08:56284
[email protected]4b02bbca2013-11-22 08:59:03285 // Call Destroy() on |node|, and delete it from the id map, and then
286 // call recursively on all nodes in its subtree.
dmazzonie3b7faf2015-06-01 17:56:36287 void DestroyNodeAndSubtree(AXNode* node, AXTreeUpdateState* update_state);
[email protected]4b02bbca2013-11-22 08:59:03288
289 // Iterate over the children of |node| and for each child, destroy the
Adam Ettenbergerd9d8d58a2019-08-06 16:54:08290 // child and its subtree if its id is not in |new_child_ids|.
291 void DeleteOldChildren(AXNode* node,
avi9c81217b2015-12-24 23:40:05292 const std::vector<int32_t>& new_child_ids,
dmazzonie3b7faf2015-06-01 17:56:36293 AXTreeUpdateState* update_state);
[email protected]4b02bbca2013-11-22 08:59:03294
295 // Iterate over |new_child_ids| and populate |new_children| with
296 // pointers to child nodes, reusing existing nodes already in the tree
297 // if they exist, and creating otherwise. Reparenting is disallowed, so
298 // if the id already exists as the child of another node, that's an
[email protected]e736e81b2014-02-24 07:15:58299 // error. Returns true on success, false on fatal error.
[email protected]4b02bbca2013-11-22 08:59:03300 bool CreateNewChildVector(AXNode* node,
avi9c81217b2015-12-24 23:40:05301 const std::vector<int32_t>& new_child_ids,
[email protected]d4e273462013-12-04 04:37:58302 std::vector<AXNode*>* new_children,
[email protected]e736e81b2014-02-24 07:15:58303 AXTreeUpdateState* update_state);
[email protected]4b02bbca2013-11-22 08:59:03304
Dominic Mazzonia1bb0d122019-09-26 20:19:59305 // Internal implementation of RelativeToTreeBounds. It calls itself
306 // recursively but ensures that it can only do so exactly once!
307 gfx::RectF RelativeToTreeBoundsInternal(const AXNode* node,
308 gfx::RectF node_bounds,
309 bool* offscreen,
310 bool clip_bounds,
311 bool allow_recursion) const;
312
Dominic Mazzoni8549eb682018-12-11 23:48:32313 base::ObserverList<AXTreeObserver> observers_;
Brett Wilson0feae3a2017-12-06 03:16:56314 AXNode* root_ = nullptr;
Takuto Ikutaadf31eb2019-01-05 00:32:48315 std::unordered_map<int32_t, AXNode*> id_map_;
[email protected]d4e273462013-12-04 04:37:58316 std::string error_;
dmazzoni329fd012015-10-22 20:05:35317 AXTreeData data_;
Dominic Mazzoni35f2a5252017-09-26 00:56:04318
319 // Map from an int attribute (if IsNodeIdIntAttribute is true) to
320 // a reverse mapping from target nodes to source nodes.
David Tsengef6b480d2018-02-19 12:48:42321 IntReverseRelationMap int_reverse_relations_;
Dominic Mazzoni35f2a5252017-09-26 00:56:04322 // Map from an int list attribute (if IsNodeIdIntListAttribute is true) to
323 // a reverse mapping from target nodes to source nodes.
David Tsengef6b480d2018-02-19 12:48:42324 IntListReverseRelationMap intlist_reverse_relations_;
Dominic Mazzoniaa774822018-08-29 20:33:58325 // Map from child tree ID to the set of node IDs that contain that attribute.
Dominic Mazzoni336bc0062018-09-23 16:46:43326 std::map<AXTreeID, std::set<int32_t>> child_tree_id_reverse_map_;
Dominic Mazzoni3d9b5b92018-04-18 21:36:38327
328 // Map from node ID to cached table info, if the given node is a table.
Dominic Mazzonid42e00a2018-06-27 23:14:23329 // Invalidated every time the tree is updated.
Aaron Leventhal80797182020-02-25 18:50:31330 mutable std::unordered_map<int32_t, std::unique_ptr<AXTableInfo>>
331 table_info_map_;
Dominic Mazzonid42e00a2018-06-27 23:14:23332
333 // The next negative node ID to use for internal nodes.
334 int32_t next_negative_internal_node_id_ = -1;
335
336 // Whether we should create extra nodes that
337 // are only useful on macOS. Implemented using this flag to allow
338 // this code to be unit-tested on other platforms (for example, more
339 // code sanitizers run on Linux).
340 bool enable_extra_mac_nodes_ = false;
Akihiro Ota413ca722018-12-03 23:29:00341
342 // Contains pos_in_set and set_size data for an AXNode.
Stephan Hartmannaeef6882020-04-20 18:21:43343 struct NodeSetSizePosInSetInfo {
344 NodeSetSizePosInSetInfo();
345 ~NodeSetSizePosInSetInfo();
346
Akihiro Otaf42a7d02020-06-12 19:07:56347 base::Optional<int> pos_in_set;
348 base::Optional<int> set_size;
Stephan Hartmannaeef6882020-04-20 18:21:43349 base::Optional<int> lowest_hierarchical_level;
350 };
Akihiro Ota413ca722018-12-03 23:29:00351
Victor Fei5eea952e2020-02-28 01:43:09352 // Represents the content of an ordered set which includes the ordered set
353 // items and the ordered set container if it exists.
354 struct OrderedSetContent;
355
356 // Maps a particular hierarchical level to a list of OrderedSetContents.
357 // Represents all ordered set items/container on a particular hierarchical
358 // level.
359 struct OrderedSetItemsMap;
360
361 // Populates |items_map_to_be_populated| with all items associated with
Victor Feid95130c2020-02-03 21:42:54362 // |original_node| and within |ordered_set|. Only items whose roles match the
363 // role of the |ordered_set| will be added.
Victor Fei5eea952e2020-02-28 01:43:09364 void PopulateOrderedSetItemsMap(
Victor Feid95130c2020-02-03 21:42:54365 const AXNode& original_node,
366 const AXNode* ordered_set,
Lei Zhanga06144782020-03-13 09:28:47367 OrderedSetItemsMap* items_map_to_be_populated) const;
Victor Feid95130c2020-02-03 21:42:54368
Victor Fei5eea952e2020-02-28 01:43:09369 // Helper function for recursively populating ordered sets items map with
Victor Feid95130c2020-02-03 21:42:54370 // all items associated with |original_node| and |ordered_set|. |local_parent|
371 // tracks the recursively passed in child nodes of |ordered_set|.
Victor Fei5eea952e2020-02-28 01:43:09372 void RecursivelyPopulateOrderedSetItemsMap(
Victor Feid95130c2020-02-03 21:42:54373 const AXNode& original_node,
374 const AXNode* ordered_set,
375 const AXNode* local_parent,
Victor Fei5eea952e2020-02-28 01:43:09376 base::Optional<int> ordered_set_min_level,
377 base::Optional<int> prev_level,
Lei Zhanga06144782020-03-13 09:28:47378 OrderedSetItemsMap* items_map_to_be_populated) const;
Akihiro Ota886a96d62018-12-18 00:11:48379
Victor Fei5eea952e2020-02-28 01:43:09380 // Computes the pos_in_set and set_size values of all items in ordered_set and
381 // caches those values. Called by GetPosInSet and GetSetSize.
Akihiro Ota886a96d62018-12-18 00:11:48382 void ComputeSetSizePosInSetAndCache(const AXNode& node,
383 const AXNode* ordered_set);
Akihiro Ota413ca722018-12-03 23:29:00384
Victor Fei5eea952e2020-02-28 01:43:09385 // Helper for ComputeSetSizePosInSetAndCache. Computes and caches the
386 // pos_in_set and set_size values for a given OrderedSetContent.
387 void ComputeSetSizePosInSetAndCacheHelper(
388 const OrderedSetContent& ordered_set_content);
389
Akihiro Otab6a8a4d2018-12-04 01:56:39390 // Map from node ID to OrderedSetInfo.
391 // Item-like and ordered-set-like objects will map to populated OrderedSetInfo
392 // objects.
393 // All other objects will map to default-constructed OrderedSetInfo objects.
Akihiro Ota413ca722018-12-03 23:29:00394 // Invalidated every time the tree is updated.
Victor Fei5eea952e2020-02-28 01:43:09395 mutable std::unordered_map<int32_t, NodeSetSizePosInSetInfo>
396 node_set_size_pos_in_set_info_map_;
Chris Hall9b34c2c2018-12-04 01:45:56397
Akihiro Otae3e420e2019-04-17 19:57:40398 // Indicates if the tree is updating.
399 bool tree_update_in_progress_ = false;
Kurt Catti-Schmidtc8445a12019-08-07 18:52:58400
401 // Indicates if the tree represents a paginated document
402 bool has_pagination_support_ = false;
David Tsengb0d43662020-05-20 20:47:28403
404 std::vector<AXEventIntent> event_intents_;
[email protected]4b02bbca2013-11-22 08:59:03405};
406
407} // namespace ui
408
409#endif // UI_ACCESSIBILITY_AX_TREE_H_