author | Alexander Surkov <surkov.alexander@gmail.com> |
Tue, 20 Nov 2012 23:15:32 +0900 | |
changeset 113768 | 5662d8cc819b38e417c101088e113be35868bacf |
parent 113767 | fb1af8ca910e747c5d2c3accb1c1e22e72462e9e |
child 113769 | ce04cb1af0a0eb1e510ef9db34a3593def8bc8a1 |
push id | 23890 |
push user | ryanvm@gmail.com |
push date | Wed, 21 Nov 2012 02:43:32 +0000 |
treeherder | mozilla-central@4f19e7fd8bea [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | tbsaunde |
bugs | 812844 |
milestone | 20.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
rename from accessible/src/base/nsAccDocManager.cpp rename to accessible/src/base/DocManager.cpp --- a/accessible/src/base/nsAccDocManager.cpp +++ b/accessible/src/base/DocManager.cpp @@ -1,14 +1,14 @@ /* -*- 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 "nsAccDocManager.h" +#include "DocManager.h" #include "Accessible-inl.h" #include "ApplicationAccessible.h" #include "DocAccessible-inl.h" #include "nsAccessibilityService.h" #include "nsAccUtils.h" #include "nsARIAMap.h" #include "RootAccessibleWrap.h" @@ -28,110 +28,110 @@ #include "nsIDOMWindow.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIWebNavigation.h" #include "nsServiceManagerUtils.h" using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager +// DocManager //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager public +// DocManager public DocAccessible* -nsAccDocManager::GetDocAccessible(nsIDocument *aDocument) +DocManager::GetDocAccessible(nsIDocument* aDocument) { if (!aDocument) return nullptr; // Ensure CacheChildren is called before we query cache. ApplicationAcc()->EnsureChildren(); DocAccessible* docAcc = mDocAccessibleCache.GetWeak(aDocument); if (docAcc) return docAcc; return CreateDocOrRootAccessible(aDocument); } Accessible* -nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const +DocManager::FindAccessibleInCache(nsINode* aNode) const { nsSearchAccessibleInCacheArg arg; arg.mNode = aNode; mDocAccessibleCache.EnumerateRead(SearchAccessibleInDocCache, static_cast<void*>(&arg)); return arg.mAccessible; } #ifdef DEBUG bool -nsAccDocManager::IsProcessingRefreshDriverNotification() const +DocManager::IsProcessingRefreshDriverNotification() const { bool isDocRefreshing = false; mDocAccessibleCache.EnumerateRead(SearchIfDocIsRefreshing, static_cast<void*>(&isDocRefreshing)); return isDocRefreshing; } #endif //////////////////////////////////////////////////////////////////////////////// -// nsAccDocManager protected +// DocManager protected bool -nsAccDocManager::Init() +DocManager::Init() { mDocAccessibleCache.Init(4); nsCOMPtr<nsIWebProgress> progress = do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (!progress) return false; progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this), nsIWebProgress::NOTIFY_STATE_DOCUMENT); return true; } void -nsAccDocManager::Shutdown() +DocManager::Shutdown() { nsCOMPtr<nsIWebProgress> progress = do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID); if (progress) progress->RemoveProgressListener(static_cast<nsIWebProgressListener*>(this)); ClearDocCache(); } //////////////////////////////////////////////////////////////////////////////// // nsISupports -NS_IMPL_THREADSAFE_ISUPPORTS3(nsAccDocManager, +NS_IMPL_THREADSAFE_ISUPPORTS3(DocManager, nsIWebProgressListener, nsIDOMEventListener, nsISupportsWeakReference) //////////////////////////////////////////////////////////////////////////////// // 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"); if (nsAccessibilityService::IsShutdown() || !aWebProgress || (aStateFlags & (STATE_START | STATE_STOP)) == 0) return NS_OK; nsCOMPtr<nsIDOMWindow> DOMWindow; @@ -198,59 +198,59 @@ nsAccDocManager::OnStateChange(nsIWebPro isReloading = true; } docAcc->NotifyOfLoading(isReloading); return NS_OK; } 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; } //////////////////////////////////////////////////////////////////////////////// // nsIDOMEventListener NS_IMETHODIMP -nsAccDocManager::HandleEvent(nsIDOMEvent *aEvent) +DocManager::HandleEvent(nsIDOMEvent* aEvent) { nsAutoString type; aEvent->GetType(type); nsCOMPtr<nsIDOMEventTarget> target; aEvent->GetTarget(getter_AddRefs(target)); nsCOMPtr<nsIDocument> document(do_QueryInterface(target)); @@ -298,37 +298,37 @@ nsAccDocManager::HandleEvent(nsIDOMEvent HandleDOMDocumentLoad(document, nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE); } return NS_OK; } //////////////////////////////////////////////////////////////////////////////// -// 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. DocAccessible* docAcc = mDocAccessibleCache.GetWeak(aDocument); if (!docAcc) { docAcc = CreateDocOrRootAccessible(aDocument); if (!docAcc) return; } docAcc->NotifyOfLoad(aLoadEventType); } void -nsAccDocManager::AddListeners(nsIDocument *aDocument, - bool aAddDOMContentLoadedListener) +DocManager::AddListeners(nsIDocument* aDocument, + bool aAddDOMContentLoadedListener) { nsPIDOMWindow *window = aDocument->GetWindow(); nsIDOMEventTarget *target = window->GetChromeEventHandler(); nsEventListenerManager* elm = target->GetListenerManager(true); elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"), NS_EVENT_FLAG_CAPTURE); #ifdef A11Y_LOG @@ -342,17 +342,17 @@ nsAccDocManager::AddListeners(nsIDocumen #ifdef A11Y_LOG if (logging::IsEnabled(logging::eDocCreate)) logging::Text("added 'DOMContentLoaded' listener"); #endif } } DocAccessible* -nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument) +DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument) { // Ignore temporary, hiding, resource documents and documents without // docshell. if (aDocument->IsInitialDocument() || !aDocument->IsVisible() || aDocument->IsResourceDoc() || !aDocument->IsActive()) return nullptr; // Ignore documents without presshell and not having root frame. @@ -414,44 +414,44 @@ nsAccDocManager::CreateDocOrRootAccessib } #endif AddListeners(aDocument, isRootDoc); return docAcc; } //////////////////////////////////////////////////////////////////////////////// -// 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!"); *reinterpret_cast<DocAccessible**>(aUserArg) = aDocAccessible; return PL_DHASH_STOP; } void -nsAccDocManager::ClearDocCache() +DocManager::ClearDocCache() { DocAccessible* docAcc = nullptr; while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast<void*>(&docAcc))) { if (docAcc) docAcc->Shutdown(); } } 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!"); if (aDocAccessible) { nsSearchAccessibleInCacheArg* arg = static_cast<nsSearchAccessibleInCacheArg*>(aUserArg); arg->mAccessible = aDocAccessible->GetAccessible(arg->mNode); @@ -459,19 +459,19 @@ nsAccDocManager::SearchAccessibleInDocCa return PL_DHASH_STOP; } return PL_DHASH_NEXT; } #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!"); if (aDocAccessible && aDocAccessible->mNotificationController && aDocAccessible->mNotificationController->IsUpdating()) { *(static_cast<bool*>(aUserArg)) = true; return PL_DHASH_STOP;
rename from accessible/src/base/nsAccDocManager.h rename to accessible/src/base/DocManager.h --- a/accessible/src/base/nsAccDocManager.h +++ b/accessible/src/base/DocManager.h @@ -1,44 +1,38 @@ /* 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/. */ -#ifndef nsAccDocManager_h_ -#define nsAccDocManager_h_ +#ifndef mozilla_a11_DocManager_h_ +#define mozilla_a11_DocManager_h_ #include "nsIDocument.h" #include "nsIDOMEventListener.h" #include "nsRefPtrHashtable.h" #include "nsIWebProgress.h" #include "nsIWebProgressListener.h" #include "nsWeakReference.h" #include "nsIPresShell.h" namespace mozilla { 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 NS_DECL_NSIDOMEVENTLISTENER /** * Return document accessible for the given DOM node. */ @@ -81,31 +75,31 @@ public: mDocAccessibleCache.Remove(aDocument); } #ifdef DEBUG bool IsProcessingRefreshDriverNotification() const; #endif protected: - nsAccDocManager() { } + DocManager() { } /** * Initialize the manager. */ bool Init(); /** * Shutdown the manager. */ void Shutdown(); private: - nsAccDocManager(const nsAccDocManager&); - nsAccDocManager& operator =(const nsAccDocManager&); + DocManager(const DocManager&); + DocManager& operator =(const DocManager&); private: /** * Create an accessible document if it was't created and fire accessibility * events if needed. * * @param aDocument [in] loaded DOM document * @param aLoadEventType [in] specifies the event type to fire load event, @@ -155,9 +149,12 @@ private: static PLDHashOperator SearchIfDocIsRefreshing(const nsIDocument* aKey, DocAccessible* aDocAccessible, void* aUserArg); #endif DocAccessibleHashtable mDocAccessibleCache; }; -#endif // nsAccDocManager_h_ +} // namespace a11y +} // namespace mozilla + +#endif // mozilla_a11_DocManager_h_
--- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -16,19 +16,19 @@ LIBXUL_LIBRARY = 1 CPPSRCS = \ AccCollector.cpp \ AccEvent.cpp \ AccGroupInfo.cpp \ AccIterator.cpp \ Filters.cpp \ ARIAStateMap.cpp \ + DocManager.cpp \ FocusManager.cpp \ NotificationController.cpp \ - nsAccDocManager.cpp \ nsAccessNode.cpp \ nsARIAMap.cpp \ nsCoreUtils.cpp \ nsAccUtils.cpp \ nsAccessibilityService.cpp \ nsAccessiblePivot.cpp \ nsEventShell.cpp \ nsCaretAccessible.cpp \ @@ -43,24 +43,24 @@ CPPSRCS = \ ifneq ($(A11Y_LOG),0) CPPSRCS += \ Logging.cpp \ $(NULL) endif EXPORTS = \ AccEvent.h \ - nsAccDocManager.h \ nsAccessibilityService.h \ nsAccessNode.h \ $(NULL) EXPORTS_NAMESPACES = mozilla/a11y EXPORTS_mozilla/a11y = \ + DocManager.h \ FocusManager.h \ AccTypes.h \ States.h \ Role.h \ $(NULL) ifdef MOZ_DEBUG EXPORTS_mozilla/a11y += \
--- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -120,31 +120,31 @@ MustBeAccessible(nsIContent* aContent, D // nsAccessibilityService //////////////////////////////////////////////////////////////////////////////// nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nullptr; ApplicationAccessible* nsAccessibilityService::gApplicationAccessible = nullptr; bool nsAccessibilityService::gIsShutdown = true; nsAccessibilityService::nsAccessibilityService() : - nsAccDocManager(), FocusManager() + DocManager(), FocusManager() { } nsAccessibilityService::~nsAccessibilityService() { NS_ASSERTION(gIsShutdown, "Accessibility wasn't shutdown!"); gAccessibilityService = nullptr; } //////////////////////////////////////////////////////////////////////////////// // nsISupports NS_IMPL_ISUPPORTS_INHERITED3(nsAccessibilityService, - nsAccDocManager, + DocManager, nsIAccessibilityService, nsIAccessibleRetrieval, nsIObserver) //////////////////////////////////////////////////////////////////////////////// // nsIObserver NS_IMETHODIMP @@ -616,17 +616,17 @@ nsAccessibilityService::GetAccessibleFro nsCOMPtr<nsINode> node(do_QueryInterface(aNode)); if (!node) return NS_ERROR_INVALID_ARG; // Search for an accessible in each of our per document accessible object // 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) { nsCOMPtr<nsIDocument> document(do_QueryInterface(node)); if (document) accessible = GetDocAccessibleFromCache(document); } @@ -970,17 +970,17 @@ nsAccessibilityService::GetOrCreateAcces //////////////////////////////////////////////////////////////////////////////// // nsAccessibilityService private bool nsAccessibilityService::Init() { // Initialize accessible document manager. - if (!nsAccDocManager::Init()) + if (!DocManager::Init()) return false; // Add observers. nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); if (!observerService) return false; @@ -1021,17 +1021,17 @@ nsAccessibilityService::Shutdown() if (observerService) { observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); static const PRUnichar kShutdownIndicator[] = { '0', 0 }; observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kShutdownIndicator); } // 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. // Don't null accessibility service static member at this point to be safe // if someone will try to operate with it. NS_ASSERTION(!gIsShutdown, "Accessibility was shutdown already");
--- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -3,18 +3,17 @@ * 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 __nsAccessibilityService_h__ #define __nsAccessibilityService_h__ #include "nsIAccessibilityService.h" -#include "nsAccDocManager.h" - +#include "mozilla/a11y/DocManager.h" #include "mozilla/a11y/FocusManager.h" #include "nsIObserver.h" class nsImageFrame; class nsObjectFrame; class nsITreeView; @@ -59,22 +58,25 @@ void PreInit(); * Only used on linux with atk and MacOS for now. */ bool ShouldA11yBeEnabled(); #endif } // 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 NS_DECL_NSIACCESSIBLERETRIEVAL NS_DECL_NSIOBSERVER // nsIAccessibilityService virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
--- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -91,17 +91,17 @@ DocAccessible:: // If this is a XUL Document, it should not implement nsHyperText if (mDocument && mDocument->IsXUL()) mFlags &= ~eHyperTextAccessible; // For GTK+ native window, we do nothing here. 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(); // We provide a virtual cursor if this is a root doc or if it's a tab doc. mIsCursorable = (!(mDocument->GetParentDocument()) || nsCoreUtils::IsTabDocument(mDocument)); }
--- a/accessible/src/generic/DocAccessible.h +++ b/accessible/src/generic/DocAccessible.h @@ -19,26 +19,26 @@ #include "nsIDocumentObserver.h" #include "nsIEditor.h" #include "nsIObserver.h" #include "nsIScrollPositionListener.h" #include "nsITimer.h" #include "nsIWeakReference.h" #include "nsIDocShellTreeNode.h" -class nsAccDocManager; class nsAccessiblePivot; class nsIScrollableView; const uint32_t kDefaultCacheSize = 256; namespace mozilla { namespace a11y { +class DocManager; class NotificationController; class RelatedAccIterator; template<class Class, class Arg> class TNotification; class DocAccessible : public HyperTextAccessibleWrap, public nsIAccessibleDocument, public nsIDocumentObserver, @@ -314,17 +314,17 @@ protected: virtual nsresult RemoveEventListeners(); /** * Marks this document as loaded or loading. */ void NotifyOfLoad(uint32_t aLoadEventType); void NotifyOfLoading(bool aIsReloading); - friend class ::nsAccDocManager; + friend class DocManager; /** * Perform initial update (create accessible tree). * Can be overridden by wrappers to prepare initialization work. */ virtual void DoInitialUpdate(); /**
--- a/accessible/src/generic/OuterDocAccessible.cpp +++ b/accessible/src/generic/OuterDocAccessible.cpp @@ -130,23 +130,23 @@ OuterDocAccessible::Shutdown() } //////////////////////////////////////////////////////////////////////////////// // Accessible public 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); } bool OuterDocAccessible::AppendChild(Accessible* aAccessible) {