mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 529442. Don't hold a frame pointer in nsAccessibilityService::GetAccessible. r=roc,dbolter
This commit is contained in:
parent
5fa533b23e
commit
fb89b95276
@ -1334,7 +1334,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
// that can flush layout, either directly, or via DOM manipulation, or some
|
||||
// CSS styles like :hover. We use the weak frame checks to avoid calling
|
||||
// methods on a dead frame pointer.
|
||||
nsWeakFrame weakFrame = *aFrameHint;
|
||||
nsWeakFrame weakFrame(*aFrameHint);
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
// Please leave this in for now, it's a convenient debugging method
|
||||
@ -1460,8 +1460,10 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
*aIsHidden = PR_TRUE;
|
||||
}
|
||||
|
||||
if (*aIsHidden)
|
||||
if (*aIsHidden) {
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to create an accessible based on what we know
|
||||
@ -1475,13 +1477,17 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
if (renderedWhitespace.IsEmpty()) {
|
||||
// Really empty -- nothing is rendered
|
||||
*aIsHidden = PR_TRUE;
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
if (weakFrame.IsAlive()) {
|
||||
weakFrame.GetFrame()->GetAccessible(getter_AddRefs(newAcc));
|
||||
}
|
||||
return InitAccessible(newAcc, aAccessible, nsnull);
|
||||
|
||||
nsresult rv = InitAccessible(newAcc, aAccessible, nsnull);
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRBool isHTML = content->IsHTML();
|
||||
@ -1498,12 +1504,16 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::name, name);
|
||||
if (!name.IsEmpty()) {
|
||||
*aIsHidden = PR_TRUE;
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
CreateHyperTextAccessible(weakFrame.GetFrame(), getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aNode);
|
||||
@ -1512,6 +1522,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
// Only create accessible for role of "presentation" if it is focusable --
|
||||
// in that case we need an accessible in case it gets focused, we
|
||||
// don't want focus ever to be 'lost'
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1569,6 +1580,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
// presentation if they aren't focusable and have not explicit ARIA
|
||||
// role (don't create accessibles for them unless they need to fire
|
||||
// focus events).
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1616,7 +1628,10 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
nsresult rv =
|
||||
CreateHTMLAccessibleByMarkup(weakFrame.GetFrame(), aWeakShell, aNode,
|
||||
getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!newAcc) {
|
||||
// Do not create accessible object subtrees for non-rendered table
|
||||
@ -1634,6 +1649,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
// XXX This is not the ideal place for this code, but right now there
|
||||
// is no better place:
|
||||
*aIsHidden = PR_TRUE;
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return NS_OK;
|
||||
}
|
||||
f->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
|
||||
@ -1645,7 +1661,10 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
// Elements may implement nsIAccessibleProvider via XBL. This allows them to
|
||||
// say what kind of accessible to create.
|
||||
nsresult rv = GetAccessibleByType(aNode, getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (!newAcc) {
|
||||
@ -1688,7 +1707,9 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
||||
}
|
||||
}
|
||||
|
||||
return InitAccessible(newAcc, aAccessible, roleMapEntry);
|
||||
nsresult rv = InitAccessible(newAcc, aAccessible, roleMapEntry);
|
||||
*aFrameHint = weakFrame.GetFrame();
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
Loading…
Reference in New Issue
Block a user