Substitute AXNode::GetPosInSet and AXNode::GetSetSize().

Only reflects updates to mac-specific code.
Substitute recently implemented AXNode functions for
calculating posinset and setsize.

Change-Id: I2e5ed33e3a6f74b33c416c1c37081ed95e5b3864
Reviewed-on: https://chromium-review.googlesource.com/c/1362195
Commit-Queue: Akihiro Ota <[email protected]>
Reviewed-by: Dominic Mazzoni <[email protected]>
Cr-Commit-Position: refs/heads/master@{#617303}
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h
index c2b0d80..95cc105 100644
--- a/ui/accessibility/ax_tree.h
+++ b/ui/accessibility/ax_tree.h
@@ -132,19 +132,18 @@
   // conflict with positive-numbered node IDs from tree sources.
   int32_t GetNextNegativeInternalNodeId();
 
-  // Returns the pos_in_set of item. Looks in ordered_set_info_map_ for cached
-  // value. Calculates pos_in_set and set_size for item (and all other items in
+  // Returns the pos_in_set of node. Looks in ordered_set_info_map_ for cached
+  // value. Calculates pos_in_set and set_size for node (and all other nodes in
   // the same ordered set) if no value is present in the cache.
   // This function is guaranteed to be only called on nodes that can hold
   // pos_in_set values, minimizing the size of the cache.
-  int32_t GetPosInSet(const int32_t node_id,
-                      const AXNode* ordered_set) override;
+  int32_t GetPosInSet(const AXNode& node, const AXNode* ordered_set) override;
   // Returns the set_size of node. Looks in ordered_set_info_map_ for cached
   // value. Calculates pos_inset_set and set_size for node (and all other nodes
   // in the same ordered set) if no value is present in the cache.
   // This function is guaranteed to be only called on nodes that can hold
   // set_size values, minimizing the size of the cache.
-  int32_t GetSetSize(const int32_t node_id, const AXNode* ordered_set) override;
+  int32_t GetSetSize(const AXNode& node, const AXNode* ordered_set) override;
 
  private:
   friend class AXTableInfoTest;
@@ -239,13 +238,17 @@
   };
 
   // Populates items vector with all items within ordered_set.
-  // Will only add items whose roles match the role of the 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;
+                               std::vector<const AXNode*>& items,
+                               bool node_is_radio_button) 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.
-  void ComputeSetSizePosInSetAndCache(const AXNode* ordered_set);
+  void ComputeSetSizePosInSetAndCache(const AXNode& node,
+                                      const AXNode* ordered_set);
 
   // Map from node ID to OrderedSetInfo.
   // Item-like and ordered-set-like objects will map to populated OrderedSetInfo