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 9fd83f0e70
commit 98c42bd75b

View File

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