зеркало из https://github.com/mozilla/gecko-dev.git
bug 765252 - ensure PresShell::Destroy() always shutsdown the related accessible document r=bz, davidb
This commit is contained in:
Родитель
18314255da
Коммит
124602d44c
|
@ -40,6 +40,13 @@ EXPORTS = \
|
|||
nsAccessNodeWrap.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/a11y
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
AccessibleWrap.h \
|
||||
HyperTextAccessibleWrap.h \
|
||||
$(null)
|
||||
|
||||
# we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
#include "Accessible.h"
|
||||
#include "mozilla/a11y/Accessible.h"
|
||||
|
||||
class nsAccEvent;
|
||||
class DocAccessible;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "DocAccessible-inl.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ endif
|
|||
|
||||
EXPORTS = \
|
||||
a11yGeneric.h \
|
||||
AccEvent.h \
|
||||
nsAccDocManager.h \
|
||||
nsAccessibilityService.h \
|
||||
nsAccessNode.h \
|
||||
|
@ -61,6 +62,12 @@ EXPORTS_mozilla/a11y = \
|
|||
Role.h \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_DEBUG
|
||||
EXPORTS_mozilla/a11y += \
|
||||
Logging.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "TextUpdater.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "DocAccessible-inl.h"
|
||||
#include "TextLeafAccessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsAccessiblePivot.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsARIAMap.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsIAccessibleProvider.h"
|
||||
#include "nsXFormsFormControlsAccessible.h"
|
||||
#include "nsXFormsWidgetsAccessible.h"
|
||||
|
@ -569,31 +570,6 @@ nsAccessibilityService::UpdateImageMap(nsImageFrame* aImageFrame)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessibilityService::PresShellDestroyed(nsIPresShell *aPresShell)
|
||||
{
|
||||
// Presshell destruction will automatically destroy shells for descendant
|
||||
// documents, so no need to worry about those. Just shut down the accessible
|
||||
// for this one document. That keeps us from having bad behavior in case of
|
||||
// deep bushy subtrees.
|
||||
// When document subtree containing iframe is hidden then we don't get
|
||||
// pagehide event for the iframe's underlying document and its presshell is
|
||||
// destroyed before we're notified styles were changed. Shutdown the document
|
||||
// accessible early.
|
||||
nsIDocument* doc = aPresShell->GetDocument();
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (logging::IsEnabled(logging::eDocDestroy))
|
||||
logging::DocDestroy("presshell destroyed", doc);
|
||||
#endif
|
||||
|
||||
DocAccessible* docAccessible = GetDocAccessibleFromCache(doc);
|
||||
if (docAccessible)
|
||||
docAccessible->Shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
nsAccessibilityService::PresShellActivated(nsIPresShell* aPresShell)
|
||||
{
|
||||
|
|
|
@ -168,12 +168,6 @@ public:
|
|||
*/
|
||||
void NotifyOfAnchorJumpTo(nsIContent *aTarget);
|
||||
|
||||
/**
|
||||
* Notify the accessibility service that the given presshell is
|
||||
* being destroyed.
|
||||
*/
|
||||
void PresShellDestroyed(nsIPresShell* aPresShell);
|
||||
|
||||
/**
|
||||
* Notify that presshell is activated.
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "nsIXBLAccessible.h"
|
||||
|
||||
#include "AccCollector.h"
|
||||
#include "AccGroupInfo.h"
|
||||
#include "AccIterator.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
|
|
@ -39,4 +39,17 @@ DocAccessible::UpdateText(nsIContent* aTextNode)
|
|||
mNotificationController->ScheduleTextUpdate(aTextNode);
|
||||
}
|
||||
|
||||
inline void
|
||||
DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
|
||||
{
|
||||
mozilla::a11y::role role = aAccessible->Role();
|
||||
if (role == mozilla::a11y::roles::ENTRY ||
|
||||
role == mozilla::a11y::roles::COMBOBOX) {
|
||||
nsRefPtr<AccEvent> valueChangeEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
|
||||
eAutoDetect, AccEvent::eRemoveDupes);
|
||||
FireDelayedAccessibleEvent(valueChangeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsAccessiblePivot.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
|
@ -84,6 +85,7 @@ DocAccessible::
|
|||
mPresShell(aPresShell)
|
||||
{
|
||||
mFlags |= eDocAccessible;
|
||||
mPresShell->SetAccDocument(this);
|
||||
|
||||
mDependentIDsHash.Init();
|
||||
// XXX aaronl should we use an algorithm for the initial cache size?
|
||||
|
@ -635,6 +637,8 @@ DocAccessible::Shutdown()
|
|||
logging::DocDestroy("document shutdown", mDocument, this);
|
||||
#endif
|
||||
|
||||
mPresShell->SetAccDocument(nsnull);
|
||||
|
||||
if (mNotificationController) {
|
||||
mNotificationController->Shutdown();
|
||||
mNotificationController = nsnull;
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessiblePivot.h"
|
||||
|
||||
#include "AccEvent.h"
|
||||
#include "HyperTextAccessibleWrap.h"
|
||||
#include "nsEventShell.h"
|
||||
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
@ -190,17 +190,7 @@ public:
|
|||
/**
|
||||
* Fire value change event on the given accessible if applicable.
|
||||
*/
|
||||
void MaybeNotifyOfValueChange(Accessible* aAccessible)
|
||||
{
|
||||
mozilla::a11y::role role = aAccessible->Role();
|
||||
if (role == mozilla::a11y::roles::ENTRY ||
|
||||
role == mozilla::a11y::roles::COMBOBOX) {
|
||||
nsRefPtr<AccEvent> valueChangeEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
|
||||
eAutoDetect, AccEvent::eRemoveDupes);
|
||||
FireDelayedAccessibleEvent(valueChangeEvent);
|
||||
}
|
||||
}
|
||||
void MaybeNotifyOfValueChange(Accessible* aAccessible);
|
||||
|
||||
/**
|
||||
* Get/set the anchor jump.
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsIAccessibleHyperText.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
|
||||
#include "AccCollector.h"
|
||||
#include "AccessibleWrap.h"
|
||||
|
||||
#include "nsFrameSelection.h"
|
||||
|
|
|
@ -32,6 +32,8 @@ EXPORTS_NAMESPACES = mozilla/a11y
|
|||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
Accessible.h \
|
||||
DocAccessible.h \
|
||||
HyperTextAccessible.h \
|
||||
$(null)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "Accessible-inl.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsARIAMap.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <objc/objc.h>
|
||||
|
||||
#include "Accessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "nsObjCExceptions.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "Role.h"
|
||||
|
||||
#import "mozAccessible.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "ApplicationAccessibleWrap.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
#include "nsAppShell.h"
|
||||
|
||||
|
|
|
@ -33,6 +33,13 @@ EXPORTS = \
|
|||
mozAccessibleProtocol.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/a11y
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
AccessibleWrap.h \
|
||||
HyperTextAccessibleWrap.h \
|
||||
$(null)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "Compatibility.h"
|
||||
#include "DocAccessibleWrap.h"
|
||||
#include "ISimpleDOMDocument_i.c"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "Role.h"
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include "ISimpleDOMDocument.h"
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
||||
|
|
|
@ -52,9 +52,23 @@ CPPSRCS += \
|
|||
endif
|
||||
|
||||
EXPORTS = \
|
||||
CAccessibleValue.h \
|
||||
ia2AccessibleAction.h \
|
||||
ia2AccessibleComponent.h \
|
||||
ia2AccessibleEditableText.h \
|
||||
ia2AccessibleHyperlink.h \
|
||||
ia2AccessibleHypertext.h \
|
||||
ia2AccessibleText.h \
|
||||
nsAccessNodeWrap.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/a11y \
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
AccessibleWrap.h \
|
||||
HyperTextAccessibleWrap.h \
|
||||
$(null)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -20,6 +20,17 @@ CPPSRCS = \
|
|||
AccessibleWrap.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsAccessNodeWrap.h \
|
||||
$(null)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/a11y
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
AccessibleWrap.h \
|
||||
HyperTextAccessibleWrap.h \
|
||||
$(null)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "nsAccCache.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
|
|
|
@ -76,6 +76,7 @@ class nsRefreshDriver;
|
|||
class nsARefreshObserver;
|
||||
#ifdef ACCESSIBILITY
|
||||
class nsAccessibilityService;
|
||||
class DocAccessible;
|
||||
#endif
|
||||
class nsIWidget;
|
||||
struct nsArenaMemoryStats;
|
||||
|
@ -275,6 +276,13 @@ public:
|
|||
|
||||
nsIViewManager* GetViewManager() const { return mViewManager; }
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
void SetAccDocument(DocAccessible* aAccDocument)
|
||||
{
|
||||
mAccDocument = aAccDocument;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
nsStyleSet* StyleSet() const { return mStyleSet; }
|
||||
|
||||
|
@ -1323,6 +1331,9 @@ protected:
|
|||
// GetRootFrame() can be inlined:
|
||||
nsFrameManagerBase* mFrameManager;
|
||||
nsWeakPtr mForwardingContainer;
|
||||
#ifdef ACCESSIBILITY
|
||||
DocAccessible* mAccDocument;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
nsIFrame* mDrawEventTargetFrame;
|
||||
|
|
|
@ -139,6 +139,10 @@
|
|||
#include "nsITimer.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "mozilla/a11y/DocAccessible.h"
|
||||
#ifdef DEBUG
|
||||
#include "mozilla/a11y/Logging.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// For style data reconstruction
|
||||
|
@ -906,9 +910,14 @@ PresShell::Destroy()
|
|||
return;
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
nsAccessibilityService* accService = AccService();
|
||||
if (accService) {
|
||||
accService->PresShellDestroyed(this);
|
||||
if (mAccDocument) {
|
||||
#ifdef DEBUG
|
||||
if (a11y::logging::IsEnabled(a11y::logging::eDocDestroy))
|
||||
a11y::logging::DocDestroy("presshell destroyed", mDocument);
|
||||
#endif
|
||||
|
||||
mAccDocument->Shutdown();
|
||||
mAccDocument = nsnull;
|
||||
}
|
||||
#endif // ACCESSIBILITY
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче