Bug 398021. Crash [@ nsAccessible::GetFinalRole] with moving options and using visibility: hidden. r=surkov, a=schrep

This commit is contained in:
aaronleventhal%moonset.net 2007-11-15 15:33:52 +00:00
Родитель a0911b32a0
Коммит dede6e1b8f
2 изменённых файлов: 29 добавлений и 7 удалений

Просмотреть файл

@ -1806,6 +1806,10 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
// event for it
GetAccService()->GetAttachedAccessibleFor(childNode,
getter_AddRefs(childAccessible));
if (childAccessible) {
// New accessible created -- to make sure to adopt the children from the old parent.
AdoptChildren(childAccessible);
}
}
#ifdef DEBUG_A11Y
@ -1933,6 +1937,13 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
return NS_OK;
}
void nsDocAccessible::AdoptChildren(nsIAccessible *aAccessible)
{
PRInt32 childCountUnused;
// Force CacheChildren()
aAccessible->GetChildCount(&childCountUnused);
}
NS_IMETHODIMP
nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
PRBool aCanCreate,
@ -1959,15 +1970,18 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
if (NS_SUCCEEDED(accService->GetRelevantContentNodeFor(currentNode, getter_AddRefs(relevantNode))) && relevantNode) {
currentNode = relevantNode;
}
if (aCanCreate) {
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
}
else { // Only return cached accessibles, don't create anything
// Try cached accessible
nsCOMPtr<nsIAccessNode> accessNode;
GetCachedAccessNode(currentNode, getter_AddRefs(accessNode)); // AddRefs
if (accessNode) {
CallQueryInterface(accessNode, aAccessible); // AddRefs
}
if (!*aAccessible && aCanCreate) {
accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
if (*aAccessible) {
// New accessible created -- to make sure to adopt the children from the old parent.
AdoptChildren(*aAccessible);
}
}
} while (!*aAccessible);

Просмотреть файл

@ -204,6 +204,14 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
nsresult FireShowHideEvents(nsIDOMNode *aDOMNode, PRUint32 aEventType,
PRBool aDelay, PRBool aForceIsFromUserInput);
/**
* For a new accessible that is created because of a DOM mutation,
* make sure that any children it has, which were already children
* of the parent should be assigned to it
* @param aAccessible The new accessible
*/
void AdoptChildren(nsIAccessible *aAccessible);
nsAccessNodeHashtable mAccessNodeCache;
void *mWnd;
nsCOMPtr<nsIDocument> mDocument;