From 12e92ff8072b06f5f9b68a071223a94e7460a383 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Thu, 1 Nov 2012 14:32:46 +0100 Subject: Expose IAccessibleTable2 to non-conformant screen readers This seems to be the established practice. Change-Id: I75a65d722a026ab0eb1805688743f46aba406e6c Reviewed-by: Frederik Gladhorn --- .../platforms/windows/accessible/iaccessible2.cpp | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp index 6acfd6e602..03bb94db8f 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp +++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp @@ -1493,13 +1493,26 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidServic *iface = 0; accessibleDebug("QWindowsIA2Accessible::QS(): %s", IIDToString(riid).constData()); - if (guidService == IID_IAccessible && riid == IID_IAccessible2) { - // The conditions for entering here should be ok (from _dicoveringInterfaces in IAccessible2.idl) - *iface = static_cast(this); - } else if (guidService == IID_IAccessible && (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch)) { - // The above conditions works with AccProbe and NVDA. - *iface = static_cast(this); - } else if (riid == IID_IAccessibleApplication) { + + if (guidService == IID_IAccessible) { + if (riid == IID_IServiceProvider) { + // do not end up calling QueryInterface for IID_IServiceProvider + *iface = 0; + } else if (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch) { + // The above conditions works with AccProbe and NVDA. + *iface = static_cast(this); + } else { + // According to _dicoveringInterfaces Discovery of Interfaces, we should really only + // enter here if riid == IID_IAccessible2, but some screen readers does not like that, + // and other servers seems to have realized that. (Chrome and Mozilla for instance, + // calls QueryInterface more or less in the same way) + + // For instance, accProbe discovers IID_IAccessibleTable2 by a QueryService only. + return QueryInterface(riid, iface); + } + } + + if (riid == IID_IAccessibleApplication) { *iface = new AccessibleApplication; return S_OK; } -- cgit v1.2.3