diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index 10e8a743da04..3f4f42354c8e 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -9,12 +9,14 @@ #include "Compatibility.h" #include "DocAccessible-inl.h" +#include "mozilla/a11y/DocAccessibleParent.h" #include "EnumVariant.h" #include "nsAccUtils.h" #include "nsCoreUtils.h" #include "nsIAccessibleEvent.h" #include "nsWinUtils.h" #include "mozilla/a11y/ProxyAccessible.h" +#include "ProxyWrappers.h" #include "ServiceProvider.h" #include "Relation.h" #include "Role.h" @@ -1274,6 +1276,22 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent) return NS_OK; } +DocProxyAccessibleWrap* +AccessibleWrap::DocProxyWrapper() const +{ + MOZ_ASSERT(IsProxy()); + + ProxyAccessible* proxy = Proxy(); + if (!proxy) { + return nullptr; + } + + AccessibleWrap* acc = WrapperFor(proxy->Document()); + MOZ_ASSERT(acc->IsDoc()); + + return static_cast(acc); +} + //////////////////////////////////////////////////////////////////////////////// // AccessibleWrap diff --git a/accessible/windows/msaa/AccessibleWrap.h b/accessible/windows/msaa/AccessibleWrap.h index 05ce578910a3..6a1ab3abdcab 100644 --- a/accessible/windows/msaa/AccessibleWrap.h +++ b/accessible/windows/msaa/AccessibleWrap.h @@ -26,6 +26,7 @@ namespace mozilla { namespace a11y { +class DocProxyAccessibleWrap; class AccessibleWrap : public Accessible, public ia2Accessible, @@ -183,6 +184,11 @@ protected: uint32_t mID; #endif + /** + * Return the wrapper for the document's proxy. + */ + DocProxyAccessibleWrap* DocProxyWrapper() const; + /** * Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it. */