Skip to content

Commit 6112c3c

Browse files
committed
[a11y] Copy third_party/accessibility
1 parent 9116521 commit 6112c3c

File tree

217 files changed

+87954
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+87954
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("//flutter/common/config.gni")
6+
import("//flutter/testing/testing.gni")
7+
8+
config("accessibility_config") {
9+
visibility = [
10+
"//flutter/shell/platform/common:common_cpp_accessibility",
11+
"//flutter/third_party/accessibility/*",
12+
]
13+
if (is_win) {
14+
# TODO(cbracken): https://github.com/flutter/flutter/issues/92229
15+
defines = [ "_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING" ]
16+
}
17+
include_dirs = [ "//flutter/third_party/accessibility" ]
18+
if (is_linux) {
19+
include_dirs += [
20+
"$custom_sysroot/usr/include/atk-1.0",
21+
"$custom_sysroot/usr/include/at-spi2-atk/2.0",
22+
"$custom_sysroot/usr/include/glib-2.0",
23+
]
24+
25+
if (target_cpu == "arm64") {
26+
include_dirs += [ "$custom_sysroot/usr/lib64/glib-2.0/include" ]
27+
} else {
28+
include_dirs += [ "$custom_sysroot/usr/lib/glib-2.0/include" ]
29+
}
30+
}
31+
}
32+
33+
source_set("accessibility") {
34+
defines = []
35+
36+
public_deps = [
37+
"ax",
38+
"ax_build",
39+
"base",
40+
"gfx",
41+
]
42+
43+
public_configs = [ ":accessibility_config" ]
44+
45+
if (is_mac) {
46+
frameworks = [
47+
"AppKit.framework",
48+
"CoreFoundation.framework",
49+
"CoreGraphics.framework",
50+
"CoreText.framework",
51+
"IOSurface.framework",
52+
]
53+
}
54+
}
55+
56+
if (enable_unittests) {
57+
test_fixtures("accessibility_fixtures") {
58+
fixtures = []
59+
}
60+
61+
executable("accessibility_unittests") {
62+
testonly = true
63+
64+
public_configs = [ ":accessibility_config" ]
65+
66+
if (is_mac || is_win) {
67+
sources = [
68+
"ax/ax_enum_util_unittest.cc",
69+
"ax/ax_event_generator_unittest.cc",
70+
"ax/ax_node_data_unittest.cc",
71+
"ax/ax_node_position_unittest.cc",
72+
"ax/ax_range_unittest.cc",
73+
"ax/ax_role_properties_unittest.cc",
74+
"ax/ax_table_info_unittest.cc",
75+
"ax/ax_tree_unittest.cc",
76+
"ax/test_ax_node_helper.cc",
77+
"ax/test_ax_node_helper.h",
78+
"ax/test_ax_tree_manager.cc",
79+
"ax/test_ax_tree_manager.h",
80+
]
81+
82+
sources += [
83+
"ax/platform/ax_platform_node_base_unittest.cc",
84+
"ax/platform/ax_platform_node_unittest.cc",
85+
"ax/platform/ax_platform_node_unittest.h",
86+
"ax/platform/ax_unique_id_unittest.cc",
87+
"ax/platform/test_ax_node_wrapper.cc",
88+
"ax/platform/test_ax_node_wrapper.h",
89+
]
90+
91+
if (is_win) {
92+
sources += [
93+
"ax/platform/ax_fragment_root_win_unittest.cc",
94+
"ax/platform/ax_platform_node_win_unittest.cc",
95+
"base/win/dispatch_stub.cc",
96+
"base/win/dispatch_stub.h",
97+
"base/win/display_unittest.cc",
98+
"base/win/scoped_bstr_unittest.cc",
99+
"base/win/scoped_safearray_unittest.cc",
100+
"base/win/scoped_variant_unittest.cc",
101+
]
102+
}
103+
104+
sources += [
105+
"base/logging_unittests.cc",
106+
"base/string_utils_unittest.cc",
107+
"gfx/geometry/insets_unittest.cc",
108+
"gfx/geometry/point_unittest.cc",
109+
"gfx/geometry/rect_unittest.cc",
110+
"gfx/geometry/size_unittest.cc",
111+
"gfx/geometry/vector2d_unittest.cc",
112+
"gfx/range/range_unittest.cc",
113+
"gfx/test/gfx_util.cc",
114+
"gfx/test/gfx_util.h",
115+
]
116+
117+
deps = [
118+
":accessibility",
119+
":accessibility_fixtures",
120+
"//flutter/testing",
121+
"//flutter/testing:dart",
122+
]
123+
}
124+
}
125+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Flutter Accessibility Library
2+
==============
3+
4+
This accessibility library is a fork of the [chromium](https://www.chromium.org) accessibility code at commit
5+
[4579d5538f06c5ef615a15bc67ebb9ac0523a973](https://chromium.googlesource.com/chromium/src/+/4579d5538f06c5ef615a15bc67ebb9ac0523a973).
6+
7+
For the main ax code, the following parts were not imported:
8+
`fuzz_corpus`, `extensions` and `DEPS` files.
9+
10+
`ax/`: https://source.chromium.org/chromium/chromium/src/+/master:ui/accessibility/
11+
`ax_build/`: https://source.chromium.org/chromium/chromium/src/+/master:build/
12+
`base/`: https://source.chromium.org/chromium/chromium/src/+/master:base/
13+
`gfx/`: https://source.chromium.org/chromium/chromium/src/+/master:ui/gfx/
14+
15+
Update to this Library
16+
==============
17+
Bug fixes to the forked files in the four directories should proceed as usual.
18+
New features or changes that change the behaviors of these classes are discouraged.
19+
20+
If you do need to make such change, please log the change at the end of this file.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("//flutter/common/config.gni")
6+
7+
source_set("ax") {
8+
visibility = [ "//flutter/third_party/accessibility/*" ]
9+
public_configs =
10+
[ "//flutter/third_party/accessibility:accessibility_config" ]
11+
12+
configs -= [ "//build/config/compiler:no_rtti" ]
13+
14+
sources = [
15+
"platform/ax_platform_node.cc",
16+
"platform/ax_platform_node.h",
17+
"platform/ax_platform_node_base.cc",
18+
"platform/ax_platform_node_base.h",
19+
"platform/ax_platform_node_delegate.h",
20+
"platform/ax_platform_node_delegate_base.cc",
21+
"platform/ax_platform_node_delegate_base.h",
22+
"platform/ax_platform_text_boundary.cc",
23+
"platform/ax_platform_text_boundary.h",
24+
"platform/ax_unique_id.cc",
25+
"platform/ax_unique_id.h",
26+
"platform/compute_attributes.cc",
27+
"platform/compute_attributes.h",
28+
]
29+
30+
sources += [
31+
"ax_action_data.cc",
32+
"ax_action_data.h",
33+
"ax_action_handler.cc",
34+
"ax_action_handler.h",
35+
"ax_action_handler_base.cc",
36+
"ax_action_handler_base.h",
37+
"ax_active_popup.cc",
38+
"ax_active_popup.h",
39+
"ax_base_export.h",
40+
"ax_clipping_behavior.h",
41+
"ax_constants.h",
42+
"ax_coordinate_system.h",
43+
"ax_enum_util.cc",
44+
"ax_enum_util.h",
45+
"ax_enums.h",
46+
"ax_event_generator.cc",
47+
"ax_event_generator.h",
48+
"ax_event_intent.cc",
49+
"ax_event_intent.h",
50+
"ax_export.h",
51+
"ax_mode.cc",
52+
"ax_mode.h",
53+
"ax_mode_observer.h",
54+
"ax_node.cc",
55+
"ax_node.h",
56+
"ax_node_data.cc",
57+
"ax_node_data.h",
58+
"ax_node_position.cc",
59+
"ax_node_position.h",
60+
"ax_node_text_styles.cc",
61+
"ax_node_text_styles.h",
62+
"ax_offscreen_result.h",
63+
"ax_position.h",
64+
"ax_range.h",
65+
"ax_relative_bounds.cc",
66+
"ax_relative_bounds.h",
67+
"ax_role_properties.cc",
68+
"ax_role_properties.h",
69+
"ax_table_info.cc",
70+
"ax_table_info.h",
71+
"ax_tree.cc",
72+
"ax_tree.h",
73+
"ax_tree_data.cc",
74+
"ax_tree_data.h",
75+
"ax_tree_id.cc",
76+
"ax_tree_id.h",
77+
"ax_tree_id_registry.cc",
78+
"ax_tree_id_registry.h",
79+
"ax_tree_manager.h",
80+
"ax_tree_manager_map.cc",
81+
"ax_tree_manager_map.h",
82+
"ax_tree_observer.cc",
83+
"ax_tree_observer.h",
84+
"ax_tree_update.h",
85+
]
86+
87+
if (is_mac) {
88+
sources += [
89+
"platform/ax_platform_node_mac.h",
90+
"platform/ax_platform_node_mac.mm",
91+
]
92+
} else if (is_win) {
93+
sources += [
94+
"platform/ax_fragment_root_delegate_win.h",
95+
"platform/ax_fragment_root_win.cc",
96+
"platform/ax_fragment_root_win.h",
97+
"platform/ax_platform_node_delegate_utils_win.cc",
98+
"platform/ax_platform_node_delegate_utils_win.h",
99+
"platform/ax_platform_node_win.cc",
100+
"platform/ax_platform_node_win.h",
101+
"platform/uia_registrar_win.cc",
102+
"platform/uia_registrar_win.h",
103+
]
104+
libs = [
105+
"oleacc.lib",
106+
"uiautomationcore.lib",
107+
]
108+
} else if (is_linux) {
109+
sources += [
110+
"platform/atk_util_auralinux.cc",
111+
"platform/atk_util_auralinux.h",
112+
"platform/atk_util_auralinux_gtk.cc",
113+
"platform/ax_platform_atk_hyperlink.cc",
114+
"platform/ax_platform_atk_hyperlink.h",
115+
"platform/ax_platform_node_auralinux.cc",
116+
"platform/ax_platform_node_auralinux.h",
117+
]
118+
libs = [
119+
"atk-1.0",
120+
"atk-bridge-2.0",
121+
"glib-2.0",
122+
"gobject-2.0",
123+
]
124+
}
125+
126+
public_deps = [
127+
"//flutter/third_party/accessibility/ax_build",
128+
"//flutter/third_party/accessibility/base",
129+
"//flutter/third_party/accessibility/gfx",
130+
]
131+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2016 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "ax_action_data.h"
6+
7+
#include "ax_enums.h"
8+
9+
namespace ui {
10+
11+
AXActionData::AXActionData()
12+
: action(ax::mojom::Action::kNone),
13+
hit_test_event_to_fire(ax::mojom::Event::kNone),
14+
horizontal_scroll_alignment(ax::mojom::ScrollAlignment::kNone),
15+
vertical_scroll_alignment(ax::mojom::ScrollAlignment::kNone),
16+
scroll_behavior(ax::mojom::ScrollBehavior::kNone) {}
17+
18+
AXActionData::AXActionData(const AXActionData& other) = default;
19+
AXActionData::~AXActionData() = default;
20+
21+
} // namespace ui
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Copyright 2016 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef UI_ACCESSIBILITY_AX_ACTION_DATA_H_
6+
#define UI_ACCESSIBILITY_AX_ACTION_DATA_H_
7+
8+
#include "ax_enums.h"
9+
#include "ax_export.h"
10+
#include "ax_tree_id.h"
11+
#include "gfx/geometry/point.h"
12+
#include "gfx/geometry/rect.h"
13+
14+
namespace ui {
15+
16+
// A compact representation of an accessibility action and the arguments
17+
// associated with that action.
18+
struct AX_EXPORT AXActionData {
19+
AXActionData();
20+
AXActionData(const AXActionData& other);
21+
~AXActionData();
22+
23+
// This is a simple serializable struct. All member variables should be
24+
// public and copyable.
25+
26+
// See the ax::mojom::Action enums in ax_enums.mojom for explanations of which
27+
// parameters apply.
28+
29+
// The action to take.
30+
ax::mojom::Action action;
31+
32+
// The ID of the tree that this action should be performed on.
33+
ui::AXTreeID target_tree_id = ui::AXTreeIDUnknown();
34+
35+
// The source extension id (if any) of this action.
36+
std::string source_extension_id;
37+
38+
// The ID of the node that this action should be performed on.
39+
int target_node_id = -1;
40+
41+
// The request id of this action tracked by the client.
42+
int request_id = -1;
43+
44+
// Use enums from ax::mojom::ActionFlags
45+
int flags = 0;
46+
47+
// For an action that creates a selection, the selection anchor and focus
48+
// (see ax_tree_data.h for definitions).
49+
int anchor_node_id = -1;
50+
int anchor_offset = -1;
51+
52+
int focus_node_id = -1;
53+
int focus_offset = -1;
54+
55+
// Start index of the text which should be queried for.
56+
int32_t start_index = -1;
57+
58+
// End index of the text which should be queried for.
59+
int32_t end_index = -1;
60+
61+
// For custom action.
62+
int custom_action_id = -1;
63+
64+
// The target rect for the action.
65+
gfx::Rect target_rect;
66+
67+
// The target point for the action.
68+
gfx::Point target_point;
69+
70+
// The new value for a node, for the SET_VALUE action. UTF-8 encoded.
71+
std::string value;
72+
73+
// The event to fire in response to a HIT_TEST action.
74+
ax::mojom::Event hit_test_event_to_fire;
75+
76+
// The scroll alignment to use for a SCROLL_TO_MAKE_VISIBLE action. The
77+
// scroll alignment controls where a node is scrolled within the viewport.
78+
ax::mojom::ScrollAlignment horizontal_scroll_alignment;
79+
ax::mojom::ScrollAlignment vertical_scroll_alignment;
80+
81+
// The behavior to use for a SCROLL_TO_MAKE_VISIBLE. This controls whether or
82+
// not the viewport is scrolled when the node is already visible.
83+
ax::mojom::ScrollBehavior scroll_behavior;
84+
};
85+
86+
} // namespace ui
87+
88+
#endif // UI_ACCESSIBILITY_AX_ACTION_DATA_H_

0 commit comments

Comments
 (0)