9 #include "flutter/fml/logging.h"
12 #include "flutter/third_party/accessibility/ax/ax_clipping_behavior.h"
13 #include "flutter/third_party/accessibility/ax/ax_coordinate_system.h"
14 #include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_win.h"
19 std::weak_ptr<AccessibilityBridge> bridge,
21 : bridge_(bridge), view_(view) {
22 FML_DCHECK(!bridge_.expired())
23 <<
"Expired AccessibilityBridge passed to node delegate";
28 if (ax_platform_node_) {
29 ax_platform_node_->Destroy();
37 ax_platform_node_ = ui::AXPlatformNode::Create(
this);
38 FML_DCHECK(ax_platform_node_) <<
"Failed to create AXPlatformNode";
42 gfx::NativeViewAccessible
44 FML_DCHECK(ax_platform_node_) <<
"AXPlatformNode hasn't been created";
45 return ax_platform_node_->GetNativeViewAccessible();
50 int screen_physical_pixel_x,
51 int screen_physical_pixel_y)
const {
53 ui::AXOffscreenResult result;
54 gfx::Rect rect =
GetBoundsRect(ui::AXCoordinateSystem::kScreenPhysicalPixels,
55 ui::AXClippingBehavior::kUnclipped, &result);
56 gfx::Point screen_point(screen_physical_pixel_x, screen_physical_pixel_y);
57 if (!rect.Contains(screen_point)) {
62 auto bridge = bridge_.lock();
64 for (
const ui::AXNode* child :
GetAXNode()->children()) {
65 std::shared_ptr<FlutterPlatformNodeDelegateWindows> win_delegate =
66 std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
67 bridge->GetFlutterPlatformNodeDelegateFromID(child->id()).lock());
68 FML_DCHECK(win_delegate)
69 <<
"No FlutterPlatformNodeDelegate found for node " << child->id();
70 auto hit_view = win_delegate->HitTestSync(screen_physical_pixel_x,
71 screen_physical_pixel_y);
78 return ax_platform_node_->GetNativeViewAccessible();
83 const ui::AXCoordinateSystem coordinate_system,
84 const ui::AXClippingBehavior clipping_behavior,
85 ui::AXOffscreenResult* offscreen_result)
const {
87 coordinate_system, clipping_behavior, offscreen_result);
88 POINT origin{bounds.x(), bounds.y()};
89 POINT extent{bounds.x() + bounds.width(), bounds.y() + bounds.height()};
92 return gfx::Rect(origin.x, origin.y, extent.x - origin.x,
98 ax_platform_node_->NotifyAccessibilityEvent(
event_type);
104 varchild.lVal = CHILDID_SELF;
108 gfx::AcceleratedWidget
115 return ax_platform_node_;