113 {
114 const AXNodeData& node_data = node->GetData();
115 AXPlatformNodeDelegate* delegate = node->GetDelegate();
116
117
118
119
120
121
122
123 static std::vector<ax::mojom::IntAttribute>
124 int_attributes_with_reverse_relations;
125 static std::vector<ax::mojom::IntListAttribute>
126 intlist_attributes_with_reverse_relations;
127 static bool first_time = true;
128 if (first_time) {
129 for (int32_t attr_index =
132 ++attr_index) {
135 int_attributes_with_reverse_relations.push_back(attr);
136 }
137 for (int32_t attr_index =
139 attr_index <=
141 ++attr_index) {
144 intlist_attributes_with_reverse_relations.push_back(attr);
145 }
146 first_time = false;
147 }
148
149
150
151
152
153
154 int total_count = 0;
155
156
157
158 for (
size_t i = 0;
i < node_data.int_attributes.size(); ++
i) {
161 if (!relation.empty() &&
162 (desired_ia2_relation.empty() || desired_ia2_relation == relation)) {
163
164 if (node_data.int_attributes[
i].second == node_data.id)
165 continue;
166 if (desired_index == total_count) {
167 *out_ia2_relation = relation;
168 out_targets->insert(
169 delegate->GetFromNodeID(node_data.int_attributes[
i].second));
170 return 1;
171 }
172 total_count++;
173 }
174 }
175
176
177
179 int_attributes_with_reverse_relations) {
181 std::set<AXPlatformNode*> targets =
182 delegate->GetReverseRelations(int_attribute);
183
184 targets.erase(node);
185 if (targets.size()) {
186 if (!relation.empty() &&
187 (desired_ia2_relation.empty() || desired_ia2_relation == relation)) {
188 if (desired_index == total_count) {
189 *out_ia2_relation = relation;
190 *out_targets = targets;
191 return 1;
192 }
193 total_count++;
194 }
195 }
196 }
197
198
199
200 for (
size_t i = 0;
i < node_data.intlist_attributes.size(); ++
i) {
202 node_data.intlist_attributes[
i].first;
204 if (!relation.empty() &&
205 (desired_ia2_relation.empty() || desired_ia2_relation == relation)) {
206 if (desired_index == total_count) {
207 *out_ia2_relation = relation;
208 for (int32_t target_id : node_data.intlist_attributes[
i].second) {
209
210 if (target_id == node_data.id)
211 continue;
212 out_targets->insert(delegate->GetFromNodeID(target_id));
213 }
214 if (out_targets->size() == 0)
215 continue;
216 return 1;
217 }
218 total_count++;
219 }
220 }
221
222
223
225 intlist_attributes_with_reverse_relations) {
226 base::string16 relation =
228 std::set<AXPlatformNode*> targets =
229 delegate->GetReverseRelations(intlist_attribute);
230
231 targets.erase(node);
232 if (targets.size()) {
233 if (!relation.empty() &&
234 (desired_ia2_relation.empty() || desired_ia2_relation == relation)) {
235 if (desired_index == total_count) {
236 *out_ia2_relation = relation;
237 *out_targets = targets;
238 return 1;
239 }
240 total_count++;
241 }
242 }
243 }
244
245 return total_count;
246}
base::string16 GetIA2ReverseRelationFromIntAttr(ax::mojom::IntAttribute attribute)
base::string16 GetIA2RelationFromIntAttr(ax::mojom::IntAttribute attribute)
base::string16 GetIA2RelationFromIntListAttr(ax::mojom::IntListAttribute attribute)
base::string16 GetIA2ReverseRelationFromIntListAttr(ax::mojom::IntListAttribute attribute)