Bug 417249. AT-SPI document load complete events not triggered everytime. Take care of some more cases. r=ginn.chen, a=blocking1.9

This commit is contained in:
aaronleventhal@moonset.net 2008-02-26 06:19:52 -08:00
parent e9ba9613cb
commit b38a4bf141
2 changed files with 20 additions and 17 deletions

View File

@ -85,7 +85,7 @@ nsIAtom *nsDocAccessible::gLastFocusedFrameType = nsnull;
//----------------------------------------------------- //-----------------------------------------------------
nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell): nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
nsHyperTextAccessibleWrap(aDOMNode, aShell), mWnd(nsnull), nsHyperTextAccessibleWrap(aDOMNode, aShell), mWnd(nsnull),
mScrollPositionChangedTicks(0), mIsContentLoaded(PR_FALSE) mScrollPositionChangedTicks(0), mIsContentLoaded(PR_FALSE), mIsLoadCompleteFired(PR_FALSE)
{ {
// For GTK+ native window, we do nothing here. // For GTK+ native window, we do nothing here.
if (!mDOMNode) if (!mDOMNode)
@ -766,10 +766,12 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
(aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE || (aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE ||
aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED); aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED);
if (mIsContentLoaded == isFinished) {
return NS_OK;
}
mIsContentLoaded = isFinished; mIsContentLoaded = isFinished;
if (isFinished) {
if (mIsLoadCompleteFired)
return NS_OK;
mIsLoadCompleteFired = PR_TRUE;
}
nsCOMPtr<nsIDocShellTreeItem> treeItem = nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode); nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
@ -793,19 +795,19 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
// doc load event which causes screen readers to act is if entire page is reloaded // doc load event which causes screen readers to act is if entire page is reloaded
InvalidateCacheSubtree(nsnull, nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE); InvalidateCacheSubtree(nsnull, nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE);
} }
} // Fire STATE_CHANGE event for doc load finish if focus is in same doc tree
// Fire STATE_CHANGE event for doc load finish if focus is in same doc tree if (gLastFocusedNode) {
if (gLastFocusedNode) { nsCOMPtr<nsIDocShellTreeItem> focusedTreeItem =
nsCOMPtr<nsIDocShellTreeItem> focusedTreeItem = nsAccUtils::GetDocShellTreeItemFor(gLastFocusedNode);
nsAccUtils::GetDocShellTreeItemFor(gLastFocusedNode); if (focusedTreeItem) {
if (focusedTreeItem) { nsCOMPtr<nsIDocShellTreeItem> sameTypeRootOfFocus;
nsCOMPtr<nsIDocShellTreeItem> sameTypeRootOfFocus; focusedTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRootOfFocus));
focusedTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRootOfFocus)); if (sameTypeRoot == sameTypeRootOfFocus) {
if (sameTypeRoot == sameTypeRootOfFocus) { nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent = new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY, PR_FALSE, PR_FALSE);
new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY, PR_FALSE, PR_FALSE); FireAccessibleEvent(accEvent);
FireAccessibleEvent(accEvent); FireAnchorJumpEvent();
FireAnchorJumpEvent(); }
} }
} }
} }

View File

@ -214,6 +214,7 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
nsCOMPtr<nsITimer> mFireEventTimer; nsCOMPtr<nsITimer> mFireEventTimer;
PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events
PRPackedBool mIsContentLoaded; PRPackedBool mIsContentLoaded;
PRPackedBool mIsLoadCompleteFired;
nsCOMArray<nsIAccessibleEvent> mEventsToFire; nsCOMArray<nsIAccessibleEvent> mEventsToFire;
protected: protected: