A11y:Refactor AXTree::PopulateOrderedSetItems
Refactored AXTree::PopulateOrderedSetItems, which is used for computing
set size and position in set, to make it more straight forward.
I made no change in the actual algorithm.
This change is needed to prepare for various tasks for exposing PosInSet
and SetSize for various elements
Change-Id: I2d4883bd5e3132ebbed721abb547bc24f5be0f10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2020544
Reviewed-by: Aaron Leventhal <[email protected]>
Reviewed-by: Akihiro Ota <[email protected]>
Commit-Queue: Victor Fei <[email protected]>
Cr-Commit-Position: refs/heads/master@{#737931}
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h
index c4a72570..23c152da 100644
--- a/ui/accessibility/ax_tree.h
+++ b/ui/accessibility/ax_tree.h
@@ -327,13 +327,23 @@
~OrderedSetInfo() {}
};
- // Populates items vector with all items within ordered_set.
- // Will only add items whose roles match the role of the
- // ordered_set.
- void PopulateOrderedSetItems(const AXNode* ordered_set,
- const AXNode* local_parent,
- std::vector<const AXNode*>& items,
- const AXNode& original_node) const;
+ // Populates ordered set items vector with all items associated with
+ // |original_node| and within |ordered_set|. Only items whose roles match the
+ // role of the |ordered_set| will be added.
+ void PopulateOrderedSetItems(
+ const AXNode& original_node,
+ const AXNode* ordered_set,
+ std::vector<const AXNode*>& items_to_be_populated) const;
+
+ // Helper function for recursively populating ordered sets items vector with
+ // all items associated with |original_node| and |ordered_set|. |local_parent|
+ // tracks the recursively passed in child nodes of |ordered_set|.
+ void RecursivelyPopulateOrderedSetItems(
+ const AXNode& original_node,
+ const AXNode* ordered_set,
+ const AXNode* local_parent,
+ int32_t original_node_min_level,
+ std::vector<const AXNode*>& items_to_be_populated) const;
// Helper for GetPosInSet and GetSetSize. Computes the pos_in_set and set_size
// values of all items in ordered_set and caches those values.