10 #include "flutter/third_party/accessibility/ax/ax_action_data.h"
11 #include "flutter/third_party/accessibility/ax/ax_tree_manager_map.h"
12 #include "flutter/third_party/accessibility/gfx/geometry/rect_conversions.h"
22 bridge_ = std::move(bridge);
31 const ui::AXActionData& data) {
33 auto bridge_ptr = bridge_.lock();
34 BASE_DCHECK(bridge_ptr);
35 switch (data.action) {
36 case ax::mojom::Action::kDoDefault:
37 bridge_ptr->DispatchAccessibilityAction(
38 target, FlutterSemanticsAction::kFlutterSemanticsActionTap, {});
40 case ax::mojom::Action::kFocus:
41 bridge_ptr->SetLastFocusedId(target);
42 bridge_ptr->DispatchAccessibilityAction(
44 FlutterSemanticsAction::
45 kFlutterSemanticsActionDidGainAccessibilityFocus,
48 case ax::mojom::Action::kScrollToMakeVisible:
49 bridge_ptr->DispatchAccessibilityAction(
50 target, FlutterSemanticsAction::kFlutterSemanticsActionShowOnScreen,
61 return ax_node_->data();
65 if (!ax_node_->parent()) {
68 auto bridge_ptr = bridge_.lock();
69 BASE_DCHECK(bridge_ptr);
70 return bridge_ptr->GetNativeAccessibleFromId(ax_node_->parent()->id());
74 auto bridge_ptr = bridge_.lock();
75 BASE_DCHECK(bridge_ptr);
77 if (last_focused == ui::AXNode::kInvalidAXID) {
80 return bridge_ptr->GetNativeAccessibleFromId(last_focused);
84 return static_cast<int>(ax_node_->GetUnignoredChildCount());
88 auto bridge_ptr = bridge_.lock();
89 BASE_DCHECK(bridge_ptr);
91 return bridge_ptr->GetNativeAccessibleFromId(child);
95 const ui::AXCoordinateSystem coordinate_system,
96 const ui::AXClippingBehavior clipping_behavior,
97 ui::AXOffscreenResult* offscreen_result)
const {
98 auto bridge_ptr = bridge_.lock();
99 BASE_DCHECK(bridge_ptr);
102 const bool clip_bounds =
103 clipping_behavior == ui::AXClippingBehavior::kClipped;
104 bool offscreen =
false;
106 bridge_ptr->RelativeToGlobalBounds(ax_node_, offscreen, clip_bounds);
107 if (offscreen_result !=
nullptr) {
108 *offscreen_result = offscreen ? ui::AXOffscreenResult::kOffscreen
109 : ui::AXOffscreenResult::kOnscreen;
111 return gfx::ToEnclosingRect(bounds);
114 std::weak_ptr<FlutterPlatformNodeDelegate::OwnerBridge>
123 gfx::NativeViewAccessible
125 auto bridge_ptr = bridge_.lock();
126 BASE_DCHECK(bridge_ptr);
127 auto lowest_platform_ancestor = ax_node_->GetLowestPlatformAncestor();
128 if (lowest_platform_ancestor) {
129 return bridge_ptr->GetNativeAccessibleFromId(
130 ax_node_->GetLowestPlatformAncestor()->id());
135 ui::AXNodePosition::AXPositionInstance
137 return ui::AXNodePosition::CreatePosition(*ax_node_, offset);
142 ui::AXTreeManager* tree_manager =
143 ui::AXTreeManagerMap::GetInstance().GetManager(
144 ax_node_->tree()->GetAXTreeID());
151 const ui::AXTreeID& tree_id,
153 ui::AXTreeManager* tree_manager =
154 ui::AXTreeManagerMap::GetInstance().GetManager(tree_id);
162 return ax_node_->GetUnignoredSelection();