зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1694865 part 17: Add various functions to get an MsaaAccessible/MsaaDocAccessible and use them where appropriate. r=morgan
In this patch, these new functions just static_cast, but they'll soon be returning a different object. Differential Revision: https://phabricator.services.mozilla.com/D112952
This commit is contained in:
Родитель
19e006d017
Коммит
98c0f0589f
|
@ -140,7 +140,7 @@ uint32_t DocAccessibleParent::AddSubtree(
|
|||
ProxyCreated(newProxy);
|
||||
|
||||
#if defined(XP_WIN)
|
||||
WrapperFor(newProxy)->SetID(newChild.MsaaID());
|
||||
WrapperFor(newProxy)->GetMsaa()->SetID(newChild.MsaaID());
|
||||
#endif
|
||||
|
||||
for (uint32_t index = 0, len = mPendingChildDocs.Length(); index < len;
|
||||
|
|
|
@ -34,15 +34,16 @@ bool RemoteAccessible::GetCOMInterface(void** aOutAccessible) const {
|
|||
if (!mCOMProxy && mSafeToRecurse) {
|
||||
// See if we can lazily obtain a COM proxy
|
||||
AccessibleWrap* wrap = WrapperFor(this);
|
||||
MsaaAccessible* msaa = wrap->GetMsaa();
|
||||
bool isDefunct = false;
|
||||
RemoteAccessible* thisPtr = const_cast<RemoteAccessible*>(this);
|
||||
// NB: Don't pass CHILDID_SELF here, use the absolute MSAA ID. Otherwise
|
||||
// GetIAccessibleFor will recurse into this function and we will just
|
||||
// overflow the stack.
|
||||
VARIANT realId = {{{VT_I4}}};
|
||||
realId.ulVal = wrap->GetExistingID();
|
||||
realId.ulVal = msaa->GetExistingID();
|
||||
MOZ_DIAGNOSTIC_ASSERT(realId.ulVal != CHILDID_SELF);
|
||||
thisPtr->mCOMProxy = wrap->GetIAccessibleFor(realId, &isDefunct);
|
||||
thisPtr->mCOMProxy = msaa->GetIAccessibleFor(realId, &isDefunct);
|
||||
}
|
||||
|
||||
RefPtr<IAccessible> addRefed = mCOMProxy;
|
||||
|
|
|
@ -65,6 +65,7 @@ class AccessibleWrap : public LocalAccessible, public MsaaAccessible {
|
|||
*/
|
||||
bool IsRootForHWND();
|
||||
|
||||
MsaaAccessible* GetMsaa() { return this; }
|
||||
virtual void GetNativeInterface(void** aOutAccessible) override;
|
||||
|
||||
static void SetHandlerControl(DWORD aPid, RefPtr<IHandlerControl> aCtrl);
|
||||
|
|
|
@ -40,7 +40,8 @@ void MsaaAccessible::MsaaShutdown() {
|
|||
// marked defunct. It's safe for us to call LocalAccessible::Document() here
|
||||
// regardless.
|
||||
auto localAcc = static_cast<AccessibleWrap*>(this);
|
||||
auto doc = static_cast<DocAccessibleWrap*>(localAcc->Document());
|
||||
DocAccessible* docAcc = localAcc->Document();
|
||||
auto doc = docAcc ? MsaaDocAccessible::GetFrom(docAcc) : nullptr;
|
||||
// Accessibles can be shut down twice in some cases. When this happens,
|
||||
// doc will be null.
|
||||
if (doc) {
|
||||
|
@ -88,21 +89,20 @@ int32_t MsaaAccessible::GetChildIDFor(LocalAccessible* aAccessible) {
|
|||
|
||||
// Chrome should use mID which has been generated by the content process.
|
||||
if (aAccessible->IsProxy()) {
|
||||
const uint32_t id = static_cast<AccessibleWrap*>(aAccessible)->mID;
|
||||
const uint32_t id = MsaaAccessible::GetFrom(aAccessible)->mID;
|
||||
MOZ_ASSERT(id != kNoID);
|
||||
return id;
|
||||
}
|
||||
|
||||
if (!aAccessible->Document()) return 0;
|
||||
|
||||
uint32_t* id = &static_cast<AccessibleWrap*>(aAccessible)->mID;
|
||||
uint32_t* id = &MsaaAccessible::GetFrom(aAccessible)->mID;
|
||||
if (*id != kNoID) return *id;
|
||||
|
||||
*id = sIDGen.GetID();
|
||||
|
||||
MOZ_ASSERT(!aAccessible->IsProxy());
|
||||
DocAccessibleWrap* doc =
|
||||
static_cast<DocAccessibleWrap*>(aAccessible->Document());
|
||||
auto doc = MsaaDocAccessible::GetFrom(aAccessible->Document());
|
||||
doc->AddID(*id, static_cast<AccessibleWrap*>(aAccessible));
|
||||
|
||||
return *id;
|
||||
|
@ -314,7 +314,7 @@ MsaaAccessible::ResolveChild(const VARIANT& aVarChild,
|
|||
static LocalAccessible* GetAccessibleInSubtree(DocAccessible* aDoc,
|
||||
uint32_t aID) {
|
||||
LocalAccessible* child =
|
||||
static_cast<DocAccessibleWrap*>(aDoc)->GetAccessibleByID(aID);
|
||||
MsaaDocAccessible::GetFrom(aDoc)->GetAccessibleByID(aID);
|
||||
if (child) return child;
|
||||
|
||||
uint32_t childDocCount = aDoc->ChildDocumentCount();
|
||||
|
@ -558,7 +558,8 @@ already_AddRefed<IAccessible> MsaaAccessible::GetRemoteIAccessibleFor(
|
|||
RefPtr<IDispatch> disp;
|
||||
auto checkDoc = [&aVarChild,
|
||||
&disp](DocAccessibleParent* aRemoteDoc) -> bool {
|
||||
uint32_t remoteDocMsaaId = WrapperFor(aRemoteDoc)->GetExistingID();
|
||||
uint32_t remoteDocMsaaId =
|
||||
WrapperFor(aRemoteDoc)->GetMsaa()->GetExistingID();
|
||||
if (!sIDGen.IsSameContentProcessFor(aVarChild.lVal, remoteDocMsaaId)) {
|
||||
return true; // Continue the search.
|
||||
}
|
||||
|
@ -618,6 +619,13 @@ ITypeInfo* MsaaAccessible::GetTI(LCID lcid) {
|
|||
return gTypeInfo;
|
||||
}
|
||||
|
||||
/* static */
|
||||
MsaaAccessible* MsaaAccessible::GetFrom(Accessible* aAcc) {
|
||||
// We don't support RemoteAccessible yet.
|
||||
MOZ_ASSERT(aAcc->IsLocal());
|
||||
return static_cast<AccessibleWrap*>(aAcc)->GetMsaa();
|
||||
}
|
||||
|
||||
// IUnknown methods
|
||||
// XXX This delegation to AccessibleWrap is a necessary hack until we can move
|
||||
// the IUnknown implementation out of AccessibleWrap.
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
class Accessible;
|
||||
class AccessibleWrap;
|
||||
class LocalAccessible;
|
||||
class sdnAccessible;
|
||||
|
@ -66,6 +67,8 @@ class MsaaAccessible : public ia2Accessible,
|
|||
|
||||
static IDispatch* NativeAccessible(LocalAccessible* aAccessible);
|
||||
|
||||
static MsaaAccessible* GetFrom(Accessible* aAcc);
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**) override;
|
||||
ULONG STDMETHODCALLTYPE AddRef() override;
|
||||
|
|
|
@ -21,6 +21,11 @@ DocAccessible* MsaaDocAccessible::DocAcc() {
|
|||
return static_cast<DocAccessible*>(acc);
|
||||
}
|
||||
|
||||
/* static */
|
||||
MsaaDocAccessible* MsaaDocAccessible::GetFrom(DocAccessible* aDoc) {
|
||||
return static_cast<MsaaDocAccessible*>(MsaaAccessible::GetFrom(aDoc));
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
MsaaDocAccessible::get_accParent(
|
||||
/* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispParent) {
|
||||
|
|
|
@ -56,6 +56,8 @@ class MsaaDocAccessible : public DocAccessible {
|
|||
return mIDToAccessibleMap.Get(aID);
|
||||
}
|
||||
|
||||
static MsaaDocAccessible* GetFrom(DocAccessible* aDoc);
|
||||
|
||||
protected:
|
||||
/*
|
||||
* This provides a mapping from 32 bit id to accessible objects.
|
||||
|
|
|
@ -1198,7 +1198,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
|
|||
|
||||
# ifdef XP_WIN
|
||||
MOZ_ASSERT(aDocCOMProxy.IsNull());
|
||||
a11y::WrapperFor(doc)->SetID(aMsaaID);
|
||||
a11y::WrapperFor(doc)->GetMsaa()->SetID(aMsaaID);
|
||||
if (a11y::nsWinUtils::IsWindowEmulationStarted()) {
|
||||
doc->SetEmulatedWindowHandle(parentDoc->GetEmulatedWindowHandle());
|
||||
}
|
||||
|
@ -1225,7 +1225,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
|
|||
// before that.
|
||||
a11y::AccessibleWrap* wrapper = a11y::WrapperFor(doc);
|
||||
MOZ_ASSERT(wrapper);
|
||||
wrapper->SetID(aMsaaID);
|
||||
wrapper->GetMsaa()->SetID(aMsaaID);
|
||||
# endif
|
||||
a11y::DocAccessibleParent* embedderDoc;
|
||||
uint64_t embedderID;
|
||||
|
@ -1259,7 +1259,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
|
|||
doc->SetTopLevel();
|
||||
a11y::DocManager::RemoteDocAdded(doc);
|
||||
# ifdef XP_WIN
|
||||
a11y::WrapperFor(doc)->SetID(aMsaaID);
|
||||
a11y::WrapperFor(doc)->GetMsaa()->SetID(aMsaaID);
|
||||
MOZ_ASSERT(!aDocCOMProxy.IsNull());
|
||||
|
||||
RefPtr<IAccessible> proxy(aDocCOMProxy.Get());
|
||||
|
|
Загрузка…
Ссылка в новой задаче