зеркало из https://github.com/mozilla/pjs.git
Bug 376887. If document gets painted before being fully loaded, and gets focused, the accessible tree is often incorrectly truncated. r=surkov
This commit is contained in:
Родитель
4764823cdb
Коммит
cddcfada2d
|
@ -58,7 +58,7 @@ interface nsIDOMWindow;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(DD22939F-B470-4a56-9B80-8C7BA4031334)]
|
||||
[scriptable, uuid(60f8b190-63c4-4919-ac92-a7a8212fc813)]
|
||||
interface nsIAccessibleDocument : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -120,8 +120,10 @@ interface nsIAccessibleDocument : nsISupports
|
|||
* Returns the first accessible parent of a DOM node.
|
||||
* Guaranteed not to return nsnull if the DOM node is in a document.
|
||||
* @param aDOMNode The DOM node we need an accessible for.
|
||||
* @param aCanCreate Can accessibles be created or must it be the first
|
||||
* cached accessible in the parent chain?
|
||||
* @return An first nsIAccessible found by crawling up the DOM node
|
||||
* to the document root.
|
||||
*/
|
||||
nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
|
||||
nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode, in boolean aCanCreate);
|
||||
};
|
||||
|
|
|
@ -595,7 +595,7 @@ NS_IMETHODIMP nsAccessible::GetParent(nsIAccessible ** aParent)
|
|||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
NS_ENSURE_TRUE(docAccessible, NS_ERROR_FAILURE);
|
||||
|
||||
return docAccessible->GetAccessibleInParentChain(mDOMNode, aParent);
|
||||
return docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetCachedParent(nsIAccessible ** aParent)
|
||||
|
|
|
@ -214,6 +214,9 @@ nsDocAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
|
|||
|
||||
if (!mIsContentLoaded) {
|
||||
*aState |= nsIAccessibleStates::STATE_BUSY;
|
||||
if (aExtraState) {
|
||||
*aExtraState |= nsIAccessibleStates::EXT_STATE_STALE;
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* frame = GetFrame();
|
||||
|
@ -1365,9 +1368,10 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIDOMNode> childNode = aChild ? do_QueryInterface(aChild) : mDOMNode;
|
||||
if (!IsNodeRelevant(childNode)) {
|
||||
return NS_OK; // Don't fire event unless it's for an attached accessible
|
||||
return NS_OK; // Don't fire event unless it can be for an attached accessible
|
||||
}
|
||||
if (!mIsContentLoaded && mAccessNodeCache.Count() <= 1) {
|
||||
if (!mIsContentLoaded && mAccessNodeCache.Count() <= 1 &&
|
||||
mAccChildCount == eChildCountUninitialized) {
|
||||
return NS_OK; // Still loading and nothing to invalidate yet
|
||||
}
|
||||
|
||||
|
@ -1430,8 +1434,8 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
containerAccessible = this; // At the root of UI or content
|
||||
}
|
||||
}
|
||||
if (!containerAccessible && privateChildAccessible) {
|
||||
GetAccessibleInParentChain(childNode, getter_AddRefs(containerAccessible));
|
||||
if (!containerAccessible) {
|
||||
GetAccessibleInParentChain(childNode, mIsContentLoaded, getter_AddRefs(containerAccessible));
|
||||
}
|
||||
nsCOMPtr<nsPIAccessible> privateContainerAccessible =
|
||||
do_QueryInterface(containerAccessible);
|
||||
|
@ -1492,7 +1496,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
||||
nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode, PRBool aCanCreate,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
// Find accessible in parent chain of DOM nodes, or return null
|
||||
|
@ -1517,7 +1521,12 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
|||
currentNode = relevantNode;
|
||||
}
|
||||
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
|
||||
if (aCanCreate) {
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
|
||||
}
|
||||
else {
|
||||
accService->GetCachedAccessible(currentNode, mWeakShell, aAccessible);
|
||||
}
|
||||
} while (!*aAccessible);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -817,7 +817,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
|
|||
PRBool isActive;
|
||||
menuParent->GetIsActive(isActive);
|
||||
if (!isActive) {
|
||||
// It is a top level menuitem. Only fire focus event the menu bar
|
||||
// It is a top level menuitem. Only fire a focus event when the menu bar
|
||||
// is active.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче