5#ifndef UI_ACCESSIBILITY_AX_TREE_H_
6#define UI_ACCESSIBILITY_AX_TREE_H_
13#include <unordered_map>
28struct AXTreeUpdateState;
38 std::map<ax::mojom::IntAttribute, std::map<int32_t, std::set<int32_t>>>;
41 std::map<int32_t, std::set<int32_t>>>;
55 std::vector<AXTreeObserver*>&
observers() {
return observers_; }
66 AXTreeID GetAXTreeID()
const override;
70 AXNode* GetFromId(int32_t
id)
const override;
88 bool* offscreen =
nullptr,
89 bool clip_bounds =
true)
const;
98 bool* offscreen =
nullptr,
99 bool clip_bounds =
true)
const;
105 int32_t dst_id)
const;
112 int32_t dst_id)
const;
116 std::set<int32_t> GetNodeIdsForChildTreeId(
AXTreeID child_tree_id)
const;
119 const std::set<AXTreeID> GetAllChildTreeIds()
const;
123 return int_reverse_relations_;
126 return intlist_reverse_relations_;
134 const std::string&
error()
const {
return error_; }
136 int size() {
return static_cast<int>(id_map_.size()); }
140 void SetEnableExtraMacNodes(
bool enabled);
146 int32_t GetNextNegativeInternalNodeId();
151 std::optional<int> GetPosInSet(
const AXNode& node)
override;
155 std::optional<int> GetSetSize(
const AXNode& node)
override;
157 Selection GetUnignoredSelection()
const override;
159 bool GetTreeUpdateInProgressState()
const override;
160 void SetTreeUpdateInProgressState(
bool set_tree_update_value);
164 bool HasPaginationSupport()
const override;
168 return event_intents_;
188 size_t index_in_parent,
201 bool ComputePendingChangesToNode(
const AXNodeData& new_data,
212 void NotifySubtreeWillBeReparentedOrDeleted(
217 void NotifyNodeWillBeReparentedOrDeleted(
223 void RecursivelyNotifyNodeDeletedForTreeTeardown(
AXNode* node);
232 void NotifyNodeHasBeenReparentedOrCreated(
237 void NotifyNodeDataWillChange(
const AXNodeData& old_data,
241 void NotifyNodeDataHasBeenChanged(
AXNode* node,
260 void MarkNodesForDestructionRecursive(
AXNode::AXID node_id,
273 void DeleteOldChildren(
AXNode* node,
274 const std::vector<int32_t>& new_child_ids,
282 bool CreateNewChildVector(
AXNode* node,
283 const std::vector<int32_t>& new_child_ids,
284 std::vector<AXNode*>* new_children,
293 bool allow_recursion)
const;
295 std::vector<AXTreeObserver*> observers_;
297 std::unordered_map<int32_t, AXNode*> id_map_;
308 std::map<AXTreeID, std::set<int32_t>> child_tree_id_reverse_map_;
312 mutable std::unordered_map<int32_t, std::unique_ptr<AXTableInfo>>
316 int32_t next_negative_internal_node_id_ = -1;
322 bool enable_extra_mac_nodes_ =
false;
325 struct NodeSetSizePosInSetInfo {
326 NodeSetSizePosInSetInfo();
327 ~NodeSetSizePosInSetInfo();
329 std::optional<int> pos_in_set;
330 std::optional<int> set_size;
331 std::optional<int> lowest_hierarchical_level;
336 struct OrderedSetContent;
341 struct OrderedSetItemsMap;
346 void PopulateOrderedSetItemsMap(
347 const AXNode& original_node,
348 const AXNode* ordered_set,
349 OrderedSetItemsMap* items_map_to_be_populated)
const;
354 void RecursivelyPopulateOrderedSetItemsMap(
355 const AXNode& original_node,
356 const AXNode* ordered_set,
357 const AXNode* local_parent,
358 std::optional<int> ordered_set_min_level,
359 std::optional<int> prev_level,
360 OrderedSetItemsMap* items_map_to_be_populated)
const;
364 void ComputeSetSizePosInSetAndCache(
const AXNode& node,
365 const AXNode* ordered_set);
369 void ComputeSetSizePosInSetAndCacheHelper(
370 const OrderedSetContent& ordered_set_content);
377 mutable std::unordered_map<int32_t, NodeSetSizePosInSetInfo>
378 node_set_size_pos_in_set_info_map_;
381 bool tree_update_in_progress_ =
false;
384 bool has_pagination_support_ =
false;
386 std::vector<AXEventIntent> event_intents_;
const std::string & error() const
const AXTreeData & data() const
bool enable_extra_mac_nodes() const
const IntReverseRelationMap & int_reverse_relations()
std::map< ax::mojom::IntListAttribute, std::map< int32_t, std::set< int32_t > > > IntListReverseRelationMap
std::map< ax::mojom::IntAttribute, std::map< int32_t, std::set< int32_t > > > IntReverseRelationMap
AXTree & operator=(const AXTree &)=delete
const IntListReverseRelationMap & intlist_reverse_relations()
std::vector< AXTreeObserver * > & observers()
const std::vector< AXEventIntent > & event_intents() const
AXTree(const AXTree &)=delete
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
const char * ToString(ax::mojom::Event event)
std::shared_ptr< const fml::Mapping > data