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
This commit is contained in:
James Teh 2021-05-03 11:31:04 +00:00
parent a5d0603d71
commit c33d1b0837
47 changed files with 283 additions and 661 deletions

View File

@ -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;
}

View File

@ -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<ApplicationAccessibleWrap*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
return static_cast<ApplicationAccessible*>(acc);
return static_cast<ApplicationAccessible*>(LocalAcc());
}
////////////////////////////////////////////////////////////////////////////////
// IUnknown
STDMETHODIMP
ia2AccessibleApplication::QueryInterface(REFIID iid, void** ppv) {
if (!ppv) return E_INVALIDARG;
*ppv = nullptr;
if (IID_IAccessibleApplication == iid) {
*ppv = static_cast<IAccessibleApplication*>(this);
(reinterpret_cast<IUnknown*>(*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

View File

@ -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();
};

View File

@ -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<HyperTextAccessibleWrap*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
auto hyp = static_cast<ia2AccessibleHypertext*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(hyp)->LocalAcc();
return static_cast<HyperTextAccessibleWrap*>(acc);
}

View File

@ -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<HyperTextAccessibleWrap*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
AccessibleWrap* acc = LocalAcc();
return static_cast<HyperTextAccessibleWrap*>(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<IAccessibleText*>(static_cast<ia2AccessibleText*>(this));
else if (aIID == IID_IAccessibleHypertext)
*aInstancePtr = static_cast<IAccessibleHypertext*>(this);
else if (aIID == IID_IAccessibleHypertext2)
*aInstancePtr = static_cast<IAccessibleHypertext2*>(this);
else if (aIID == IID_IAccessibleEditableText)
*aInstancePtr = static_cast<IAccessibleEditableText*>(this);
if (*aInstancePtr) {
AddRef();
return S_OK;
}
}
return MsaaAccessible::QueryInterface(aIID, aInstancePtr);
}
// IAccessibleHypertext
STDMETHODIMP

View File

@ -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();
};

View File

@ -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<ImageAccessibleWrap*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
AccessibleWrap* acc = static_cast<MsaaAccessible*>(this)->LocalAcc();
return static_cast<ImageAccessible*>(acc);
}
// IUnknown
STDMETHODIMP
ia2AccessibleImage::QueryInterface(REFIID iid, void** ppv) {
if (!ppv) return E_INVALIDARG;
*ppv = nullptr;
if (IID_IAccessibleImage == iid) {
*ppv = static_cast<IAccessibleImage*>(this);
(static_cast<IUnknown*>(*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

View File

@ -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();
};

View File

@ -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);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -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

View File

@ -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<IAccessibleTableCell*>(this);
(reinterpret_cast<IUnknown*>(*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

View File

@ -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

View File

@ -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<HyperTextAccessibleWrap*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
auto hyp = static_cast<ia2AccessibleHypertext*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(hyp)->LocalAcc();
return static_cast<HyperTextAccessibleWrap*>(acc);
}

View File

@ -9,8 +9,14 @@
#define _ACCESSIBLE_TEXT_H
#include "AccessibleText.h"
#include "nsIAccessibleText.h"
namespace mozilla {
template <class T>
class StaticAutoPtr;
template <class T>
class StaticRefPtr;
namespace a11y {
class HyperTextAccessibleWrap;

View File

@ -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();
}

View File

@ -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

View File

@ -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<IAccessible*>(this);
NS_ADDREF_THIS();
RefPtr<IAccessible> result = GetMsaa();
return result.forget(aOutAccessible);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -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<IHandlerControl> aCtrl);
@ -76,6 +76,8 @@ class AccessibleWrap : public LocalAccessible, public MsaaAccessible {
protected:
virtual ~AccessibleWrap() = default;
RefPtr<MsaaAccessible> mMsaa;
struct HandlerControllerData final {
HandlerControllerData(DWORD aPid, RefPtr<IHandlerControl>&& aCtrl)
: mPid(aPid), mCtrl(std::move(aCtrl)) {

View File

@ -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<nsIPersistentProperties>
ApplicationAccessibleWrap::NativeAttributes() {
RefPtr<nsPersistentProperties> attributes = new nsPersistentProperties();

View File

@ -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<nsIPersistentProperties> NativeAttributes() override;
};

View File

@ -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<ISimpleDOMDocument*>(new sdnDocAccessible(this));
static_cast<IUnknown*>(*aInstancePtr)->AddRef();
return S_OK;
}
IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(HyperTextAccessibleWrap)
////////////////////////////////////////////////////////////////////////////////
// LocalAccessible

View File

@ -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();

View File

@ -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();
}

View File

@ -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

View File

@ -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<IAccessibleText*>(static_cast<ia2AccessibleText*>(this));
else if (aIID == IID_IAccessibleHypertext)
*aInstancePtr = static_cast<IAccessibleHypertext*>(this);
else if (aIID == IID_IAccessibleHypertext2)
*aInstancePtr = static_cast<IAccessibleHypertext2*>(this);
else if (aIID == IID_IAccessibleEditableText)
*aInstancePtr = static_cast<IAccessibleEditableText*>(this);
if (*aInstancePtr) {
AddRef();
return S_OK;
}
}
return MsaaAccessible::QueryInterface(aIID, aInstancePtr);
}
nsresult HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
uint32_t eventType = aEvent->GetEventType();

View File

@ -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 T>
class StaticAutoPtr;
template <class T>
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

View File

@ -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)

View File

@ -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

View File

@ -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<AccessibleWrap*>(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<AccessibleWrap*>(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<AccessibleWrap*>(this);
return acc->IsDefunct() ? nullptr : acc;
auto acc = static_cast<AccessibleWrap*>(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<ISimpleDOMNode*>(new sdnAccessible(WrapNotNull(this)));
} else if (iid == IID_ISimpleDOMText && acc->IsTextLeaf() &&
!acc->IsProxy()) {
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMText*>(new sdnTextAccessible(this));
static_cast<IUnknown*>(*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<AccessibleWrap*>(this)->AddRef();
}
ULONG STDMETHODCALLTYPE MsaaAccessible::Release() {
return static_cast<AccessibleWrap*>(this)->Release();
}
// IAccessible methods
STDMETHODIMP

View File

@ -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;

View File

@ -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<DocAccessible*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
return static_cast<DocAccessible*>(acc);
return static_cast<DocAccessible*>(LocalAcc());
}
/* static */
@ -26,6 +22,16 @@ MsaaDocAccessible* MsaaDocAccessible::GetFrom(DocAccessible* aDoc) {
return static_cast<MsaaDocAccessible*>(MsaaAccessible::GetFrom(aDoc));
}
// IUnknown
IMPL_IUNKNOWN_QUERY_HEAD(MsaaDocAccessible)
if (aIID == IID_ISimpleDOMDocument) {
statistics::ISimpleDOMUsed();
*aInstancePtr = static_cast<ISimpleDOMDocument*>(new sdnDocAccessible(this));
static_cast<IUnknown*>(*aInstancePtr)->AddRef();
return S_OK;
}
IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(ia2AccessibleHypertext)
STDMETHODIMP
MsaaDocAccessible::get_accParent(
/* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispParent) {

View File

@ -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.
*/

View File

@ -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<RootAccessible*>(this);
AccessibleWrap* acc = static_cast<MsaaAccessible*>(wrap)->LocalAcc();
return static_cast<RootAccessible*>(acc);
return static_cast<RootAccessible*>(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<IUnknown> MsaaRootAccessible::Aggregate(IUnknown* aOuter) {
MOZ_ASSERT(mOuter &&

View File

@ -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

View File

@ -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

View File

@ -18,7 +18,7 @@ using namespace mozilla::a11y;
RootAccessibleWrap::RootAccessibleWrap(dom::Document* aDocument,
PresShell* aPresShell)
: MsaaRootAccessible(aDocument, aPresShell) {}
: RootAccessible(aDocument, aPresShell) {}
RootAccessibleWrap::~RootAccessibleWrap() {}

View File

@ -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();

View File

@ -6,6 +6,7 @@
#include "ServiceProvider.h"
#include "AccessibleApplication_i.c"
#include "ApplicationAccessibleWrap.h"
#include "DocAccessible.h"
#include "nsAccUtils.h"

View File

@ -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<ISimpleDOMText*>(new sdnTextAccessible(this));
static_cast<IUnknown*>(*aInstancePtr)->AddRef();
return S_OK;
}
IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(MsaaAccessible)

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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() {}

View File

@ -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();
}

View File

@ -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

View File

@ -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 += [