@@ -96,11 +96,10 @@ impl NodeWrapper<'_> {
9696 Role :: Abbr => UIA_TextControlTypeId ,
9797 Role :: Alert => UIA_TextControlTypeId ,
9898 Role :: AlertDialog => {
99- // Chromium's implementation suggests the use of
100- // UIA_TextControlTypeId, not UIA_PaneControlTypeId, because some
101- // Windows screen readers are not compatible with
102- // Role::AlertDialog yet.
103- UIA_TextControlTypeId
99+ // Documentation suggests the use of UIA_PaneControlTypeId,
100+ // but Chromium's implementation uses UIA_WindowControlTypeId
101+ // instead.
102+ UIA_WindowControlTypeId
104103 }
105104 Role :: Application => UIA_PaneControlTypeId ,
106105 Role :: Article => UIA_GroupControlTypeId ,
@@ -121,7 +120,12 @@ impl NodeWrapper<'_> {
121120 Role :: Definition => UIA_GroupControlTypeId ,
122121 Role :: DescriptionList => UIA_ListControlTypeId ,
123122 Role :: Details => UIA_GroupControlTypeId ,
124- Role :: Dialog => UIA_PaneControlTypeId ,
123+ Role :: Dialog => {
124+ // Documentation suggests the use of UIA_PaneControlTypeId,
125+ // but Chromium's implementation uses UIA_WindowControlTypeId
126+ // instead.
127+ UIA_WindowControlTypeId
128+ }
125129 Role :: DisclosureTriangle => UIA_ButtonControlTypeId ,
126130 Role :: Document | Role :: Terminal => UIA_DocumentControlTypeId ,
127131 Role :: EmbeddedObject => UIA_PaneControlTypeId ,
@@ -256,6 +260,17 @@ impl NodeWrapper<'_> {
256260 self . 0 . role_description ( )
257261 }
258262
263+ fn aria_role ( & self ) -> Option < & str > {
264+ match self . 0 . role ( ) {
265+ Role :: AlertDialog => Some ( "alertdialog" ) ,
266+ Role :: Dialog => Some ( "dialog" ) ,
267+ _ => {
268+ // TODO: Expose more ARIA roles.
269+ None
270+ }
271+ }
272+ }
273+
259274 pub ( crate ) fn name ( & self ) -> Option < WideString > {
260275 let mut result = WideString :: default ( ) ;
261276 if self . 0 . label_comes_from_value ( ) {
@@ -467,6 +482,18 @@ impl NodeWrapper<'_> {
467482 self . 0 . role ( ) == Role :: PasswordInput
468483 }
469484
485+ fn is_dialog ( & self ) -> bool {
486+ self . 0 . is_dialog ( )
487+ }
488+
489+ fn is_window_pattern_supported ( & self ) -> bool {
490+ self . 0 . is_dialog ( )
491+ }
492+
493+ fn is_modal ( & self ) -> bool {
494+ self . 0 . is_modal ( )
495+ }
496+
470497 pub ( crate ) fn enqueue_property_changes (
471498 & self ,
472499 queue : & mut Vec < QueuedEvent > ,
@@ -526,7 +553,8 @@ impl NodeWrapper<'_> {
526553 IScrollItemProvider ,
527554 ISelectionItemProvider ,
528555 ISelectionProvider ,
529- ITextProvider
556+ ITextProvider ,
557+ IWindowProvider
530558) ]
531559pub ( crate ) struct PlatformNode {
532560 pub ( crate ) context : Weak < Context > ,
@@ -980,6 +1008,7 @@ macro_rules! patterns {
9801008properties ! {
9811009 ( UIA_ControlTypePropertyId , control_type) ,
9821010 ( UIA_LocalizedControlTypePropertyId , localized_control_type) ,
1011+ ( UIA_AriaRolePropertyId , aria_role) ,
9831012 ( UIA_NamePropertyId , name) ,
9841013 ( UIA_FullDescriptionPropertyId , description) ,
9851014 ( UIA_CulturePropertyId , culture) ,
@@ -997,7 +1026,8 @@ properties! {
9971026 ( UIA_IsPasswordPropertyId , is_password) ,
9981027 ( UIA_PositionInSetPropertyId , position_in_set) ,
9991028 ( UIA_SizeOfSetPropertyId , size_of_set) ,
1000- ( UIA_AriaPropertiesPropertyId , aria_properties)
1029+ ( UIA_AriaPropertiesPropertyId , aria_properties) ,
1030+ ( UIA_IsDialogPropertyId , is_dialog)
10011031}
10021032
10031033patterns ! {
@@ -1148,6 +1178,41 @@ patterns! {
11481178 }
11491179 } )
11501180 }
1181+ ) ) ,
1182+ ( UIA_WindowPatternId , IWindowProvider , IWindowProvider_Impl , is_window_pattern_supported, (
1183+ ( UIA_WindowIsModalPropertyId , IsModal , is_modal, BOOL )
1184+ ) , (
1185+ fn SetVisualState ( & self , _: WindowVisualState ) -> Result <( ) > {
1186+ Err ( invalid_operation( ) )
1187+ } ,
1188+
1189+ fn Close ( & self ) -> Result <( ) > {
1190+ Err ( not_supported( ) )
1191+ } ,
1192+
1193+ fn WaitForInputIdle ( & self , _: i32 ) -> Result <BOOL > {
1194+ Err ( not_supported( ) )
1195+ } ,
1196+
1197+ fn CanMaximize ( & self ) -> Result <BOOL > {
1198+ Err ( not_supported( ) )
1199+ } ,
1200+
1201+ fn CanMinimize ( & self ) -> Result <BOOL > {
1202+ Err ( not_supported( ) )
1203+ } ,
1204+
1205+ fn WindowVisualState ( & self ) -> Result <WindowVisualState > {
1206+ Err ( not_supported( ) )
1207+ } ,
1208+
1209+ fn WindowInteractionState ( & self ) -> Result <WindowInteractionState > {
1210+ Ok ( WindowInteractionState_ReadyForUserInteraction )
1211+ } ,
1212+
1213+ fn IsTopmost ( & self ) -> Result <BOOL > {
1214+ Err ( not_supported( ) )
1215+ }
11511216 ) )
11521217}
11531218
0 commit comments