Bug 1789378: Support IAccessibleAction for cached RemoteAccessible. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D158617
This commit is contained in:
James Teh 2022-10-07 01:04:51 +00:00
parent 6a4548dc57
commit 4b1188a81d
2 changed files with 17 additions and 12 deletions

View File

@ -14,10 +14,6 @@
using namespace mozilla::a11y;
AccessibleWrap* ia2AccessibleAction::LocalAcc() {
return static_cast<MsaaAccessible*>(this)->LocalAcc();
}
Accessible* ia2AccessibleAction::Acc() {
return static_cast<MsaaAccessible*>(this)->Acc();
}
@ -30,7 +26,7 @@ ia2AccessibleAction::QueryInterface(REFIID iid, void** ppv) {
*ppv = nullptr;
if (IID_IAccessibleAction == iid && LocalAcc()) {
if (IID_IAccessibleAction == iid) {
*ppv = static_cast<IAccessibleAction*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
@ -91,14 +87,25 @@ ia2AccessibleAction::get_keyBinding(long aActionIndex, long aNumMaxBinding,
if (aActionIndex != 0 || aNumMaxBinding < 1) return E_INVALIDARG;
AccessibleWrap* acc = LocalAcc();
Accessible* acc = Acc();
if (!acc) return CO_E_OBJNOTCONNECTED;
// Expose keyboard shortcut if it's not exposed via MSAA keyboard shortcut.
KeyBinding keyBinding = acc->AccessKey();
if (keyBinding.IsEmpty()) return S_FALSE;
// Expose KeyboardShortcut if it's not exposed via MSAA accKeyboardShortcut.
LocalAccessible* localAcc = acc->AsLocal();
if (!localAcc) {
// RemoteAccessibles can't have a KeyboardShortcut.
return S_FALSE;
}
keyBinding = acc->KeyboardShortcut();
KeyBinding keyBinding = acc->AccessKey();
if (keyBinding.IsEmpty()) {
// In this case, KeyboardShortcut will be exposed via MSAA
// accKeyboardShortcut.
return S_FALSE;
}
// MSAA accKeyboardShortcut will expose AccessKey.
keyBinding = localAcc->KeyboardShortcut();
if (keyBinding.IsEmpty()) return S_FALSE;
nsAutoString keyStr;

View File

@ -14,7 +14,6 @@
namespace mozilla {
namespace a11y {
class AccessibleWrap;
class ia2AccessibleAction : public IAccessibleAction {
public:
@ -47,7 +46,6 @@ class ia2AccessibleAction : public IAccessibleAction {
/* [retval][out] */ BSTR* localizedName);
private:
AccessibleWrap* LocalAcc();
Accessible* Acc();
};