5#include "ui/accessibility/platform/ax_platform_relation_win.h"
12#include "base/lazy_instance.h"
13#include "base/strings/string_number_conversions.h"
14#include "base/strings/string_util.h"
15#include "base/strings/utf_string_conversions.h"
18#include "third_party/iaccessible2/ia2_api_all.h"
20#include "ui/accessibility/ax_action_data.h"
21#include "ui/accessibility/ax_mode_observer.h"
22#include "ui/accessibility/ax_node_data.h"
23#include "ui/accessibility/ax_role_properties.h"
24#include "ui/accessibility/ax_text_utils.h"
25#include "ui/accessibility/ax_tree_data.h"
26#include "ui/accessibility/platform/ax_platform_node_base.h"
27#include "ui/accessibility/platform/ax_platform_node_delegate.h"
28#include "ui/accessibility/platform/ax_unique_id.h"
29#include "ui/base/win/atl_module.h"
30#include "ui/gfx/geometry/rect_conversions.h"
43 return IA2_RELATION_MEMBER_OF;
45 return IA2_RELATION_ERROR;
51 return IA2_RELATION_CONTROLLED_BY;
55 return base::string16();
62 return IA2_RELATION_CONTROLLER_FOR;
64 return IA2_RELATION_DESCRIBED_BY;
66 return IA2_RELATION_DETAILS;
68 return IA2_RELATION_FLOWS_TO;
70 return IA2_RELATION_LABELLED_BY;
74 return base::string16();
81 return IA2_RELATION_ERROR_FOR;
85 return base::string16();
92 return IA2_RELATION_CONTROLLED_BY;
94 return IA2_RELATION_DESCRIPTION_FOR;
96 return IA2_RELATION_DETAILS_FOR;
98 return IA2_RELATION_FLOWS_FROM;
100 return IA2_RELATION_LABEL_FOR;
104 return base::string16();
111 const base::string16& desired_ia2_relation,
112 base::string16* out_ia2_relation,
113 std::set<AXPlatformNode*>* out_targets) {
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;
129 for (int32_t attr_index =
135 int_attributes_with_reverse_relations.push_back(attr);
137 for (int32_t attr_index =
144 intlist_attributes_with_reverse_relations.push_back(attr);
161 if (!relation.empty() &&
162 (desired_ia2_relation.empty() || desired_ia2_relation == relation)) {
166 if (desired_index == total_count) {
167 *out_ia2_relation = relation;
179 int_attributes_with_reverse_relations) {
181 std::set<AXPlatformNode*> targets =
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;
204 if (!relation.empty() &&
205 (desired_ia2_relation.empty() || desired_ia2_relation == relation)) {
206 if (desired_index == total_count) {
207 *out_ia2_relation = relation;
210 if (target_id == node_data.
id)
214 if (out_targets->size() == 0)
225 intlist_attributes_with_reverse_relations) {
226 base::string16 relation =
228 std::set<AXPlatformNode*> targets =
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;
257 targets_.push_back(
target);
264 *relation_type = SysAllocString(type_.c_str());
265 DCHECK(*relation_type);
273 *n_targets =
static_cast<LONG>(targets_.size());
282 if (target_index < 0 || target_index >=
static_cast<LONG>(targets_.size())) {
286 *
target =
static_cast<IAccessible*
>(targets_[target_index].Get());
294 if (!targets || !n_targets)
298 if (
count > max_targets)
void CreateATLModuleIfNeeded()
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)
std::vector< std::pair< ax::mojom::IntAttribute, int32_t > > int_attributes
std::vector< std::pair< ax::mojom::IntListAttribute, std::vector< int32_t > > > intlist_attributes