Bug 391846. Fire correct text change events when a node is shown or hidden. r=surkov, sr=sicking, a=sicking

This commit is contained in:
2007-08-28 14:57:53 -07:00
parent 54ba95e4f8
commit 55ba34ee6f
13 changed files with 214 additions and 162 deletions

View File

@@ -125,6 +125,11 @@
#include "nsIXULDocument.h"
#endif /* MOZ_XUL */
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"
#include "nsIAccessibleEvent.h"
#endif /* ACCESSIBILITY */
#include "nsCycleCollectionParticipant.h"
#include "nsCCUncollectableMarker.h"
#include "nsCycleCollector.h"
@@ -2694,6 +2699,22 @@ nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
NS_PRECONDITION(!aParent || aParent->GetCurrentDoc() == aDocument,
"Incorrect aDocument");
#ifdef ACCESSIBILITY
// A11y needs to be notified of content removals first, so accessibility
// events can be fired before any changes occur
if (aNotify && aDocument) {
nsIPresShell *presShell = aDocument->GetPrimaryShell();
if (presShell && presShell->IsAccessibilityActive()) {
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
accService->InvalidateSubtreeFor(presShell, aKid,
nsIAccessibleEvent::EVENT_DOM_DESTROY);
}
}
}
#endif
nsMutationGuard::DidMutate();
nsINode* container = NODE_FROM(aParent, aDocument);