Bug 450089 – parent children aren't invalidated if not accessible element is shown, r=ginn.chen

This commit is contained in:
Alexander Surkov 2008-08-14 16:30:26 +08:00
parent ac68a446f8
commit 056f2b8686

View File

@ -1597,16 +1597,25 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
if (eventType == nsIAccessibleEvent::EVENT_DOM_CREATE ||
eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
nsCOMPtr<nsIAccessible> containerAccessible;
if (eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
if (accessible) {
// For asynch show, delayed invalidatation of parent's children
if (accessible)
accessible->GetParent(getter_AddRefs(containerAccessible));
if (!containerAccessible) {
GetAccessibleInParentChain(domNode, PR_TRUE,
getter_AddRefs(containerAccessible));
if (!containerAccessible)
containerAccessible = this;
}
if (eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
// For asynch show, delayed invalidatation of parent's children
nsCOMPtr<nsPIAccessible> privateContainerAccessible =
do_QueryInterface(containerAccessible);
if (privateContainerAccessible)
privateContainerAccessible->InvalidateChildren();
}
// Some show events in the subtree may have been removed to
// avoid firing redundant events. But, we still need to make sure any
// accessibles parenting those shown nodes lose their child references.
@ -1619,13 +1628,6 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
// wait to fire this here, instead of in InvalidateCacheSubtree(), where we wouldn't be able to calculate
// the offset, length and text for the text change.
if (domNode && domNode != mDOMNode) {
if (!containerAccessible) {
GetAccessibleInParentChain(domNode, PR_TRUE,
getter_AddRefs(containerAccessible));
if (!containerAccessible)
containerAccessible = this;
}
nsCOMPtr<nsIAccessibleTextChangeEvent> textChangeEvent =
CreateTextChangeEventForNode(containerAccessible, domNode, accessible, PR_TRUE, PR_TRUE);
if (textChangeEvent) {