mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 385444. Reduce special cases for show/hide/reorder event firing. r=surkov
This commit is contained in:
parent
18256f6d26
commit
d546531a5c
@ -58,7 +58,7 @@ interface nsIDOMWindow;
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(ae5792a3-77ad-40d6-8450-d28d19b66889)]
|
||||
[scriptable, uuid(6cc11286-e02d-4a8d-960a-e7a61161b230)]
|
||||
interface nsIAccessibleDocument : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -120,5 +120,5 @@ interface nsIAccessibleDocument : nsISupports
|
||||
* @return An first nsIAccessible found by crawling up the DOM node
|
||||
* to the document root.
|
||||
*/
|
||||
nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode, in boolean aCanCreate);
|
||||
nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
|
||||
};
|
||||
|
@ -597,7 +597,7 @@ NS_IMETHODIMP nsAccessible::GetParent(nsIAccessible ** aParent)
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
NS_ENSURE_TRUE(docAccessible, NS_ERROR_FAILURE);
|
||||
|
||||
return docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, aParent);
|
||||
return docAccessible->GetAccessibleInParentChain(mDOMNode, aParent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetCachedParent(nsIAccessible ** aParent)
|
||||
|
@ -1387,15 +1387,21 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
if (!IsNodeRelevant(childNode)) {
|
||||
return NS_OK; // Don't fire event unless it can be for an attached accessible
|
||||
}
|
||||
if (!mIsContentLoaded && mAccessNodeCache.Count() <= 1 &&
|
||||
mAccChildCount == eChildCountUninitialized) {
|
||||
return NS_OK; // Still loading and nothing to invalidate yet
|
||||
if (!mIsContentLoaded && mAccessNodeCache.Count() <= 1) {
|
||||
// Still loading and no accessibles has yet been created other than this
|
||||
// doc accessible. In this case we optimize
|
||||
// by not firing SHOW/HIDE/REORDER events for every document mutation
|
||||
// caused by page load, since AT is not going to want to grab the
|
||||
// document and listen to these changes until after the page is first loaded
|
||||
// Leave early, and ensure mAccChildCount stays uninitialized instead of 0,
|
||||
// which it is if anyone asks for its children right now.
|
||||
return InvalidateChildren();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessNode> childAccessNode;
|
||||
GetCachedAccessNode(childNode, getter_AddRefs(childAccessNode));
|
||||
nsCOMPtr<nsIAccessible> childAccessible = do_QueryInterface(childAccessNode);
|
||||
if (!childAccessible && mIsContentLoaded && aChangeEventType != nsIAccessibleEvent::EVENT_HIDE) {
|
||||
if (!childAccessible && aChangeEventType != nsIAccessibleEvent::EVENT_HIDE) {
|
||||
// If not about to hide it, make sure there's an accessible so we can fire an
|
||||
// event for it
|
||||
GetAccService()->GetAccessibleFor(childNode, getter_AddRefs(childAccessible));
|
||||
@ -1452,7 +1458,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
}
|
||||
}
|
||||
if (!containerAccessible) {
|
||||
GetAccessibleInParentChain(childNode, mIsContentLoaded, getter_AddRefs(containerAccessible));
|
||||
GetAccessibleInParentChain(childNode, getter_AddRefs(containerAccessible));
|
||||
}
|
||||
nsCOMPtr<nsPIAccessible> privateContainerAccessible =
|
||||
do_QueryInterface(containerAccessible);
|
||||
@ -1460,10 +1466,6 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
privateContainerAccessible->InvalidateChildren();
|
||||
}
|
||||
|
||||
if (!mIsContentLoaded) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Fire an event so the assistive technology knows the objects it is holding onto
|
||||
// in this part of the subtree are no longer useful and should be released.
|
||||
// However, they still won't crash if the AT tries to use them, because a stub of the
|
||||
@ -1513,7 +1515,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode, PRBool aCanCreate,
|
||||
nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
// Find accessible in parent chain of DOM nodes, or return null
|
||||
@ -1538,12 +1540,7 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode, PRBool aCanCreate
|
||||
currentNode = relevantNode;
|
||||
}
|
||||
|
||||
if (aCanCreate) {
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
|
||||
}
|
||||
else {
|
||||
accService->GetCachedAccessible(currentNode, mWeakShell, aAccessible);
|
||||
}
|
||||
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
|
||||
} while (!*aAccessible);
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user