mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 14:25:49 +00:00
Bug 1881191 part 3: Support RemoteAccessible in uiaRawElmProvider. r=nlapre
KeyboardShortcut is only implemented for LocalAccessible because KeyboardShortcut isn't currently relevant (or supported) for RemoteAccessible. AriaProperties can't be supported for RemoteAccessible currently. See the code comment for details. Differential Revision: https://phabricator.services.mozilla.com/D202551
This commit is contained in:
parent
ffc9eac723
commit
08b40ceb27
@ -40,13 +40,6 @@ ServiceProvider::QueryService(REFGUID aGuidService, REFIID aIID,
|
||||
if (!acc) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
AccessibleWrap* localAcc = mMsaa->LocalAcc();
|
||||
|
||||
// UIA IAccessibleEx
|
||||
if (aGuidService == IID_IAccessibleEx &&
|
||||
StaticPrefs::accessibility_uia_enable() && localAcc) {
|
||||
return mMsaa->QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
// Provide a special service ID for getting the accessible for the browser tab
|
||||
// document that contains this accessible object. If this accessible object
|
||||
@ -92,8 +85,12 @@ ServiceProvider::QueryService(REFGUID aGuidService, REFIID aIID,
|
||||
{0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}};
|
||||
if (aGuidService == IID_ISimpleDOMNode ||
|
||||
aGuidService == IID_SimpleDOMDeprecated ||
|
||||
aGuidService == IID_IAccessible || aGuidService == IID_IAccessible2)
|
||||
aGuidService == IID_IAccessible || aGuidService == IID_IAccessible2 ||
|
||||
// UIA IAccessibleEx
|
||||
(aGuidService == IID_IAccessibleEx &&
|
||||
StaticPrefs::accessibility_uia_enable())) {
|
||||
return mMsaa->QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "AccessibleWrap.h"
|
||||
#include "ARIAMap.h"
|
||||
#include "LocalAccessible-inl.h"
|
||||
#include "mozilla/a11y/RemoteAccessible.h"
|
||||
#include "MsaaAccessible.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -19,8 +20,8 @@ using namespace mozilla::a11y;
|
||||
// uiaRawElmProvider
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AccessibleWrap* uiaRawElmProvider::LocalAcc() {
|
||||
return static_cast<MsaaAccessible*>(this)->LocalAcc();
|
||||
Accessible* uiaRawElmProvider::Acc() {
|
||||
return static_cast<MsaaAccessible*>(this)->Acc();
|
||||
}
|
||||
|
||||
// IUnknown
|
||||
@ -48,7 +49,7 @@ uiaRawElmProvider::GetObjectForChild(
|
||||
|
||||
*aAccEx = nullptr;
|
||||
|
||||
return LocalAcc() ? S_OK : CO_E_OBJNOTCONNECTED;
|
||||
return Acc() ? S_OK : CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
@ -59,7 +60,7 @@ uiaRawElmProvider::GetIAccessiblePair(__RPC__deref_out_opt IAccessible** aAcc,
|
||||
*aAcc = nullptr;
|
||||
*aIdChild = 0;
|
||||
|
||||
if (!LocalAcc()) {
|
||||
if (!Acc()) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
@ -73,13 +74,12 @@ uiaRawElmProvider::GetIAccessiblePair(__RPC__deref_out_opt IAccessible** aAcc,
|
||||
STDMETHODIMP
|
||||
uiaRawElmProvider::GetRuntimeId(__RPC__deref_out_opt SAFEARRAY** aRuntimeIds) {
|
||||
if (!aRuntimeIds) return E_INVALIDARG;
|
||||
AccessibleWrap* acc = LocalAcc();
|
||||
Accessible* acc = Acc();
|
||||
if (!acc) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
|
||||
int ids[] = {UiaAppendRuntimeId,
|
||||
static_cast<int>(reinterpret_cast<intptr_t>(acc->UniqueID()))};
|
||||
int ids[] = {UiaAppendRuntimeId, MsaaAccessible::GetChildIDFor(acc)};
|
||||
*aRuntimeIds = SafeArrayCreateVector(VT_I4, 0, 2);
|
||||
if (!*aRuntimeIds) return E_OUTOFMEMORY;
|
||||
|
||||
@ -131,19 +131,24 @@ uiaRawElmProvider::GetPropertyValue(PROPERTYID aPropertyId,
|
||||
__RPC__out VARIANT* aPropertyValue) {
|
||||
if (!aPropertyValue) return E_INVALIDARG;
|
||||
|
||||
AccessibleWrap* acc = LocalAcc();
|
||||
Accessible* acc = Acc();
|
||||
if (!acc) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
LocalAccessible* localAcc = acc->AsLocal();
|
||||
|
||||
aPropertyValue->vt = VT_EMPTY;
|
||||
|
||||
switch (aPropertyId) {
|
||||
// Accelerator Key / shortcut.
|
||||
case UIA_AcceleratorKeyPropertyId: {
|
||||
if (!localAcc) {
|
||||
// KeyboardShortcut is only currently relevant for LocalAccessible.
|
||||
break;
|
||||
}
|
||||
nsAutoString keyString;
|
||||
|
||||
acc->KeyboardShortcut().ToString(keyString);
|
||||
localAcc->KeyboardShortcut().ToString(keyString);
|
||||
|
||||
if (!keyString.IsEmpty()) {
|
||||
aPropertyValue->vt = VT_BSTR;
|
||||
@ -187,9 +192,16 @@ uiaRawElmProvider::GetPropertyValue(PROPERTYID aPropertyId,
|
||||
|
||||
// ARIA Properties
|
||||
case UIA_AriaPropertiesPropertyId: {
|
||||
if (!localAcc) {
|
||||
// XXX Implement a unified version of this. We don't cache explicit
|
||||
// values for many ARIA attributes in RemoteAccessible; e.g. we use the
|
||||
// checked state rather than caching aria-checked:true. Thus, a unified
|
||||
// implementation will need to work with State(), etc.
|
||||
break;
|
||||
}
|
||||
nsAutoString ariaProperties;
|
||||
|
||||
aria::AttrIterator attribIter(acc->GetContent());
|
||||
aria::AttrIterator attribIter(localAcc->GetContent());
|
||||
while (attribIter.Next()) {
|
||||
nsAutoString attribName, attribValue;
|
||||
nsAutoString value;
|
||||
|
@ -14,7 +14,7 @@
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class AccessibleWrap;
|
||||
class Accessible;
|
||||
|
||||
/**
|
||||
* IRawElementProviderSimple implementation (maintains IAccessibleEx approach).
|
||||
@ -60,7 +60,7 @@ class uiaRawElmProvider : public IAccessibleEx,
|
||||
aRawElmProvider);
|
||||
|
||||
private:
|
||||
AccessibleWrap* LocalAcc();
|
||||
Accessible* Acc();
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
Loading…
x
Reference in New Issue
Block a user