diff --git a/accessible/src/base/nsAccDocManager.cpp b/accessible/src/base/DocManager.cpp similarity index 83% rename from accessible/src/base/nsAccDocManager.cpp rename to accessible/src/base/DocManager.cpp index 0317bfdbe0fc..67bcaca2f5d7 100644 --- a/accessible/src/base/nsAccDocManager.cpp +++ b/accessible/src/base/DocManager.cpp @@ -3,7 +3,7 @@ * 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 "nsAccDocManager.h" +#include "DocManager.h" #include "Accessible-inl.h" #include "ApplicationAccessible.h" @@ -33,14 +33,14 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager +// DocManager //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager public +// DocManager public DocAccessible* -nsAccDocManager::GetDocAccessible(nsIDocument *aDocument) +DocManager::GetDocAccessible(nsIDocument* aDocument) { if (!aDocument) return nullptr; @@ -56,7 +56,7 @@ nsAccDocManager::GetDocAccessible(nsIDocument *aDocument) } Accessible* -nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const +DocManager::FindAccessibleInCache(nsINode* aNode) const { nsSearchAccessibleInCacheArg arg; arg.mNode = aNode; @@ -69,7 +69,7 @@ nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const #ifdef DEBUG bool -nsAccDocManager::IsProcessingRefreshDriverNotification() const +DocManager::IsProcessingRefreshDriverNotification() const { bool isDocRefreshing = false; mDocAccessibleCache.EnumerateRead(SearchIfDocIsRefreshing, @@ -81,10 +81,10 @@ nsAccDocManager::IsProcessingRefreshDriverNotification() const //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager protected +// DocManager protected bool -nsAccDocManager::Init() +DocManager::Init() { mDocAccessibleCache.Init(4); @@ -101,7 +101,7 @@ nsAccDocManager::Init() } void -nsAccDocManager::Shutdown() +DocManager::Shutdown() { nsCOMPtr progress = do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); @@ -115,7 +115,7 @@ nsAccDocManager::Shutdown() //////////////////////////////////////////////////////////////////////////////// // nsISupports -NS_IMPL_THREADSAFE_ISUPPORTS3(nsAccDocManager, +NS_IMPL_THREADSAFE_ISUPPORTS3(DocManager, nsIWebProgressListener, nsIDOMEventListener, nsISupportsWeakReference) @@ -124,9 +124,9 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsAccDocManager, // nsIWebProgressListener NS_IMETHODIMP -nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, uint32_t aStateFlags, - nsresult aStatus) +DocManager::OnStateChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, uint32_t aStateFlags, + nsresult aStatus) { NS_ASSERTION(aStateFlags & STATE_IS_DOCUMENT, "Other notifications excluded"); @@ -203,39 +203,39 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress, } NS_IMETHODIMP -nsAccDocManager::OnProgressChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, - int32_t aCurSelfProgress, - int32_t aMaxSelfProgress, - int32_t aCurTotalProgress, - int32_t aMaxTotalProgress) +DocManager::OnProgressChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + int32_t aCurSelfProgress, + int32_t aMaxSelfProgress, + int32_t aCurTotalProgress, + int32_t aMaxTotalProgress) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP -nsAccDocManager::OnLocationChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, nsIURI *aLocation, - uint32_t aFlags) +DocManager::OnLocationChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, nsIURI* aLocation, + uint32_t aFlags) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP -nsAccDocManager::OnStatusChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) +DocManager::OnStatusChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, nsresult aStatus, + const PRUnichar* aMessage) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; } NS_IMETHODIMP -nsAccDocManager::OnSecurityChange(nsIWebProgress *aWebProgress, - nsIRequest *aRequest, - uint32_t aState) +DocManager::OnSecurityChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + uint32_t aState) { NS_NOTREACHED("notification excluded in AddProgressListener(...)"); return NS_OK; @@ -245,7 +245,7 @@ nsAccDocManager::OnSecurityChange(nsIWebProgress *aWebProgress, // nsIDOMEventListener NS_IMETHODIMP -nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent) +DocManager::HandleEvent(nsIDOMEvent* aEvent) { nsAutoString type; aEvent->GetType(type); @@ -303,11 +303,11 @@ nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent) } //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager private +// DocManager private void -nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument, - uint32_t aLoadEventType) +DocManager::HandleDOMDocumentLoad(nsIDocument* aDocument, + uint32_t aLoadEventType) { // Document accessible can be created before we were notified the DOM document // was loaded completely. However if it's not created yet then create it. @@ -322,8 +322,8 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument, } void -nsAccDocManager::AddListeners(nsIDocument *aDocument, - bool aAddDOMContentLoadedListener) +DocManager::AddListeners(nsIDocument* aDocument, + bool aAddDOMContentLoadedListener) { nsPIDOMWindow *window = aDocument->GetWindow(); nsIDOMEventTarget *target = window->GetChromeEventHandler(); @@ -347,7 +347,7 @@ nsAccDocManager::AddListeners(nsIDocument *aDocument, } DocAccessible* -nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument) +DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument) { // Ignore temporary, hiding, resource documents and documents without // docshell. @@ -419,12 +419,12 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument) } //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager static +// DocManager static PLDHashOperator -nsAccDocManager::GetFirstEntryInDocCache(const nsIDocument* aKey, - DocAccessible* aDocAccessible, - void* aUserArg) +DocManager::GetFirstEntryInDocCache(const nsIDocument* aKey, + DocAccessible* aDocAccessible, + void* aUserArg) { NS_ASSERTION(aDocAccessible, "No doc accessible for the object in doc accessible cache!"); @@ -434,7 +434,7 @@ nsAccDocManager::GetFirstEntryInDocCache(const nsIDocument* aKey, } void -nsAccDocManager::ClearDocCache() +DocManager::ClearDocCache() { DocAccessible* docAcc = nullptr; while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast(&docAcc))) { @@ -444,9 +444,9 @@ nsAccDocManager::ClearDocCache() } PLDHashOperator -nsAccDocManager::SearchAccessibleInDocCache(const nsIDocument* aKey, - DocAccessible* aDocAccessible, - void* aUserArg) +DocManager::SearchAccessibleInDocCache(const nsIDocument* aKey, + DocAccessible* aDocAccessible, + void* aUserArg) { NS_ASSERTION(aDocAccessible, "No doc accessible for the object in doc accessible cache!"); @@ -464,9 +464,9 @@ nsAccDocManager::SearchAccessibleInDocCache(const nsIDocument* aKey, #ifdef DEBUG PLDHashOperator -nsAccDocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey, - DocAccessible* aDocAccessible, - void* aUserArg) +DocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey, + DocAccessible* aDocAccessible, + void* aUserArg) { NS_ASSERTION(aDocAccessible, "No doc accessible for the object in doc accessible cache!"); diff --git a/accessible/src/base/nsAccDocManager.h b/accessible/src/base/DocManager.h similarity index 87% rename from accessible/src/base/nsAccDocManager.h rename to accessible/src/base/DocManager.h index c60b3ef95843..2cdb5207447d 100644 --- a/accessible/src/base/nsAccDocManager.h +++ b/accessible/src/base/DocManager.h @@ -2,8 +2,8 @@ * 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/. */ -#ifndef nsAccDocManager_h_ -#define nsAccDocManager_h_ +#ifndef mozilla_a11_DocManager_h_ +#define mozilla_a11_DocManager_h_ #include "nsIDocument.h" #include "nsIDOMEventListener.h" @@ -19,21 +19,15 @@ namespace a11y { class Accessible; class DocAccessible; -} // namespace a11y -} // namespace mozilla - /** * Manage the document accessible life cycle. */ -class nsAccDocManager : public nsIWebProgressListener, - public nsIDOMEventListener, - public nsSupportsWeakReference +class DocManager : public nsIWebProgressListener, + public nsIDOMEventListener, + public nsSupportsWeakReference { public: - typedef mozilla::a11y::Accessible Accessible; - typedef mozilla::a11y::DocAccessible DocAccessible; - - virtual ~nsAccDocManager() { } + virtual ~DocManager() { } NS_DECL_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER @@ -86,7 +80,7 @@ public: #endif protected: - nsAccDocManager() { } + DocManager() { } /** * Initialize the manager. @@ -99,8 +93,8 @@ protected: void Shutdown(); private: - nsAccDocManager(const nsAccDocManager&); - nsAccDocManager& operator =(const nsAccDocManager&); + DocManager(const DocManager&); + DocManager& operator =(const DocManager&); private: /** @@ -160,4 +154,7 @@ private: DocAccessibleHashtable mDocAccessibleCache; }; -#endif // nsAccDocManager_h_ +} // namespace a11y +} // namespace mozilla + +#endif // mozilla_a11_DocManager_h_ diff --git a/accessible/src/base/Makefile.in b/accessible/src/base/Makefile.in index b29b53fcf241..1d65fcca5c13 100644 --- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -21,9 +21,9 @@ CPPSRCS = \ AccIterator.cpp \ Filters.cpp \ ARIAStateMap.cpp \ + DocManager.cpp \ FocusManager.cpp \ NotificationController.cpp \ - nsAccDocManager.cpp \ nsAccessNode.cpp \ nsARIAMap.cpp \ nsCoreUtils.cpp \ @@ -48,7 +48,6 @@ endif EXPORTS = \ AccEvent.h \ - nsAccDocManager.h \ nsAccessibilityService.h \ nsAccessNode.h \ $(NULL) @@ -56,6 +55,7 @@ EXPORTS = \ EXPORTS_NAMESPACES = mozilla/a11y EXPORTS_mozilla/a11y = \ + DocManager.h \ FocusManager.h \ AccTypes.h \ States.h \ diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 5a562217a34f..6c8914a4cc48 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -125,7 +125,7 @@ ApplicationAccessible* nsAccessibilityService::gApplicationAccessible = nullptr; bool nsAccessibilityService::gIsShutdown = true; nsAccessibilityService::nsAccessibilityService() : - nsAccDocManager(), FocusManager() + DocManager(), FocusManager() { } @@ -139,7 +139,7 @@ nsAccessibilityService::~nsAccessibilityService() // nsISupports NS_IMPL_ISUPPORTS_INHERITED3(nsAccessibilityService, - nsAccDocManager, + DocManager, nsIAccessibilityService, nsIAccessibleRetrieval, nsIObserver) @@ -621,7 +621,7 @@ nsAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode, // caches. If we don't find it, and the given node is itself a document, check // our cache of document accessibles (document cache). Note usually shutdown // document accessibles are not stored in the document cache, however an - // "unofficially" shutdown document (i.e. not from nsAccDocManager) can still + // "unofficially" shutdown document (i.e. not from DocManager) can still // exist in the document cache. Accessible* accessible = FindAccessibleInCache(node); if (!accessible) { @@ -975,7 +975,7 @@ bool nsAccessibilityService::Init() { // Initialize accessible document manager. - if (!nsAccDocManager::Init()) + if (!DocManager::Init()) return false; // Add observers. @@ -1026,7 +1026,7 @@ nsAccessibilityService::Shutdown() } // Stop accessible document loader. - nsAccDocManager::Shutdown(); + DocManager::Shutdown(); // Application is going to be closed, shutdown accessibility and mark // accessibility service as shutdown to prevent calls of its methods. diff --git a/accessible/src/base/nsAccessibilityService.h b/accessible/src/base/nsAccessibilityService.h index 3d6cb2cf8207..061f1151d2d9 100644 --- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -8,8 +8,7 @@ #include "nsIAccessibilityService.h" -#include "nsAccDocManager.h" - +#include "mozilla/a11y/DocManager.h" #include "mozilla/a11y/FocusManager.h" #include "nsIObserver.h" @@ -64,12 +63,15 @@ bool ShouldA11yBeEnabled(); } // namespace a11y } // namespace mozilla -class nsAccessibilityService : public nsAccDocManager, +class nsAccessibilityService : public mozilla::a11y::DocManager, public mozilla::a11y::FocusManager, public nsIAccessibilityService, public nsIObserver { public: + typedef mozilla::a11y::Accessible Accessible; + typedef mozilla::a11y::DocAccessible DocAccessible; + virtual ~nsAccessibilityService(); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index 4b4b4c1dc782..634b3675cc97 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -96,7 +96,7 @@ DocAccessible:: if (!mDocument) return; - // nsAccDocManager creates document accessible when scrollable frame is + // DocManager creates document accessible when scrollable frame is // available already, it should be safe time to add scroll listener. AddScrollListener(); diff --git a/accessible/src/generic/DocAccessible.h b/accessible/src/generic/DocAccessible.h index 8b8fbf9dd85f..6d60c787ef86 100644 --- a/accessible/src/generic/DocAccessible.h +++ b/accessible/src/generic/DocAccessible.h @@ -24,7 +24,6 @@ #include "nsIWeakReference.h" #include "nsIDocShellTreeNode.h" -class nsAccDocManager; class nsAccessiblePivot; class nsIScrollableView; @@ -34,6 +33,7 @@ const uint32_t kDefaultCacheSize = 256; namespace mozilla { namespace a11y { +class DocManager; class NotificationController; class RelatedAccIterator; template @@ -319,7 +319,7 @@ protected: void NotifyOfLoad(uint32_t aLoadEventType); void NotifyOfLoading(bool aIsReloading); - friend class ::nsAccDocManager; + friend class DocManager; /** * Perform initial update (create accessible tree). diff --git a/accessible/src/generic/OuterDocAccessible.cpp b/accessible/src/generic/OuterDocAccessible.cpp index eda45e6c9670..d10496f0ec49 100644 --- a/accessible/src/generic/OuterDocAccessible.cpp +++ b/accessible/src/generic/OuterDocAccessible.cpp @@ -135,13 +135,13 @@ OuterDocAccessible::Shutdown() void OuterDocAccessible::InvalidateChildren() { - // Do not invalidate children because nsAccDocManager is responsible for + // Do not invalidate children because DocManager is responsible for // document accessible lifetime when DOM document is created or destroyed. If // DOM document isn't destroyed but its presshell is destroyed (for example, // when DOM node of outerdoc accessible is hidden), then outerdoc accessible - // notifies nsAccDocManager about this. If presshell is created for existing + // notifies DocManager about this. If presshell is created for existing // DOM document (for example when DOM node of outerdoc accessible is shown) - // then allow nsAccDocManager to handle this case since the document + // then allow DocManager to handle this case since the document // accessible is created and appended as a child when it's requested. SetChildrenFlag(eChildrenUninitialized);