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