File tree Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -101,10 +101,7 @@ impl Adapter {
101
101
let state = tree. state ( ) ;
102
102
let root = state. root ( ) ;
103
103
let point = from_ns_point ( & view, & root, point) ;
104
- if let Some ( node) = root. node_at_point ( point, & filter) {
105
- return Id :: autorelease_return ( self . context . get_or_create_platform_node ( node. id ( ) ) )
106
- as * mut _ ;
107
- }
108
- null_mut ( )
104
+ let node = root. node_at_point ( point, & filter) . unwrap_or ( root) ;
105
+ Id :: autorelease_return ( self . context . get_or_create_platform_node ( node. id ( ) ) ) as * mut _
109
106
}
110
107
}
Original file line number Diff line number Diff line change @@ -47,5 +47,13 @@ extern_methods!(
47
47
48
48
#[ sel( backingScaleFactor) ]
49
49
pub ( crate ) fn backing_scale_factor( & self ) -> CGFloat ;
50
+
51
+ // NSView actually implements the full NSAccessibility protocol,
52
+ // but since we don't have complete metadata for that, it's easier
53
+ // to just expose the needed methods here.
54
+ #[ sel( accessibilityFrame) ]
55
+ pub ( crate ) fn accessibility_frame( & self ) -> NSRect ;
56
+ #[ sel( accessibilityParent) ]
57
+ pub ( crate ) fn accessibility_parent( & self ) -> * mut NSObject ;
50
58
}
51
59
) ;
Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ declare_class!(
376
376
context
377
377
. view
378
378
. load( )
379
- . map_or_else( null_mut, |view| Id :: autorelease_return ( view) as * mut _ )
379
+ . map_or_else( null_mut, |view| view. accessibility_parent ( ) )
380
380
}
381
381
} )
382
382
. unwrap_or_else( null_mut)
@@ -403,8 +403,16 @@ declare_class!(
403
403
}
404
404
} ;
405
405
406
- node. bounding_box( )
407
- . map_or( NSRect :: ZERO , |rect| to_ns_rect( & view, rect) )
406
+ node. bounding_box( ) . map_or_else(
407
+ || {
408
+ if node. is_root( ) {
409
+ view. accessibility_frame( )
410
+ } else {
411
+ NSRect :: ZERO
412
+ }
413
+ } ,
414
+ |rect| to_ns_rect( & view, rect) ,
415
+ )
408
416
} )
409
417
. unwrap_or( NSRect :: ZERO )
410
418
}
You can’t perform that action at this time.
0 commit comments