Bug 1251897 - DocAccessible constructor doesn't have to take root element as an argument, r=davidb

This commit is contained in:
Alexander Surkov 2016-03-02 09:39:06 -05:00
parent 7505fe3457
commit afc80cad93
15 changed files with 24 additions and 40 deletions

View File

@ -14,9 +14,8 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessible(aDocument, aRootContent, aPresShell), mActivated(false)
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell), mActivated(false)
{
}

View File

@ -19,8 +19,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
bool mActivated;

View File

@ -470,17 +470,15 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
// We only create root accessibles for the true root, otherwise create a
// doc accessible.
nsIContent *rootElm = nsCoreUtils::GetRoleContent(aDocument);
RefPtr<DocAccessible> docAcc = isRootDoc ?
new RootAccessibleWrap(aDocument, rootElm, presShell) :
new DocAccessibleWrap(aDocument, rootElm, presShell);
new RootAccessibleWrap(aDocument, presShell) :
new DocAccessibleWrap(aDocument, presShell);
// Cache the document accessible into document cache.
mDocAccessibleCache.Put(aDocument, docAcc);
// Initialize the document accessible.
docAcc->Init();
docAcc->SetRoleMapEntry(aria::GetRoleMap(aDocument));
// Bind the document to the tree.
if (isRootDoc) {

View File

@ -76,9 +76,8 @@ static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs);
// Constructor/desctructor
DocAccessible::
DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
HyperTextAccessibleWrap(aRootContent, this),
DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell) :
HyperTextAccessibleWrap(nullptr, this),
// XXX aaronl should we use an algorithm for the initial cache size?
mAccessibleCache(kDefaultCacheLength),
mNodeToAccessibleMap(kDefaultCacheLength),
@ -1465,7 +1464,7 @@ DocAccessible::DoInitialUpdate()
// miss the notification (since content tree change notifications are ignored
// prior to initial update). Make sure the content element is valid.
nsIContent* contentElm = nsCoreUtils::GetRoleContent(mDocumentNode);
if (mContent != contentElm) {
if (contentElm) {
mContent = contentElm;
SetRoleMapEntry(aria::GetRoleMap(mContent));
}

View File

@ -50,8 +50,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
public:
DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
// nsIScrollPositionListener
virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) override {}

View File

@ -59,9 +59,8 @@ NS_IMPL_ISUPPORTS_INHERITED0(RootAccessible, DocAccessible)
// Constructor/destructor
RootAccessible::
RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessibleWrap(aDocument, aRootContent, aPresShell)
RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessibleWrap(aDocument, aPresShell)
{
mType = eRootType;
}

View File

@ -22,8 +22,7 @@ class RootAccessible : public DocAccessibleWrap,
NS_DECL_ISUPPORTS_INHERITED
public:
RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;

View File

@ -14,8 +14,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
};

View File

@ -10,9 +10,8 @@
using namespace mozilla::a11y;
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessible(aDocument, aRootContent, aPresShell)
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell)
{
}

View File

@ -18,8 +18,7 @@ namespace a11y {
class RootAccessibleWrap : public RootAccessible
{
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
Class GetNativeType ();

View File

@ -16,9 +16,8 @@
using namespace mozilla::a11y;
RootAccessibleWrap::
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
RootAccessible(aDocument, aRootContent, aPresShell)
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
RootAccessible(aDocument, aPresShell)
{
}

View File

@ -25,9 +25,8 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
DocAccessibleWrap::
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
DocAccessible(aDocument, aRootContent, aPresShell), mHWND(nullptr)
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
DocAccessible(aDocument, aPresShell), mHWND(nullptr)
{
}

View File

@ -15,8 +15,7 @@ namespace a11y {
class DocAccessibleWrap : public DocAccessible
{
public:
DocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~DocAccessibleWrap();
DECL_IUNKNOWN_INHERITED

View File

@ -15,9 +15,8 @@ using namespace mozilla::a11y;
// Constructor/desctructor
RootAccessibleWrap::
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
RootAccessible(aDocument, aRootContent, aPresShell)
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) :
RootAccessible(aDocument, aPresShell)
{
}

View File

@ -14,8 +14,7 @@ namespace a11y {
class RootAccessibleWrap : public RootAccessible
{
public:
RootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell);
virtual ~RootAccessibleWrap();
// RootAccessible