Backed out changeset 06f41c22f3a6 (bug 1888460) for causing linux xpcshell failures...
[gecko.git] / accessible / xpcom / xpcAccessibleGeneric.cpp
blobaaef5ac14c3a322d3ed72f8fcc8d16d71026555b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "xpcAccessibleGeneric.h"
9 #include "xpcAccessibleDocument.h"
11 using namespace mozilla::a11y;
13 ////////////////////////////////////////////////////////////////////////////////
14 // nsISupports
16 NS_INTERFACE_MAP_BEGIN(xpcAccessibleGeneric)
17 NS_INTERFACE_MAP_ENTRY(nsIAccessible)
18 NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleSelectable,
19 mSupportedIfaces & eSelectable)
20 NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleValue,
21 mSupportedIfaces & eValue)
22 NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleHyperLink,
23 mSupportedIfaces & eHyperLink)
24 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessible)
25 NS_INTERFACE_MAP_END
27 NS_IMPL_ADDREF(xpcAccessibleGeneric)
28 NS_IMPL_RELEASE(xpcAccessibleGeneric)
30 xpcAccessibleGeneric::~xpcAccessibleGeneric() {
31 if (!mIntl) {
32 return;
35 xpcAccessibleDocument* xpcDoc = nullptr;
36 if (mIntl->IsLocal()) {
37 LocalAccessible* acc = mIntl->AsLocal();
38 if (!acc->IsDoc() && !acc->IsApplication()) {
39 xpcDoc = GetAccService()->GetXPCDocument(acc->Document());
40 xpcDoc->NotifyOfShutdown(acc);
42 } else {
43 RemoteAccessible* proxy = mIntl->AsRemote();
44 if (!proxy->IsDoc()) {
45 xpcDoc = GetAccService()->GetXPCDocument(proxy->Document());
46 xpcDoc->NotifyOfShutdown(proxy);
51 ////////////////////////////////////////////////////////////////////////////////
52 // nsIAccessible
54 LocalAccessible* xpcAccessibleGeneric::ToInternalAccessible() {
55 return mIntl->AsLocal();
58 ////////////////////////////////////////////////////////////////////////////////
59 // xpcAccessibleGeneric
61 void xpcAccessibleGeneric::Shutdown() { mIntl = nullptr; }