|
6 | 6 |
|
7 | 7 | #include <utility> |
8 | 8 |
|
| 9 | +#include "flutter/shell/platform/common/accessibility_bridge.h" |
9 | 10 | #include "flutter/third_party/accessibility/ax/ax_action_data.h" |
| 11 | +#include "flutter/third_party/accessibility/ax/ax_tree_manager_map.h" |
10 | 12 | #include "flutter/third_party/accessibility/gfx/geometry/rect_conversions.h" |
11 | 13 |
|
12 | 14 | namespace flutter { |
@@ -118,4 +120,46 @@ ui::AXPlatformNode* FlutterPlatformNodeDelegate::GetPlatformNode() const { |
118 | 120 | return nullptr; |
119 | 121 | } |
120 | 122 |
|
| 123 | +gfx::NativeViewAccessible |
| 124 | +FlutterPlatformNodeDelegate::GetLowestPlatformAncestor() const { |
| 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()); |
| 131 | + } |
| 132 | + return nullptr; |
| 133 | +} |
| 134 | + |
| 135 | +ui::AXNodePosition::AXPositionInstance |
| 136 | +FlutterPlatformNodeDelegate::CreateTextPositionAt(int offset) const { |
| 137 | + return ui::AXNodePosition::CreatePosition(*ax_node_, offset); |
| 138 | +} |
| 139 | + |
| 140 | +ui::AXPlatformNode* FlutterPlatformNodeDelegate::GetFromNodeID( |
| 141 | + int32_t node_id) { |
| 142 | + ui::AXTreeManager* tree_manager = |
| 143 | + ui::AXTreeManagerMap::GetInstance().GetManager( |
| 144 | + ax_node_->tree()->GetAXTreeID()); |
| 145 | + AccessibilityBridge* platform_manager = |
| 146 | + static_cast<AccessibilityBridge*>(tree_manager); |
| 147 | + return platform_manager->GetPlatformNodeFromTree(node_id); |
| 148 | +} |
| 149 | + |
| 150 | +ui::AXPlatformNode* FlutterPlatformNodeDelegate::GetFromTreeIDAndNodeID( |
| 151 | + const ui::AXTreeID& tree_id, |
| 152 | + int32_t node_id) { |
| 153 | + ui::AXTreeManager* tree_manager = |
| 154 | + ui::AXTreeManagerMap::GetInstance().GetManager(tree_id); |
| 155 | + AccessibilityBridge* platform_manager = |
| 156 | + static_cast<AccessibilityBridge*>(tree_manager); |
| 157 | + return platform_manager->GetPlatformNodeFromTree(node_id); |
| 158 | +} |
| 159 | + |
| 160 | +const ui::AXTree::Selection FlutterPlatformNodeDelegate::GetUnignoredSelection() |
| 161 | + const { |
| 162 | + return ax_node_->GetUnignoredSelection(); |
| 163 | +} |
| 164 | + |
121 | 165 | } // namespace flutter |
0 commit comments