From c33d1b08378673e6bb0a05388b777a94df67fdd0 Mon Sep 17 00:00:00 2001 From: James Teh Date: Mon, 3 May 2021 11:31:04 +0000 Subject: [PATCH] Bug 1694865 part 25: Remove inheritance of Msaa*Accessible/ia2*Accessible into *AccessibleWrap! r=morgan 1. ia2AccessibleApplication is instantiated for ApplicationAccessible, so it now inherits from MsaaAccessible. 2. ia2AccessibleHypertext is instantiated for HyperTextAccessible, so it now inherits from MsaaAccessible. 3. ia2AccessibleImage is instantiated for ImageAccessible, so it inherits from MsaaAccessible. 4. ia2AccessibleTable is instantiated for TableAccessible, so it inherits from ia2AccessibleHypertext (since most TableAccessible implementations implement HyperTextAccessible). 5. ia2AccessibleTableCell is instantiated for TableCellAccessible, so it inherits from ia2AccessibleHypertext (since most TableCellAccessible implementations implement HyperTextAccessible). 6. All of the above override QueryInterface as appropriate, replacing the QueryInterface implementations from all *AccessibleWrap classes. 7. The ARIAGridAccessibleWrap, HTMLTableAccessibleWrap, ImageAccessibleWrap, XULListboxAccessibleWrap and XULTreeGridAccessibleWrap classes previously served only to host ia2AccessibleImage, ia2AccessibleTable, etc. Since these ia2 classes are now instantiated via MsaaAccessible, these Wrap classes have been removed and replaced with aliases. 8. The QueryInterface handling for ISimpleDOMText has been moved into MsaaAccessible. Since this was the only purpose of TextLeafAccessibleWrap, this too has been removed and replaced with an alias. 9. AccessibleWrap now holds a strong reference to MsaaAccessible and MsaaAccessible holds a weak reference to AccessibleWrap. 10. An MsaaAccessible (or derived class) is instantiated by MsaaAccessible::Create. 11. MsaaAccessible now implements its own COM reference counting using DECL_IUNKNOWN, since it does not need nsISupports (XPCOM). Differential Revision: https://phabricator.services.mozilla.com/D112956 --- accessible/windows/ProxyWrappers.h | 7 ++ .../windows/ia2/ia2AccessibleApplication.cpp | 23 +--- .../windows/ia2/ia2AccessibleApplication.h | 11 +- .../windows/ia2/ia2AccessibleEditableText.cpp | 7 +- .../windows/ia2/ia2AccessibleHypertext.cpp | 33 +++++- .../windows/ia2/ia2AccessibleHypertext.h | 20 +++- accessible/windows/ia2/ia2AccessibleImage.cpp | 23 +--- accessible/windows/ia2/ia2AccessibleImage.h | 10 +- accessible/windows/ia2/ia2AccessibleTable.cpp | 7 +- accessible/windows/ia2/ia2AccessibleTable.h | 15 ++- .../windows/ia2/ia2AccessibleTableCell.cpp | 23 ++-- .../windows/ia2/ia2AccessibleTableCell.h | 14 +-- accessible/windows/ia2/ia2AccessibleText.cpp | 7 +- accessible/windows/ia2/ia2AccessibleText.h | 6 + .../windows/msaa/ARIAGridAccessibleWrap.cpp | 39 ------- .../windows/msaa/ARIAGridAccessibleWrap.h | 51 +-------- accessible/windows/msaa/AccessibleWrap.cpp | 18 ++- accessible/windows/msaa/AccessibleWrap.h | 6 +- .../msaa/ApplicationAccessibleWrap.cpp | 5 - .../windows/msaa/ApplicationAccessibleWrap.h | 9 +- accessible/windows/msaa/DocAccessibleWrap.cpp | 11 +- accessible/windows/msaa/DocAccessibleWrap.h | 6 +- .../windows/msaa/HTMLTableAccessibleWrap.cpp | 54 --------- .../windows/msaa/HTMLTableAccessibleWrap.h | 71 +----------- .../windows/msaa/HyperTextAccessibleWrap.cpp | 26 ----- .../windows/msaa/HyperTextAccessibleWrap.h | 17 +-- .../windows/msaa/ImageAccessibleWrap.cpp | 16 --- accessible/windows/msaa/ImageAccessibleWrap.h | 18 +-- accessible/windows/msaa/MsaaAccessible.cpp | 103 ++++++++++++++---- accessible/windows/msaa/MsaaAccessible.h | 11 +- accessible/windows/msaa/MsaaDocAccessible.cpp | 16 ++- accessible/windows/msaa/MsaaDocAccessible.h | 22 ++-- .../windows/msaa/MsaaRootAccessible.cpp | 14 +-- accessible/windows/msaa/MsaaRootAccessible.h | 13 +-- .../windows/msaa/MsaaXULMenuAccessible.h | 12 +- .../windows/msaa/RootAccessibleWrap.cpp | 2 +- accessible/windows/msaa/RootAccessibleWrap.h | 4 +- accessible/windows/msaa/ServiceProvider.cpp | 1 + .../windows/msaa/TextLeafAccessibleWrap.cpp | 21 ---- .../windows/msaa/TextLeafAccessibleWrap.h | 16 +-- .../windows/msaa/XULListboxAccessibleWrap.cpp | 27 ----- .../windows/msaa/XULListboxAccessibleWrap.h | 23 +--- .../windows/msaa/XULMenuAccessibleWrap.cpp | 3 +- .../windows/msaa/XULMenuAccessibleWrap.h | 4 +- .../msaa/XULTreeGridAccessibleWrap.cpp | 37 ------- .../windows/msaa/XULTreeGridAccessibleWrap.h | 56 +--------- accessible/windows/msaa/moz.build | 6 - 47 files changed, 283 insertions(+), 661 deletions(-) delete mode 100644 accessible/windows/msaa/ARIAGridAccessibleWrap.cpp delete mode 100644 accessible/windows/msaa/HTMLTableAccessibleWrap.cpp delete mode 100644 accessible/windows/msaa/ImageAccessibleWrap.cpp delete mode 100644 accessible/windows/msaa/TextLeafAccessibleWrap.cpp delete mode 100644 accessible/windows/msaa/XULListboxAccessibleWrap.cpp delete mode 100644 accessible/windows/msaa/XULTreeGridAccessibleWrap.cpp diff --git a/accessible/windows/ProxyWrappers.h b/accessible/windows/ProxyWrappers.h index f93b15378250..02133d89878b 100644 --- a/accessible/windows/ProxyWrappers.h +++ b/accessible/windows/ProxyWrappers.h @@ -22,6 +22,9 @@ class RemoteAccessibleWrap : public AccessibleWrap { } virtual void Shutdown() override { + if (mMsaa) { + mMsaa->MsaaShutdown(); + } mBits.proxy = nullptr; mStateFlags |= eIsDefunct; } @@ -40,6 +43,9 @@ class HyperTextRemoteAccessibleWrap : public HyperTextAccessibleWrap { } virtual void Shutdown() override { + if (mMsaa) { + mMsaa->MsaaShutdown(); + } mBits.proxy = nullptr; mStateFlags |= eIsDefunct; } @@ -104,6 +110,7 @@ class RemoteIframeDocRemoteAccessibleWrap : public HyperTextAccessibleWrap { } virtual void Shutdown() override { + MOZ_ASSERT(!mMsaa); mStateFlags |= eIsDefunct; mCOMProxy = nullptr; } diff --git a/accessible/windows/ia2/ia2AccessibleApplication.cpp b/accessible/windows/ia2/ia2AccessibleApplication.cpp index d4037f19f4c3..7844e970748a 100644 --- a/accessible/windows/ia2/ia2AccessibleApplication.cpp +++ b/accessible/windows/ia2/ia2AccessibleApplication.cpp @@ -14,30 +14,15 @@ using namespace mozilla; using namespace mozilla::a11y; ApplicationAccessible* ia2AccessibleApplication::AppAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of ApplicationAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); - return static_cast(acc); + return static_cast(LocalAcc()); } //////////////////////////////////////////////////////////////////////////////// // IUnknown -STDMETHODIMP -ia2AccessibleApplication::QueryInterface(REFIID iid, void** ppv) { - if (!ppv) return E_INVALIDARG; - - *ppv = nullptr; - - if (IID_IAccessibleApplication == iid) { - *ppv = static_cast(this); - (reinterpret_cast(*ppv))->AddRef(); - return S_OK; - } - - return E_NOINTERFACE; -} +IMPL_IUNKNOWN_QUERY_HEAD(ia2AccessibleApplication) +IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleApplication) +IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(MsaaAccessible) //////////////////////////////////////////////////////////////////////////////// // IAccessibleApplication diff --git a/accessible/windows/ia2/ia2AccessibleApplication.h b/accessible/windows/ia2/ia2AccessibleApplication.h index 288b2512025d..283dc38471b7 100644 --- a/accessible/windows/ia2/ia2AccessibleApplication.h +++ b/accessible/windows/ia2/ia2AccessibleApplication.h @@ -9,15 +9,19 @@ #define IA2_ACCESSIBLE_APPLICATION_H_ #include "AccessibleApplication.h" +#include "IUnknownImpl.h" +#include "MsaaAccessible.h" namespace mozilla { namespace a11y { class ApplicationAccessible; -class ia2AccessibleApplication : public IAccessibleApplication { +class ia2AccessibleApplication : public IAccessibleApplication, + public MsaaAccessible { public: // IUnknown - STDMETHODIMP QueryInterface(REFIID, void**); + DECL_IUNKNOWN_INHERITED + IMPL_IUNKNOWN_REFCOUNTING_INHERITED(MsaaAccessible) // IAccessibleApplication virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_appName( @@ -32,6 +36,9 @@ class ia2AccessibleApplication : public IAccessibleApplication { virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_toolkitVersion( /* [retval][out] */ BSTR* version); + protected: + using MsaaAccessible::MsaaAccessible; + private: ApplicationAccessible* AppAcc(); }; diff --git a/accessible/windows/ia2/ia2AccessibleEditableText.cpp b/accessible/windows/ia2/ia2AccessibleEditableText.cpp index 554462c701f6..69d11a1c11c0 100644 --- a/accessible/windows/ia2/ia2AccessibleEditableText.cpp +++ b/accessible/windows/ia2/ia2AccessibleEditableText.cpp @@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ia2AccessibleEditableText.h" +#include "ia2AccessibleHypertext.h" #include "AccessibleEditableText_i.c" #include "HyperTextAccessible-inl.h" @@ -18,10 +19,8 @@ using namespace mozilla::a11y; HyperTextAccessibleWrap* ia2AccessibleEditableText::TextAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of HyperTextAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); + auto hyp = static_cast(this); + AccessibleWrap* acc = static_cast(hyp)->LocalAcc(); return static_cast(acc); } diff --git a/accessible/windows/ia2/ia2AccessibleHypertext.cpp b/accessible/windows/ia2/ia2AccessibleHypertext.cpp index 34f0a7bae88d..6ea80f4ecf26 100644 --- a/accessible/windows/ia2/ia2AccessibleHypertext.cpp +++ b/accessible/windows/ia2/ia2AccessibleHypertext.cpp @@ -15,13 +15,38 @@ using namespace mozilla::a11y; HyperTextAccessibleWrap* ia2AccessibleHypertext::TextAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of HyperTextAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); + AccessibleWrap* acc = LocalAcc(); return static_cast(acc); } +// IUnknown +STDMETHODIMP +ia2AccessibleHypertext::QueryInterface(REFIID aIID, void** aInstancePtr) { + if (!aInstancePtr) return E_FAIL; + + *aInstancePtr = nullptr; + + HyperTextAccessibleWrap* hyp = TextAcc(); + if (hyp && hyp->IsTextRole()) { + if (aIID == IID_IAccessibleText) + *aInstancePtr = + static_cast(static_cast(this)); + else if (aIID == IID_IAccessibleHypertext) + *aInstancePtr = static_cast(this); + else if (aIID == IID_IAccessibleHypertext2) + *aInstancePtr = static_cast(this); + else if (aIID == IID_IAccessibleEditableText) + *aInstancePtr = static_cast(this); + + if (*aInstancePtr) { + AddRef(); + return S_OK; + } + } + + return MsaaAccessible::QueryInterface(aIID, aInstancePtr); +} + // IAccessibleHypertext STDMETHODIMP diff --git a/accessible/windows/ia2/ia2AccessibleHypertext.h b/accessible/windows/ia2/ia2AccessibleHypertext.h index 0d4dae3f2b99..59f44ddf6744 100644 --- a/accessible/windows/ia2/ia2AccessibleHypertext.h +++ b/accessible/windows/ia2/ia2AccessibleHypertext.h @@ -10,16 +10,31 @@ #include "nsISupports.h" +#include "ia2AccessibleEditableText.h" #include "ia2AccessibleText.h" #include "AccessibleHypertext2.h" +#include "IUnknownImpl.h" +#include "MsaaAccessible.h" namespace mozilla { namespace a11y { class HyperTextAccessibleWrap; class ia2AccessibleHypertext : public ia2AccessibleText, - public IAccessibleHypertext2 { + public IAccessibleHypertext2, + public ia2AccessibleEditableText, + public MsaaAccessible { public: + // IUnknown + DECL_IUNKNOWN_INHERITED + IMPL_IUNKNOWN_REFCOUNTING_INHERITED(MsaaAccessible) + + // IAccessible2 + // We indirectly inherit IAccessible2, which has a get_attributes method, + // but IAccessibleText also has a get_attributes method with a different + // signature. We want both. + using MsaaAccessible::get_attributes; + // IAccessibleText FORWARD_IACCESSIBLETEXT(ia2AccessibleText) @@ -40,6 +55,9 @@ class ia2AccessibleHypertext : public ia2AccessibleText, /* [out, size_is(,*nHyperlinks)] */ IAccessibleHyperlink*** hyperlinks, /* [out, retval] */ long* nHyperlinks); + protected: + using MsaaAccessible::MsaaAccessible; + private: HyperTextAccessibleWrap* TextAcc(); }; diff --git a/accessible/windows/ia2/ia2AccessibleImage.cpp b/accessible/windows/ia2/ia2AccessibleImage.cpp index 9d363fff4b43..246fa5b55770 100644 --- a/accessible/windows/ia2/ia2AccessibleImage.cpp +++ b/accessible/windows/ia2/ia2AccessibleImage.cpp @@ -19,29 +19,14 @@ using namespace mozilla; using namespace mozilla::a11y; ImageAccessible* ia2AccessibleImage::ImageAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of ImageAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); + AccessibleWrap* acc = static_cast(this)->LocalAcc(); return static_cast(acc); } // IUnknown - -STDMETHODIMP -ia2AccessibleImage::QueryInterface(REFIID iid, void** ppv) { - if (!ppv) return E_INVALIDARG; - - *ppv = nullptr; - - if (IID_IAccessibleImage == iid) { - *ppv = static_cast(this); - (static_cast(*ppv))->AddRef(); - return S_OK; - } - - return E_NOINTERFACE; -} +IMPL_IUNKNOWN_QUERY_HEAD(ia2AccessibleImage) +IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleImage) +IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(MsaaAccessible) // IAccessibleImage diff --git a/accessible/windows/ia2/ia2AccessibleImage.h b/accessible/windows/ia2/ia2AccessibleImage.h index 4741f9371fd1..c39da51e5735 100644 --- a/accessible/windows/ia2/ia2AccessibleImage.h +++ b/accessible/windows/ia2/ia2AccessibleImage.h @@ -9,15 +9,18 @@ #define _ACCESSIBLE_IMAGE_H #include "AccessibleImage.h" +#include "IUnknownImpl.h" +#include "MsaaAccessible.h" namespace mozilla { namespace a11y { class ImageAccessible; -class ia2AccessibleImage : public IAccessibleImage { +class ia2AccessibleImage : public IAccessibleImage, public MsaaAccessible { public: // IUnknown - STDMETHODIMP QueryInterface(REFIID, void**); + DECL_IUNKNOWN_INHERITED + IMPL_IUNKNOWN_REFCOUNTING_INHERITED(MsaaAccessible) // IAccessibleImage virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_description( @@ -32,6 +35,9 @@ class ia2AccessibleImage : public IAccessibleImage { /* [out] */ long* height, /* [retval][out] */ long* width); + protected: + using MsaaAccessible::MsaaAccessible; + private: ImageAccessible* ImageAcc(); }; diff --git a/accessible/windows/ia2/ia2AccessibleTable.cpp b/accessible/windows/ia2/ia2AccessibleTable.cpp index c4c67c9d8f33..6616534d91f2 100644 --- a/accessible/windows/ia2/ia2AccessibleTable.cpp +++ b/accessible/windows/ia2/ia2AccessibleTable.cpp @@ -21,6 +21,11 @@ using namespace mozilla::a11y; +TableAccessible* ia2AccessibleTable::TableAcc() { + AccessibleWrap* acc = LocalAcc(); + return acc ? acc->AsTable() : nullptr; +} + // IUnknown STDMETHODIMP @@ -42,7 +47,7 @@ ia2AccessibleTable::QueryInterface(REFIID iid, void** ppv) { return S_OK; } - return E_NOINTERFACE; + return ia2AccessibleHypertext::QueryInterface(iid, ppv); } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/windows/ia2/ia2AccessibleTable.h b/accessible/windows/ia2/ia2AccessibleTable.h index 7438a61cdba6..622187c3790b 100644 --- a/accessible/windows/ia2/ia2AccessibleTable.h +++ b/accessible/windows/ia2/ia2AccessibleTable.h @@ -10,16 +10,21 @@ #include "AccessibleTable.h" #include "AccessibleTable2.h" +#include "ia2AccessibleHypertext.h" +#include "IUnknownImpl.h" namespace mozilla { namespace a11y { class TableAccessible; -class ia2AccessibleTable : public IAccessibleTable, public IAccessibleTable2 { +class ia2AccessibleTable : public IAccessibleTable, + public IAccessibleTable2, + public ia2AccessibleHypertext { public: // IUnknown - STDMETHODIMP QueryInterface(REFIID, void**); + DECL_IUNKNOWN_INHERITED + IMPL_IUNKNOWN_REFCOUNTING_INHERITED(ia2AccessibleHypertext) // IAccessibleTable virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_accessibleAt( @@ -161,12 +166,10 @@ class ia2AccessibleTable : public IAccessibleTable, public IAccessibleTable2 { /* [out, retval] */ long* nRows); protected: - ia2AccessibleTable(TableAccessible* aTable) : mTable(aTable) {} - - TableAccessible* mTable; + using ia2AccessibleHypertext::ia2AccessibleHypertext; private: - TableAccessible* TableAcc() { return mTable; } + TableAccessible* TableAcc(); }; } // namespace a11y diff --git a/accessible/windows/ia2/ia2AccessibleTableCell.cpp b/accessible/windows/ia2/ia2AccessibleTableCell.cpp index 05523672d9de..14a9a93e6929 100644 --- a/accessible/windows/ia2/ia2AccessibleTableCell.cpp +++ b/accessible/windows/ia2/ia2AccessibleTableCell.cpp @@ -20,23 +20,16 @@ using namespace mozilla::a11y; -// IUnknown - -STDMETHODIMP -ia2AccessibleTableCell::QueryInterface(REFIID iid, void** ppv) { - if (!ppv) return E_INVALIDARG; - - *ppv = nullptr; - - if (IID_IAccessibleTableCell == iid) { - *ppv = static_cast(this); - (reinterpret_cast(*ppv))->AddRef(); - return S_OK; - } - - return E_NOINTERFACE; +TableCellAccessible* ia2AccessibleTableCell::CellAcc() { + AccessibleWrap* acc = LocalAcc(); + return acc ? acc->AsTableCell() : nullptr; } +// IUnknown +IMPL_IUNKNOWN_QUERY_HEAD(ia2AccessibleTableCell) +IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleTableCell) +IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(MsaaAccessible) + //////////////////////////////////////////////////////////////////////////////// // IAccessibleTableCell diff --git a/accessible/windows/ia2/ia2AccessibleTableCell.h b/accessible/windows/ia2/ia2AccessibleTableCell.h index 355f9c135b42..c9b8ae3dd4cc 100644 --- a/accessible/windows/ia2/ia2AccessibleTableCell.h +++ b/accessible/windows/ia2/ia2AccessibleTableCell.h @@ -9,15 +9,18 @@ #define _ACCESSIBLE_TABLECELL_H #include "AccessibleTableCell.h" +#include "MsaaAccessible.h" namespace mozilla { namespace a11y { class TableCellAccessible; -class ia2AccessibleTableCell : public IAccessibleTableCell { +class ia2AccessibleTableCell : public IAccessibleTableCell, + public MsaaAccessible { public: // IUnknown - STDMETHODIMP QueryInterface(REFIID, void**); + DECL_IUNKNOWN_INHERITED + IMPL_IUNKNOWN_REFCOUNTING_INHERITED(MsaaAccessible) // IAccessibleTableCell @@ -55,13 +58,10 @@ class ia2AccessibleTableCell : public IAccessibleTableCell { /* [out, retval] */ boolean* isSelected); protected: - ia2AccessibleTableCell(TableCellAccessible* aTableCell) - : mTableCell(aTableCell) {} - - TableCellAccessible* mTableCell; + using MsaaAccessible::MsaaAccessible; private: - TableCellAccessible* CellAcc() { return mTableCell; } + TableCellAccessible* CellAcc(); }; } // namespace a11y diff --git a/accessible/windows/ia2/ia2AccessibleText.cpp b/accessible/windows/ia2/ia2AccessibleText.cpp index c4c5a5a4e5d8..adc919daf5da 100644 --- a/accessible/windows/ia2/ia2AccessibleText.cpp +++ b/accessible/windows/ia2/ia2AccessibleText.cpp @@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ia2Accessible.h" +#include "ia2AccessibleHypertext.h" #include "ia2AccessibleText.h" #include "AccessibleText_i.c" @@ -24,10 +25,8 @@ uint32_t ia2AccessibleText::sLastTextChangeEnd = 0; bool ia2AccessibleText::sLastTextChangeWasInsert = false; HyperTextAccessibleWrap* ia2AccessibleText::TextAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of HyperTextAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); + auto hyp = static_cast(this); + AccessibleWrap* acc = static_cast(hyp)->LocalAcc(); return static_cast(acc); } diff --git a/accessible/windows/ia2/ia2AccessibleText.h b/accessible/windows/ia2/ia2AccessibleText.h index eb150b26606c..958880bc1a0c 100644 --- a/accessible/windows/ia2/ia2AccessibleText.h +++ b/accessible/windows/ia2/ia2AccessibleText.h @@ -9,8 +9,14 @@ #define _ACCESSIBLE_TEXT_H #include "AccessibleText.h" +#include "nsIAccessibleText.h" namespace mozilla { +template +class StaticAutoPtr; +template +class StaticRefPtr; + namespace a11y { class HyperTextAccessibleWrap; diff --git a/accessible/windows/msaa/ARIAGridAccessibleWrap.cpp b/accessible/windows/msaa/ARIAGridAccessibleWrap.cpp deleted file mode 100644 index 8b1acb9779c2..000000000000 --- a/accessible/windows/msaa/ARIAGridAccessibleWrap.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=2:tabstop=2: - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "ARIAGridAccessibleWrap.h" - -using namespace mozilla; -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// ARIAGridAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridAccessibleWrap, ARIAGridAccessible) - -IMPL_IUNKNOWN_INHERITED2(ARIAGridAccessibleWrap, MsaaAccessible, - HyperTextAccessibleWrap, ia2AccessibleTable) - -void ARIAGridAccessibleWrap::Shutdown() { - ia2AccessibleTable::mTable = nullptr; - ARIAGridAccessible::Shutdown(); -} - -//////////////////////////////////////////////////////////////////////////////// -// ARIAGridCellAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridCellAccessibleWrap, ARIAGridCellAccessible) - -IMPL_IUNKNOWN_INHERITED1(ARIAGridCellAccessibleWrap, HyperTextAccessibleWrap, - ia2AccessibleTableCell) - -void ARIAGridCellAccessibleWrap::Shutdown() { - ia2AccessibleTableCell::mTableCell = nullptr; - ARIAGridCellAccessible::Shutdown(); -} diff --git a/accessible/windows/msaa/ARIAGridAccessibleWrap.h b/accessible/windows/msaa/ARIAGridAccessibleWrap.h index cb6f17480447..27b9d46c6574 100644 --- a/accessible/windows/msaa/ARIAGridAccessibleWrap.h +++ b/accessible/windows/msaa/ARIAGridAccessibleWrap.h @@ -9,58 +9,11 @@ #define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H #include "ARIAGridAccessible.h" -#include "ia2AccessibleTable.h" -#include "ia2AccessibleTableCell.h" namespace mozilla { namespace a11y { - -/** - * IA2 wrapper class for ARIAGridAccessible implementing IAccessibleTable and - * IAccessibleTable2 interfaces. - */ -class ARIAGridAccessibleWrap : public ARIAGridAccessible, - public ia2AccessibleTable { - ~ARIAGridAccessibleWrap() {} - - public: - ARIAGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : ARIAGridAccessible(aContent, aDoc), ia2AccessibleTable(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - // Need to declare addref/release here unconditionally, because - // ia2AccessibleTable has pure-virtual refcounting. - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - -/** - * IA2 wrapper class for ARIAGridCellAccessible implementing - * IAccessibleTableCell interface. - */ -class ARIAGridCellAccessibleWrap : public ARIAGridCellAccessible, - public ia2AccessibleTableCell { - ~ARIAGridCellAccessibleWrap() {} - - public: - ARIAGridCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : ARIAGridCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - // Need to declare addref/release here unconditionally, because - // ia2AccessibleTable has pure-virtual refcounting. - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - +using ARIAGridAccessibleWrap = ARIAGridAccessible; +using ARIAGridCellAccessibleWrap = ARIAGridCellAccessible; } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index f8397853c281..e684c7cd1db4 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -39,7 +39,12 @@ AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) NS_IMPL_ISUPPORTS_INHERITED0(AccessibleWrap, LocalAccessible) void AccessibleWrap::Shutdown() { - MsaaShutdown(); + if (mMsaa) { + mMsaa->MsaaShutdown(); + // Don't release mMsaa here because this will cause its id to be released + // immediately, which will result in immediate reuse, causing problems + // for clients. Instead, we release it in the destructor. + } LocalAccessible::Shutdown(); } @@ -47,9 +52,16 @@ void AccessibleWrap::Shutdown() { // IUnknown interface methods - see iunknown.h for documentation //----------------------------------------------------- +MsaaAccessible* AccessibleWrap::GetMsaa() { + if (!mMsaa) { + mMsaa = MsaaAccessible::Create(this); + } + return mMsaa; +} + void AccessibleWrap::GetNativeInterface(void** aOutAccessible) { - *aOutAccessible = static_cast(this); - NS_ADDREF_THIS(); + RefPtr result = GetMsaa(); + return result.forget(aOutAccessible); } //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/windows/msaa/AccessibleWrap.h b/accessible/windows/msaa/AccessibleWrap.h index a0b292b93d15..81799eaaedf4 100644 --- a/accessible/windows/msaa/AccessibleWrap.h +++ b/accessible/windows/msaa/AccessibleWrap.h @@ -29,7 +29,7 @@ namespace mozilla { namespace a11y { class DocRemoteAccessibleWrap; -class AccessibleWrap : public LocalAccessible, public MsaaAccessible { +class AccessibleWrap : public LocalAccessible { public: // construction, destruction AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); @@ -63,7 +63,7 @@ class AccessibleWrap : public LocalAccessible, public MsaaAccessible { */ bool IsRootForHWND(); - MsaaAccessible* GetMsaa() { return this; } + MsaaAccessible* GetMsaa(); virtual void GetNativeInterface(void** aOutAccessible) override; static void SetHandlerControl(DWORD aPid, RefPtr aCtrl); @@ -76,6 +76,8 @@ class AccessibleWrap : public LocalAccessible, public MsaaAccessible { protected: virtual ~AccessibleWrap() = default; + RefPtr mMsaa; + struct HandlerControllerData final { HandlerControllerData(DWORD aPid, RefPtr&& aCtrl) : mPid(aPid), mCtrl(std::move(aCtrl)) { diff --git a/accessible/windows/msaa/ApplicationAccessibleWrap.cpp b/accessible/windows/msaa/ApplicationAccessibleWrap.cpp index 222c93acb956..d1f599b63107 100644 --- a/accessible/windows/msaa/ApplicationAccessibleWrap.cpp +++ b/accessible/windows/msaa/ApplicationAccessibleWrap.cpp @@ -7,8 +7,6 @@ #include "ApplicationAccessibleWrap.h" -#include "IUnknownImpl.h" - #include "nsIGfxInfo.h" #include "nsPersistentProperties.h" #include "nsServiceManagerUtils.h" @@ -21,9 +19,6 @@ using namespace mozilla::a11y; // nsISupports NS_IMPL_ISUPPORTS_INHERITED0(ApplicationAccessibleWrap, ApplicationAccessible) -IMPL_IUNKNOWN_INHERITED1(ApplicationAccessibleWrap, MsaaAccessible, - ia2AccessibleApplication) - already_AddRefed ApplicationAccessibleWrap::NativeAttributes() { RefPtr attributes = new nsPersistentProperties(); diff --git a/accessible/windows/msaa/ApplicationAccessibleWrap.h b/accessible/windows/msaa/ApplicationAccessibleWrap.h index 9d261b7ca694..ee9a9e3cdaba 100644 --- a/accessible/windows/msaa/ApplicationAccessibleWrap.h +++ b/accessible/windows/msaa/ApplicationAccessibleWrap.h @@ -10,23 +10,16 @@ #include "ApplicationAccessible.h" -#include "AccessibleApplication.h" -#include "ia2AccessibleApplication.h" - namespace mozilla { namespace a11y { -class ApplicationAccessibleWrap : public ia2AccessibleApplication, - public ApplicationAccessible { +class ApplicationAccessibleWrap : public ApplicationAccessible { ~ApplicationAccessibleWrap() {} public: // nsISupporst NS_DECL_ISUPPORTS_INHERITED - // IUnknown - DECL_IUNKNOWN_INHERITED - // nsAccessible virtual already_AddRefed NativeAttributes() override; }; diff --git a/accessible/windows/msaa/DocAccessibleWrap.cpp b/accessible/windows/msaa/DocAccessibleWrap.cpp index 34cf176764a1..da0472be3dcc 100644 --- a/accessible/windows/msaa/DocAccessibleWrap.cpp +++ b/accessible/windows/msaa/DocAccessibleWrap.cpp @@ -24,19 +24,10 @@ using namespace mozilla::a11y; DocAccessibleWrap::DocAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell) - : MsaaDocAccessible(aDocument, aPresShell), mHWND(nullptr) {} + : DocAccessible(aDocument, aPresShell), mHWND(nullptr) {} DocAccessibleWrap::~DocAccessibleWrap() {} -IMPL_IUNKNOWN_QUERY_HEAD(DocAccessibleWrap) -if (aIID == IID_ISimpleDOMDocument) { - statistics::ISimpleDOMUsed(); - *aInstancePtr = static_cast(new sdnDocAccessible(this)); - static_cast(*aInstancePtr)->AddRef(); - return S_OK; -} -IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(HyperTextAccessibleWrap) - //////////////////////////////////////////////////////////////////////////////// // LocalAccessible diff --git a/accessible/windows/msaa/DocAccessibleWrap.h b/accessible/windows/msaa/DocAccessibleWrap.h index aa6702ea5f3e..5b1ae9d9b667 100644 --- a/accessible/windows/msaa/DocAccessibleWrap.h +++ b/accessible/windows/msaa/DocAccessibleWrap.h @@ -7,7 +7,7 @@ #ifndef mozilla_a11y_DocAccessibleWrap_h__ #define mozilla_a11y_DocAccessibleWrap_h__ -#include "MsaaDocAccessible.h" +#include "DocAccessible.h" namespace mozilla { @@ -15,13 +15,11 @@ class PresShell; namespace a11y { -class DocAccessibleWrap : public MsaaDocAccessible { +class DocAccessibleWrap : public DocAccessible { public: DocAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell); virtual ~DocAccessibleWrap(); - DECL_IUNKNOWN_INHERITED - // LocalAccessible virtual void Shutdown(); diff --git a/accessible/windows/msaa/HTMLTableAccessibleWrap.cpp b/accessible/windows/msaa/HTMLTableAccessibleWrap.cpp deleted file mode 100644 index 4735e18caafb..000000000000 --- a/accessible/windows/msaa/HTMLTableAccessibleWrap.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=2:tabstop=2: - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "HTMLTableAccessibleWrap.h" - -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// HTMLTableAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableAccessibleWrap, HTMLTableAccessible) - -IMPL_IUNKNOWN_INHERITED2(HTMLTableAccessibleWrap, MsaaAccessible, - HyperTextAccessibleWrap, ia2AccessibleTable) - -void HTMLTableAccessibleWrap::Shutdown() { - ia2AccessibleTable::mTable = nullptr; - HTMLTableAccessible::Shutdown(); -} - -//////////////////////////////////////////////////////////////////////////////// -// HTMLTableCellAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableCellAccessibleWrap, - HTMLTableCellAccessible) - -IMPL_IUNKNOWN_INHERITED1(HTMLTableCellAccessibleWrap, HyperTextAccessibleWrap, - ia2AccessibleTableCell) - -void HTMLTableCellAccessibleWrap::Shutdown() { - ia2AccessibleTableCell::mTableCell = nullptr; - HTMLTableCellAccessible::Shutdown(); -} - -//////////////////////////////////////////////////////////////////////////////// -// HTMLTableCellAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableHeaderCellAccessibleWrap, - HTMLTableHeaderCellAccessible) - -IMPL_IUNKNOWN_INHERITED1(HTMLTableHeaderCellAccessibleWrap, - HyperTextAccessibleWrap, ia2AccessibleTableCell) - -void HTMLTableHeaderCellAccessibleWrap::Shutdown() { - ia2AccessibleTableCell::mTableCell = nullptr; - HTMLTableHeaderCellAccessible::Shutdown(); -} diff --git a/accessible/windows/msaa/HTMLTableAccessibleWrap.h b/accessible/windows/msaa/HTMLTableAccessibleWrap.h index 9abee638b2d3..17a4274871bc 100644 --- a/accessible/windows/msaa/HTMLTableAccessibleWrap.h +++ b/accessible/windows/msaa/HTMLTableAccessibleWrap.h @@ -10,76 +10,11 @@ #include "HTMLTableAccessible.h" -#include "ia2AccessibleTable.h" -#include "ia2AccessibleTableCell.h" - namespace mozilla { namespace a11y { - -/** - * IA2 wrapper class for HTMLTableAccessible implementing IAccessibleTable - * and IAccessibleTable2 interfaces. - */ -class HTMLTableAccessibleWrap : public HTMLTableAccessible, - public ia2AccessibleTable { - ~HTMLTableAccessibleWrap() {} - - public: - HTMLTableAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : HTMLTableAccessible(aContent, aDoc), ia2AccessibleTable(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - -/** - * IA2 wrapper class for HTMLTableCellAccessible implementing - * IAccessibleTableCell interface. - */ -class HTMLTableCellAccessibleWrap : public HTMLTableCellAccessible, - public ia2AccessibleTableCell { - ~HTMLTableCellAccessibleWrap() {} - - public: - HTMLTableCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : HTMLTableCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - -/** - * IA2 wrapper class for HTMLTableHeaderCellAccessible implementing - * IAccessibleTableCell interface. - */ -class HTMLTableHeaderCellAccessibleWrap : public HTMLTableHeaderCellAccessible, - public ia2AccessibleTableCell { - ~HTMLTableHeaderCellAccessibleWrap() {} - - public: - HTMLTableHeaderCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : HTMLTableHeaderCellAccessible(aContent, aDoc), - ia2AccessibleTableCell(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - +using HTMLTableAccessibleWrap = HTMLTableAccessible; +using HTMLTableCellAccessibleWrap = HTMLTableCellAccessible; +using HTMLTableHeaderCellAccessibleWrap = HTMLTableHeaderCellAccessible; } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/msaa/HyperTextAccessibleWrap.cpp b/accessible/windows/msaa/HyperTextAccessibleWrap.cpp index dba1519706b0..609f940b9291 100644 --- a/accessible/windows/msaa/HyperTextAccessibleWrap.cpp +++ b/accessible/windows/msaa/HyperTextAccessibleWrap.cpp @@ -17,32 +17,6 @@ using namespace mozilla::a11y; NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap, HyperTextAccessible) -STDMETHODIMP -HyperTextAccessibleWrap::QueryInterface(REFIID aIID, void** aInstancePtr) { - if (!aInstancePtr) return E_FAIL; - - *aInstancePtr = nullptr; - - if (IsTextRole()) { - if (aIID == IID_IAccessibleText) - *aInstancePtr = - static_cast(static_cast(this)); - else if (aIID == IID_IAccessibleHypertext) - *aInstancePtr = static_cast(this); - else if (aIID == IID_IAccessibleHypertext2) - *aInstancePtr = static_cast(this); - else if (aIID == IID_IAccessibleEditableText) - *aInstancePtr = static_cast(this); - - if (*aInstancePtr) { - AddRef(); - return S_OK; - } - } - - return MsaaAccessible::QueryInterface(aIID, aInstancePtr); -} - nsresult HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent) { uint32_t eventType = aEvent->GetEventType(); diff --git a/accessible/windows/msaa/HyperTextAccessibleWrap.h b/accessible/windows/msaa/HyperTextAccessibleWrap.h index 3a1e5dfb2bf6..6f3b83383c57 100644 --- a/accessible/windows/msaa/HyperTextAccessibleWrap.h +++ b/accessible/windows/msaa/HyperTextAccessibleWrap.h @@ -9,27 +9,14 @@ #define mozilla_a11y_HyperTextAccessibleWrap_h__ #include "HyperTextAccessible.h" -#include "ia2AccessibleEditableText.h" -#include "ia2AccessibleHypertext.h" -#include "IUnknownImpl.h" namespace mozilla { -template -class StaticAutoPtr; -template -class StaticRefPtr; namespace a11y { -class HyperTextAccessibleWrap : public HyperTextAccessible, - public ia2AccessibleHypertext, - public ia2AccessibleEditableText { +class HyperTextAccessibleWrap : public HyperTextAccessible { public: - HyperTextAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : HyperTextAccessible(aContent, aDoc) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED + using HyperTextAccessible::HyperTextAccessible; // nsISupports NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/windows/msaa/ImageAccessibleWrap.cpp b/accessible/windows/msaa/ImageAccessibleWrap.cpp deleted file mode 100644 index db3949d7c823..000000000000 --- a/accessible/windows/msaa/ImageAccessibleWrap.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=2:tabstop=2: - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "ImageAccessibleWrap.h" - -using namespace mozilla; -using namespace mozilla::a11y; - -NS_IMPL_ISUPPORTS_INHERITED0(ImageAccessibleWrap, ImageAccessible) - -IMPL_IUNKNOWN_INHERITED1(ImageAccessibleWrap, MsaaAccessible, - ia2AccessibleImage) diff --git a/accessible/windows/msaa/ImageAccessibleWrap.h b/accessible/windows/msaa/ImageAccessibleWrap.h index b6732138eea1..2a9415d42d26 100644 --- a/accessible/windows/msaa/ImageAccessibleWrap.h +++ b/accessible/windows/msaa/ImageAccessibleWrap.h @@ -9,26 +9,10 @@ #define mozilla_a11y_ImageAccessibleWrap_h__ #include "ImageAccessible.h" -#include "ia2AccessibleImage.h" namespace mozilla { namespace a11y { - -class ImageAccessibleWrap : public ImageAccessible, public ia2AccessibleImage { - public: - ImageAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : ImageAccessible(aContent, aDoc) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - protected: - ~ImageAccessibleWrap() {} -}; - +using ImageAccessibleWrap = ImageAccessible; } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/msaa/MsaaAccessible.cpp b/accessible/windows/msaa/MsaaAccessible.cpp index ff15729fb4d2..c3de7ab2b1ff 100644 --- a/accessible/windows/msaa/MsaaAccessible.cpp +++ b/accessible/windows/msaa/MsaaAccessible.cpp @@ -5,17 +5,26 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "EnumVariant.h" -#include "MsaaAccessible.h" +#include "ia2AccessibleApplication.h" +#include "ia2AccessibleHypertext.h" +#include "ia2AccessibleImage.h" +#include "ia2AccessibleTable.h" +#include "ia2AccessibleTableCell.h" #include "mozilla/a11y/AccessibleWrap.h" #include "mozilla/a11y/DocAccessibleParent.h" #include "mozilla/dom/BrowserBridgeParent.h" #include "mozilla/dom/BrowserParent.h" #include "mozilla/mscom/Interceptor.h" +#include "MsaaAccessible.h" +#include "MsaaDocAccessible.h" +#include "MsaaRootAccessible.h" +#include "MsaaXULMenuAccessible.h" #include "nsEventMap.h" #include "nsViewManager.h" #include "nsWinUtils.h" #include "Relation.h" #include "sdnAccessible.h" +#include "sdnTextAccessible.h" using namespace mozilla; using namespace mozilla::a11y; @@ -26,28 +35,75 @@ static const VARIANT kVarChildIdSelf = {{{VT_I4}}}; MsaaIdGenerator MsaaAccessible::sIDGen; ITypeInfo* MsaaAccessible::gTypeInfo = nullptr; -MsaaAccessible::MsaaAccessible() : mID(kNoID) {} +/* static */ +MsaaAccessible* MsaaAccessible::Create(Accessible* aAcc) { + // We don't support RemoteAccessible yet. + MOZ_ASSERT(aAcc->IsLocal()); + // The order of some of these is important! For example, when isRoot is true, + // IsDoc will also be true, so we must check IsRoot first. IsTable/Cell and + // IsHyperText are a similar case. + if (aAcc->IsRoot()) { + return new MsaaRootAccessible(aAcc); + } + if (aAcc->IsDoc()) { + return new MsaaDocAccessible(aAcc); + } + if (aAcc->IsTable()) { + return new ia2AccessibleTable(aAcc); + } + if (aAcc->IsTableCell()) { + return new ia2AccessibleTableCell(aAcc); + } + if (aAcc->IsApplication()) { + return new ia2AccessibleApplication(aAcc); + } + if (aAcc->IsHyperText()) { + return new ia2AccessibleHypertext(aAcc); + } + if (aAcc->IsImage()) { + return new ia2AccessibleImage(aAcc); + } + if (aAcc->AsLocal()->GetContent() && + aAcc->AsLocal()->GetContent()->IsXULElement(nsGkAtoms::menuitem)) { + return new MsaaXULMenuitemAccessible(aAcc); + } + return new MsaaAccessible(aAcc); +} + +MsaaAccessible::MsaaAccessible(Accessible* aAcc) : mAcc(aAcc), mID(kNoID) {} MsaaAccessible::~MsaaAccessible() { + MOZ_ASSERT(!mAcc, "MsaaShutdown wasn't called!"); if (mID != kNoID) { sIDGen.ReleaseID(WrapNotNull(this)); } } void MsaaAccessible::MsaaShutdown() { + // Accessibles can be shut down twice in some cases. If that happens, + // MsaaShutdown will also be called twice because AccessibleWrap holds + // the reference until its destructor is called; see the comments in + // AccessibleWrap::Shutdown. + if (!mAcc) { + return; + } + + // We don't support RemoteAccessible yet. + MOZ_ASSERT(mAcc->IsLocal()); + if (mAcc->AsLocal()->IsProxy()) { + // For RemoteAccessibleWrap, we just need to clear mAcc. + mAcc = nullptr; + return; + } + if (mID != kNoID) { // Don't use LocalAcc() here because it requires that the Accessible is // not defunct. When shutting down, the Accessible might already be // marked defunct. It's safe for us to call LocalAccessible::Document() here // regardless. - auto localAcc = static_cast(this); - 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) { - doc->RemoveID(mID); - } + auto doc = MsaaDocAccessible::GetFrom(mAcc->AsLocal()->Document()); + MOZ_ASSERT(doc); + doc->RemoveID(mID); } if (XRE_IsContentProcess()) { @@ -71,11 +127,13 @@ void MsaaAccessible::MsaaShutdown() { } mAssociatedCOMObjectsForDisconnection.Clear(); } + + mAcc = nullptr; } void MsaaAccessible::SetID(uint32_t aID) { - MOZ_ASSERT(XRE_IsParentProcess() && - static_cast(this)->IsProxy()); + MOZ_ASSERT(XRE_IsParentProcess() && mAcc && mAcc->IsLocal() && + mAcc->AsLocal()->IsProxy()); mID = aID; } @@ -252,8 +310,10 @@ void MsaaAccessible::FireWinEvent(LocalAccessible* aTarget, } AccessibleWrap* MsaaAccessible::LocalAcc() { - auto acc = static_cast(this); - return acc->IsDefunct() ? nullptr : acc; + auto acc = static_cast(mAcc); + MOZ_ASSERT(!acc || !acc->IsDefunct(), + "mAcc defunct but MsaaShutdown wasn't called"); + return acc; } /** @@ -666,6 +726,12 @@ MsaaAccessible::QueryInterface(REFIID iid, void** ppv) { } *ppv = static_cast(new sdnAccessible(WrapNotNull(this))); + } else if (iid == IID_ISimpleDOMText && acc->IsTextLeaf() && + !acc->IsProxy()) { + statistics::ISimpleDOMUsed(); + *ppv = static_cast(new sdnTextAccessible(this)); + static_cast(*ppv)->AddRef(); + return S_OK; } if (nullptr == *ppv) { @@ -700,15 +766,6 @@ MsaaAccessible::QueryInterface(REFIID iid, void** ppv) { return S_OK; } -// XXX This delegation to AccessibleWrap is a necessary hack until we can move -// the IUnknown implementation out of AccessibleWrap. -ULONG STDMETHODCALLTYPE MsaaAccessible::AddRef() { - return static_cast(this)->AddRef(); -} -ULONG STDMETHODCALLTYPE MsaaAccessible::Release() { - return static_cast(this)->Release(); -} - // IAccessible methods STDMETHODIMP diff --git a/accessible/windows/msaa/MsaaAccessible.h b/accessible/windows/msaa/MsaaAccessible.h index e3c0d9819aad..b909a554b210 100644 --- a/accessible/windows/msaa/MsaaAccessible.h +++ b/accessible/windows/msaa/MsaaAccessible.h @@ -11,6 +11,7 @@ #include "ia2AccessibleComponent.h" #include "ia2AccessibleHyperlink.h" #include "ia2AccessibleValue.h" +#include "IUnknownImpl.h" #include "mozilla/a11y/MsaaIdGenerator.h" #include "mozilla/dom/ipc/IdType.h" #include "nsXULAppAPI.h" @@ -27,7 +28,7 @@ class MsaaAccessible : public ia2Accessible, public ia2AccessibleHyperlink, public ia2AccessibleValue { public: - MsaaAccessible(); + static MsaaAccessible* Create(Accessible* aAcc); AccessibleWrap* LocalAcc(); @@ -69,10 +70,7 @@ class MsaaAccessible : public ia2Accessible, static MsaaAccessible* GetFrom(Accessible* aAcc); - // IUnknown - STDMETHODIMP QueryInterface(REFIID, void**) override; - ULONG STDMETHODCALLTYPE AddRef() override; - ULONG STDMETHODCALLTYPE Release() override; + DECL_IUNKNOWN // IAccessible virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent( @@ -157,8 +155,11 @@ class MsaaAccessible : public ia2Accessible, UINT* puArgErr) override; protected: + explicit MsaaAccessible(Accessible* aAcc); virtual ~MsaaAccessible(); + Accessible* mAcc; + uint32_t mID; static MsaaIdGenerator sIDGen; diff --git a/accessible/windows/msaa/MsaaDocAccessible.cpp b/accessible/windows/msaa/MsaaDocAccessible.cpp index 6dc7012988ec..b593ff4530e0 100644 --- a/accessible/windows/msaa/MsaaDocAccessible.cpp +++ b/accessible/windows/msaa/MsaaDocAccessible.cpp @@ -14,11 +14,7 @@ using namespace mozilla; using namespace mozilla::a11y; DocAccessible* MsaaDocAccessible::DocAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of DocAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); - return static_cast(acc); + return static_cast(LocalAcc()); } /* static */ @@ -26,6 +22,16 @@ MsaaDocAccessible* MsaaDocAccessible::GetFrom(DocAccessible* aDoc) { return static_cast(MsaaAccessible::GetFrom(aDoc)); } +// IUnknown +IMPL_IUNKNOWN_QUERY_HEAD(MsaaDocAccessible) +if (aIID == IID_ISimpleDOMDocument) { + statistics::ISimpleDOMUsed(); + *aInstancePtr = static_cast(new sdnDocAccessible(this)); + static_cast(*aInstancePtr)->AddRef(); + return S_OK; +} +IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(ia2AccessibleHypertext) + STDMETHODIMP MsaaDocAccessible::get_accParent( /* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispParent) { diff --git a/accessible/windows/msaa/MsaaDocAccessible.h b/accessible/windows/msaa/MsaaDocAccessible.h index ef501acb6ace..23d038556c8b 100644 --- a/accessible/windows/msaa/MsaaDocAccessible.h +++ b/accessible/windows/msaa/MsaaDocAccessible.h @@ -7,31 +7,21 @@ #ifndef mozilla_a11y_MsaaDocAccessible_h__ #define mozilla_a11y_MsaaDocAccessible_h__ -#include "DocAccessible.h" -#include "MsaaAccessible.h" +#include "ia2AccessibleHypertext.h" namespace mozilla { -class PresShell; - namespace a11y { +class Accessible; class DocAccessible; -// XXX This should inherit from MsaaAccessible. Inheriting from DocAccessible -// is a necessary hack until we remove the inheritance of DocAccessibleWrap. -class MsaaDocAccessible : public DocAccessible { +class MsaaDocAccessible : public ia2AccessibleHypertext { public: - MsaaDocAccessible(dom::Document* aDocument, PresShell* aPresShell) - : DocAccessible(aDocument, aPresShell) {} - DocAccessible* DocAcc(); // IUnknown - // XXX This override of QueryInterface is a necessary hack until we get rid - // of the inheritance of DocAccessible. - STDMETHODIMP QueryInterface(REFIID iid, void** ppv) override { - return MsaaAccessible::QueryInterface(iid, ppv); - } + DECL_IUNKNOWN_INHERITED + IMPL_IUNKNOWN_REFCOUNTING_INHERITED(ia2AccessibleHypertext) // IAccessible @@ -59,6 +49,8 @@ class MsaaDocAccessible : public DocAccessible { static MsaaDocAccessible* GetFrom(DocAccessible* aDoc); protected: + using ia2AccessibleHypertext::ia2AccessibleHypertext; + /* * This provides a mapping from 32 bit id to accessible objects. */ diff --git a/accessible/windows/msaa/MsaaRootAccessible.cpp b/accessible/windows/msaa/MsaaRootAccessible.cpp index 6f85988f2e9b..cf0498220eab 100644 --- a/accessible/windows/msaa/MsaaRootAccessible.cpp +++ b/accessible/windows/msaa/MsaaRootAccessible.cpp @@ -12,11 +12,7 @@ using namespace mozilla; using namespace mozilla::a11y; RootAccessible* MsaaRootAccessible::RootAcc() { - // XXX This first static_cast is a necessary hack until we get rid of the - // inheritance of RootAccessibleWrap. - auto wrap = static_cast(this); - AccessibleWrap* acc = static_cast(wrap)->LocalAcc(); - return static_cast(acc); + return static_cast(LocalAcc()); } //////////////////////////////////////////////////////////////////////////////// @@ -36,15 +32,15 @@ MsaaRootAccessible::InternalQueryInterface(REFIID aIid, void** aOutInterface) { } // ...Otherwise we pass through to the base COM implementation of - // QueryInterface which is provided by DocAccessibleWrap. - return DocAccessibleWrap::QueryInterface(aIid, aOutInterface); + // QueryInterface which is provided by MsaaDocAccessible. + return MsaaDocAccessible::QueryInterface(aIid, aOutInterface); } ULONG -MsaaRootAccessible::InternalAddRef() { return DocAccessible::AddRef(); } +MsaaRootAccessible::InternalAddRef() { return MsaaDocAccessible::AddRef(); } ULONG -MsaaRootAccessible::InternalRelease() { return DocAccessible::Release(); } +MsaaRootAccessible::InternalRelease() { return MsaaDocAccessible::Release(); } already_AddRefed MsaaRootAccessible::Aggregate(IUnknown* aOuter) { MOZ_ASSERT(mOuter && diff --git a/accessible/windows/msaa/MsaaRootAccessible.h b/accessible/windows/msaa/MsaaRootAccessible.h index e18dee321a2d..105bdf5355d7 100644 --- a/accessible/windows/msaa/MsaaRootAccessible.h +++ b/accessible/windows/msaa/MsaaRootAccessible.h @@ -7,21 +7,16 @@ #define mozilla_a11y_MsaaRootAccessible_h__ #include "mozilla/mscom/Aggregation.h" -#include "RootAccessible.h" +#include "MsaaDocAccessible.h" namespace mozilla { -class PresShell; - namespace a11y { -// XXX This should inherit from MsaaDocAccessible. Inheriting from -// RootAccessible is a necessary hack until we remove the inheritance of -// RootAccessibleWrap. -class MsaaRootAccessible : public RootAccessible { +class MsaaRootAccessible : public MsaaDocAccessible { public: - MsaaRootAccessible(dom::Document* aDocument, PresShell* aPresShell) - : RootAccessible(aDocument, aPresShell), mOuter(&mInternalUnknown) {} + explicit MsaaRootAccessible(Accessible* aAcc) + : MsaaDocAccessible(aAcc), mOuter(&mInternalUnknown) {} /** * This method enables a RootAccessibleWrap to be wrapped by a diff --git a/accessible/windows/msaa/MsaaXULMenuAccessible.h b/accessible/windows/msaa/MsaaXULMenuAccessible.h index 2b3c8e1df671..50abb0ed40b0 100644 --- a/accessible/windows/msaa/MsaaXULMenuAccessible.h +++ b/accessible/windows/msaa/MsaaXULMenuAccessible.h @@ -6,21 +6,19 @@ #ifndef mozilla_a11y_MsaaXULMenuAccessible_h__ #define mozilla_a11y_MsaaXULMenuAccessible_h__ -#include "XULMenuAccessible.h" +#include "MsaaAccessible.h" namespace mozilla { namespace a11y { -// XXX This should inherit from MsaaAccessible. Inheriting from -// XULMenuitemAccessible is a necessary hack until we remove the inheritance of -// XULMenuitemAccessibleWrap. -class MsaaXULMenuitemAccessible : public XULMenuitemAccessible { +class MsaaXULMenuitemAccessible : public MsaaAccessible { public: - using XULMenuitemAccessible::XULMenuitemAccessible; - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut( /* [optional][in] */ VARIANT varChild, /* [retval][out] */ BSTR __RPC_FAR* pszKeyboardShortcut) override; + + protected: + using MsaaAccessible::MsaaAccessible; }; } // namespace a11y diff --git a/accessible/windows/msaa/RootAccessibleWrap.cpp b/accessible/windows/msaa/RootAccessibleWrap.cpp index 19d31512805e..3a2477e87740 100644 --- a/accessible/windows/msaa/RootAccessibleWrap.cpp +++ b/accessible/windows/msaa/RootAccessibleWrap.cpp @@ -18,7 +18,7 @@ using namespace mozilla::a11y; RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell) - : MsaaRootAccessible(aDocument, aPresShell) {} + : RootAccessible(aDocument, aPresShell) {} RootAccessibleWrap::~RootAccessibleWrap() {} diff --git a/accessible/windows/msaa/RootAccessibleWrap.h b/accessible/windows/msaa/RootAccessibleWrap.h index a7ec3ead7b0e..b37bc4fd9ba6 100644 --- a/accessible/windows/msaa/RootAccessibleWrap.h +++ b/accessible/windows/msaa/RootAccessibleWrap.h @@ -6,7 +6,7 @@ #ifndef mozilla_a11y_RootAccessibleWrap_h__ #define mozilla_a11y_RootAccessibleWrap_h__ -#include "MsaaRootAccessible.h" +#include "RootAccessible.h" namespace mozilla { @@ -14,7 +14,7 @@ class PresShell; namespace a11y { -class RootAccessibleWrap : public MsaaRootAccessible { +class RootAccessibleWrap : public RootAccessible { public: RootAccessibleWrap(dom::Document* aDocument, PresShell* aPresShell); virtual ~RootAccessibleWrap(); diff --git a/accessible/windows/msaa/ServiceProvider.cpp b/accessible/windows/msaa/ServiceProvider.cpp index 73ac6ac1bbb8..e9098ad724a5 100644 --- a/accessible/windows/msaa/ServiceProvider.cpp +++ b/accessible/windows/msaa/ServiceProvider.cpp @@ -6,6 +6,7 @@ #include "ServiceProvider.h" +#include "AccessibleApplication_i.c" #include "ApplicationAccessibleWrap.h" #include "DocAccessible.h" #include "nsAccUtils.h" diff --git a/accessible/windows/msaa/TextLeafAccessibleWrap.cpp b/accessible/windows/msaa/TextLeafAccessibleWrap.cpp deleted file mode 100644 index 523b74aa2c13..000000000000 --- a/accessible/windows/msaa/TextLeafAccessibleWrap.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "TextLeafAccessibleWrap.h" - -#include "sdnTextAccessible.h" -#include "Statistics.h" - -using namespace mozilla::a11y; - -IMPL_IUNKNOWN_QUERY_HEAD(TextLeafAccessibleWrap) -if (aIID == IID_ISimpleDOMText) { - statistics::ISimpleDOMUsed(); - *aInstancePtr = static_cast(new sdnTextAccessible(this)); - static_cast(*aInstancePtr)->AddRef(); - return S_OK; -} -IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(MsaaAccessible) diff --git a/accessible/windows/msaa/TextLeafAccessibleWrap.h b/accessible/windows/msaa/TextLeafAccessibleWrap.h index b22df460b554..acd5f64fc744 100644 --- a/accessible/windows/msaa/TextLeafAccessibleWrap.h +++ b/accessible/windows/msaa/TextLeafAccessibleWrap.h @@ -11,21 +11,7 @@ namespace mozilla { namespace a11y { - -/** - * Wrap TextLeafAccessible to expose ISimpleDOMText as a native interface with - * a tear off. - */ -class TextLeafAccessibleWrap : public TextLeafAccessible { - public: - TextLeafAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : TextLeafAccessible(aContent, aDoc) {} - virtual ~TextLeafAccessibleWrap() {} - - // IUnknown - DECL_IUNKNOWN_INHERITED -}; - +using TextLeafAccessibleWrap = TextLeafAccessible; } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/msaa/XULListboxAccessibleWrap.cpp b/accessible/windows/msaa/XULListboxAccessibleWrap.cpp deleted file mode 100644 index 13ed4e067657..000000000000 --- a/accessible/windows/msaa/XULListboxAccessibleWrap.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "XULListboxAccessibleWrap.h" - -#include "LocalAccessible-inl.h" - -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// XULListboxAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(XULListboxAccessibleWrap, XULListboxAccessible) - -IMPL_IUNKNOWN_QUERY_HEAD(XULListboxAccessibleWrap) -IMPL_IUNKNOWN_QUERY_CLASS_COND(ia2AccessibleTable, - !IsDefunct() && IsMulticolumn()); -IMPL_IUNKNOWN_QUERY_CLASS(MsaaAccessible) -IMPL_IUNKNOWN_QUERY_TAIL - -void XULListboxAccessibleWrap::Shutdown() { - ia2AccessibleTable::mTable = nullptr; - XULListboxAccessible::Shutdown(); -} diff --git a/accessible/windows/msaa/XULListboxAccessibleWrap.h b/accessible/windows/msaa/XULListboxAccessibleWrap.h index 9b27edd43d1a..97fca3891400 100644 --- a/accessible/windows/msaa/XULListboxAccessibleWrap.h +++ b/accessible/windows/msaa/XULListboxAccessibleWrap.h @@ -12,28 +12,7 @@ namespace mozilla { namespace a11y { - -/** - * IA2 wrapper class for XULListboxAccessible class implementing - * IAccessibleTable and IAccessibleTable2 interfaces. - */ -class XULListboxAccessibleWrap : public XULListboxAccessible, - public ia2AccessibleTable { - ~XULListboxAccessibleWrap() {} - - public: - XULListboxAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : XULListboxAccessible(aContent, aDoc), ia2AccessibleTable(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - +using XULListboxAccessibleWrap = XULListboxAccessible; } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/msaa/XULMenuAccessibleWrap.cpp b/accessible/windows/msaa/XULMenuAccessibleWrap.cpp index 6308f7094b02..dc9b0494de8f 100644 --- a/accessible/windows/msaa/XULMenuAccessibleWrap.cpp +++ b/accessible/windows/msaa/XULMenuAccessibleWrap.cpp @@ -4,6 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "XULMenuAccessibleWrap.h" +#include "mozilla/dom/Element.h" #include "nsNameSpaceManager.h" using namespace mozilla::a11y; @@ -14,7 +15,7 @@ using namespace mozilla::a11y; XULMenuitemAccessibleWrap::XULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) - : MsaaXULMenuitemAccessible(aContent, aDoc) {} + : XULMenuitemAccessible(aContent, aDoc) {} ENameValueFlag XULMenuitemAccessibleWrap::Name(nsString& aName) const { // XXX This should be done in MSAA's get_accName() so that diff --git a/accessible/windows/msaa/XULMenuAccessibleWrap.h b/accessible/windows/msaa/XULMenuAccessibleWrap.h index e40e95450af1..f3dcf8751586 100644 --- a/accessible/windows/msaa/XULMenuAccessibleWrap.h +++ b/accessible/windows/msaa/XULMenuAccessibleWrap.h @@ -6,12 +6,12 @@ #ifndef mozilla_a11y_XULMenuAccessibleWrap_h__ #define mozilla_a11y_XULMenuAccessibleWrap_h__ -#include "MsaaXULMenuAccessible.h" +#include "XULMenuAccessible.h" namespace mozilla { namespace a11y { -class XULMenuitemAccessibleWrap : public MsaaXULMenuitemAccessible { +class XULMenuitemAccessibleWrap : public XULMenuitemAccessible { public: XULMenuitemAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); virtual ~XULMenuitemAccessibleWrap() {} diff --git a/accessible/windows/msaa/XULTreeGridAccessibleWrap.cpp b/accessible/windows/msaa/XULTreeGridAccessibleWrap.cpp deleted file mode 100644 index 0b2233584389..000000000000 --- a/accessible/windows/msaa/XULTreeGridAccessibleWrap.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "XULTreeGridAccessibleWrap.h" - -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// XULTreeGridAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(XULTreeGridAccessibleWrap, XULTreeGridAccessible) - -IMPL_IUNKNOWN_INHERITED1(XULTreeGridAccessibleWrap, MsaaAccessible, - ia2AccessibleTable) - -void XULTreeGridAccessibleWrap::Shutdown() { - ia2AccessibleTable::mTable = nullptr; - XULTreeGridAccessible::Shutdown(); -} - -//////////////////////////////////////////////////////////////////////////////// -// XULTreeGridCellAccessibleWrap -//////////////////////////////////////////////////////////////////////////////// - -NS_IMPL_ISUPPORTS_INHERITED0(XULTreeGridCellAccessibleWrap, - XULTreeGridCellAccessible) - -IMPL_IUNKNOWN_INHERITED1(XULTreeGridCellAccessibleWrap, MsaaAccessible, - ia2AccessibleTableCell) - -void XULTreeGridCellAccessibleWrap::Shutdown() { - ia2AccessibleTableCell::mTableCell = nullptr; - XULTreeGridCellAccessible::Shutdown(); -} diff --git a/accessible/windows/msaa/XULTreeGridAccessibleWrap.h b/accessible/windows/msaa/XULTreeGridAccessibleWrap.h index 7a014725c80e..7edab0e2b799 100644 --- a/accessible/windows/msaa/XULTreeGridAccessibleWrap.h +++ b/accessible/windows/msaa/XULTreeGridAccessibleWrap.h @@ -8,62 +8,10 @@ #include "XULTreeGridAccessible.h" -#include "ia2AccessibleTable.h" -#include "ia2AccessibleTableCell.h" - namespace mozilla { namespace a11y { - -/** - * IA2 wrapper class for XULTreeGridAccessible class implementing - * IAccessibleTable and IAccessibleTable2 interfaces. - */ -class XULTreeGridAccessibleWrap : public XULTreeGridAccessible, - public ia2AccessibleTable { - ~XULTreeGridAccessibleWrap() {} - - public: - XULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc, - nsTreeBodyFrame* aTree) - : XULTreeGridAccessible(aContent, aDoc, aTree), - ia2AccessibleTable(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - -/** - * IA2 wrapper class for XULTreeGridCellAccessible class, implements - * IAccessibleTableCell interface. - */ -class XULTreeGridCellAccessibleWrap : public XULTreeGridCellAccessible, - public ia2AccessibleTableCell { - ~XULTreeGridCellAccessibleWrap() {} - - public: - XULTreeGridCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc, - XULTreeGridRowAccessible* aRowAcc, - dom::XULTreeElement* aTree, - nsITreeView* aTreeView, int32_t aRow, - nsTreeColumn* aColumn) - : XULTreeGridCellAccessible(aContent, aDoc, aRowAcc, aTree, aTreeView, - aRow, aColumn), - ia2AccessibleTableCell(this) {} - - // IUnknown - DECL_IUNKNOWN_INHERITED - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - virtual void Shutdown() override; -}; - +using XULTreeGridAccessibleWrap = XULTreeGridAccessible; +using XULTreeGridCellAccessibleWrap = XULTreeGridCellAccessible; } // namespace a11y } // namespace mozilla diff --git a/accessible/windows/msaa/moz.build b/accessible/windows/msaa/moz.build index 27e8cc47d371..99f0228e7472 100644 --- a/accessible/windows/msaa/moz.build +++ b/accessible/windows/msaa/moz.build @@ -21,15 +21,12 @@ EXPORTS.mozilla.a11y += [ UNIFIED_SOURCES += [ "AccessibleWrap.cpp", "ApplicationAccessibleWrap.cpp", - "ARIAGridAccessibleWrap.cpp", "Compatibility.cpp", "CompatibilityUIA.cpp", "DocAccessibleWrap.cpp", "EnumVariant.cpp", "GeckoCustom.cpp", - "HTMLTableAccessibleWrap.cpp", "HyperTextAccessibleWrap.cpp", - "ImageAccessibleWrap.cpp", "IUnknownImpl.cpp", "MsaaAccessible.cpp", "MsaaDocAccessible.cpp", @@ -39,7 +36,6 @@ UNIFIED_SOURCES += [ "nsWinUtils.cpp", "Platform.cpp", "RootAccessibleWrap.cpp", - "TextLeafAccessibleWrap.cpp", ] SOURCES += [ @@ -55,9 +51,7 @@ OS_LIBS += [ if CONFIG["MOZ_XUL"]: UNIFIED_SOURCES += [ - "XULListboxAccessibleWrap.cpp", "XULMenuAccessibleWrap.cpp", - "XULTreeGridAccessibleWrap.cpp", ] LOCAL_INCLUDES += [