From 35330203691bb769cc4751a0d62b8b5016f56aec Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 22 Jan 2016 05:52:53 -0500 Subject: [PATCH] bug 1243077 - add ToXPC{,Document} overloads for proxied accessibles r=davidb --- accessible/xpcom/xpcAccessibleDocument.cpp | 16 ++++++++++++++++ accessible/xpcom/xpcAccessibleDocument.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/accessible/xpcom/xpcAccessibleDocument.cpp b/accessible/xpcom/xpcAccessibleDocument.cpp index d8da3ac1e5a..601cf06fd4f 100644 --- a/accessible/xpcom/xpcAccessibleDocument.cpp +++ b/accessible/xpcom/xpcAccessibleDocument.cpp @@ -13,6 +13,7 @@ #include "DocAccessible-inl.h" #include "nsIDOMDocument.h" +using namespace mozilla; using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// @@ -227,3 +228,18 @@ xpcAccessibleDocument::Shutdown() } xpcAccessibleGeneric::Shutdown(); } + +xpcAccessibleGeneric* +a11y::ToXPC(AccessibleOrProxy aAcc) +{ + if (aAcc.IsNull()) { + return nullptr; + } + + if (aAcc.IsAccessible()) { + return ToXPC(aAcc.AsAccessible()); + } + + xpcAccessibleDocument* doc = ToXPCDocument(aAcc.AsProxy()->Document()); + return doc->GetXPCAccessible(aAcc.AsProxy()); +} diff --git a/accessible/xpcom/xpcAccessibleDocument.h b/accessible/xpcom/xpcAccessibleDocument.h index 5b55e5dbe46..5d21683e6ad 100644 --- a/accessible/xpcom/xpcAccessibleDocument.h +++ b/accessible/xpcom/xpcAccessibleDocument.h @@ -118,6 +118,8 @@ ToXPC(Accessible* aAccessible) return xpcDoc ? xpcDoc->GetAccessible(aAccessible) : nullptr; } +xpcAccessibleGeneric* ToXPC(AccessibleOrProxy aAcc); + inline xpcAccessibleHyperText* ToXPCText(HyperTextAccessible* aAccessible) { @@ -135,6 +137,12 @@ ToXPCDocument(DocAccessible* aAccessible) return GetAccService()->GetXPCDocument(aAccessible); } +inline xpcAccessibleDocument* +ToXPCDocument(DocAccessibleParent* aAccessible) +{ + return GetAccService()->GetXPCDocument(aAccessible); +} + } // namespace a11y } // namespace mozilla