mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 18:50:08 +00:00
Bug 1742902: Return the MsaaAccessible when using window emulation with the cache enabled. r=morgan
Previously, we tried to get a COM proxy even when the cache was enabled, which just crashed. As part of this, use a RefPtr instead of manually managing references. Differential Revision: https://phabricator.services.mozilla.com/D132104
This commit is contained in:
parent
e02052c2cc
commit
f9fa2783ad
@ -14,6 +14,7 @@
|
||||
|
||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_accessibility.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
@ -135,25 +136,26 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
// for details).
|
||||
int32_t objId = static_cast<DWORD>(lParam);
|
||||
if (objId == OBJID_CLIENT) {
|
||||
IAccessible* msaaAccessible = nullptr;
|
||||
RefPtr<IAccessible> msaaAccessible;
|
||||
DocAccessible* document =
|
||||
reinterpret_cast<DocAccessible*>(::GetPropW(hWnd, kPropNameDocAcc));
|
||||
if (document) {
|
||||
document->GetNativeInterface(
|
||||
(void**)&msaaAccessible); // does an addref
|
||||
document->GetNativeInterface(getter_AddRefs(msaaAccessible));
|
||||
} else {
|
||||
DocAccessibleParent* docParent = static_cast<DocAccessibleParent*>(
|
||||
::GetPropW(hWnd, kPropNameDocAccParent));
|
||||
if (docParent) {
|
||||
docParent->GetCOMInterface(
|
||||
(void**)&msaaAccessible); // does an addref
|
||||
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
|
||||
msaaAccessible = MsaaAccessible::GetFrom(docParent);
|
||||
} else {
|
||||
docParent->GetCOMInterface(getter_AddRefs(msaaAccessible));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (msaaAccessible) {
|
||||
LRESULT result =
|
||||
::LresultFromObject(IID_IAccessible, wParam,
|
||||
msaaAccessible); // does an addref
|
||||
msaaAccessible->Release(); // release extra addref
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user