MSAA bridge should not return any IA2-specific roles from get_accRole()
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Wed, 25 Apr 2012 08:17:08 +0000 (10:17 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 25 Apr 2012 10:43:25 +0000 (12:43 +0200)
Small cleanup/improvement. This patch just does what the removed ###
says.

Change-Id: I0d16541d2e4b8f948f32734ef0138fde5517932a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
src/plugins/platforms/windows/accessible/iaccessible2.cpp
src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp

index 132a04d..2e843ef 100644 (file)
@@ -338,9 +338,6 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relations(long maxRelations
 HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::role(long *ia2role)
 {
     accessibleDebugClientCalls(accessible);
-    //### Change QAccessibleInterface::role() to return both MSAA and IA2 roles.
-    // When that is completed, we must patch the MSAA bridge not not return any
-    // IA2-specific roles from get_accRole().
     if (!accessible->isValid())
         return E_FAIL;
 
index 6c4d217..5003d9e 100644 (file)
@@ -998,8 +998,14 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR
     }
 
     if (role != QAccessible::NoRole) {
-        if (role == QAccessible::LayeredPane)
-            role = QAccessible::Pane;
+        if (role >= QAccessible::LayeredPane) {
+            // This block should hopefully only be entered if the AT client
+            // does not support IAccessible2, since it should prefer IA2::role() then.
+            if (role == QAccessible::LayeredPane)
+                role = QAccessible::Pane;
+            else
+                role = QAccessible::Client;
+        }
         (*pvarRole).vt = VT_I4;
         (*pvarRole).lVal = role;
     } else {