diff --git a/accessible/src/base/nsAccDocManager.h b/accessible/src/base/nsAccDocManager.h index c61414f2110..9d019eed5a6 100644 --- a/accessible/src/base/nsAccDocManager.h +++ b/accessible/src/base/nsAccDocManager.h @@ -40,7 +40,14 @@ public: */ DocAccessible* GetDocAccessible(const nsIPresShell* aPresShell) { - return aPresShell ? GetDocAccessible(aPresShell->GetDocument()) : nullptr; + if (!aPresShell) + return nullptr; + + DocAccessible* doc = aPresShell->GetDocAccessible(); + if (doc) + return doc; + + return GetDocAccessible(aPresShell->GetDocument()); } /** diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index f265a904429..3be2f6886e6 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -86,7 +86,7 @@ DocAccessible:: { mFlags |= eDocAccessible | eNotNodeMapEntry; if (mPresShell) - mPresShell->SetAccDocument(this); + mPresShell->SetDocAccessible(this); mDependentIDsHash.Init(); // XXX aaronl should we use an algorithm for the initial cache size? @@ -636,7 +636,7 @@ DocAccessible::Shutdown() logging::DocDestroy("document shutdown", mDocument, this); #endif - mPresShell->SetAccDocument(nullptr); + mPresShell->SetDocAccessible(nullptr); if (mNotificationController) { mNotificationController->Shutdown(); diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index d5da2665dd8..b4878ef16fe 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -277,9 +277,20 @@ public: nsIViewManager* GetViewManager() const { return mViewManager; } #ifdef ACCESSIBILITY - void SetAccDocument(DocAccessible* aAccDocument) + /** + * Return the document accessible for this pres shell if there is one. + */ + DocAccessible* GetDocAccessible() const { - mAccDocument = aAccDocument; + return mDocAccessible; + } + + /** + * Set the document accessible for this pres shell. + */ + void SetDocAccessible(DocAccessible* aDocAccessible) + { + mDocAccessible = aDocAccessible; } #endif @@ -1371,7 +1382,7 @@ protected: nsWeakPtr mForwardingContainer; nsRefreshDriver* mHiddenInvalidationObserverRefreshDriver; #ifdef ACCESSIBILITY - DocAccessible* mAccDocument; + DocAccessible* mDocAccessible; #endif #ifdef DEBUG diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 04323b9d9e3..7c5318d7c02 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -937,14 +937,14 @@ PresShell::Destroy() return; #ifdef ACCESSIBILITY - if (mAccDocument) { + if (mDocAccessible) { #ifdef DEBUG if (a11y::logging::IsEnabled(a11y::logging::eDocDestroy)) a11y::logging::DocDestroy("presshell destroyed", mDocument); #endif - mAccDocument->Shutdown(); - mAccDocument = nullptr; + mDocAccessible->Shutdown(); + mDocAccessible = nullptr; } #endif // ACCESSIBILITY