Bug 396424 - calculate selected state for currently active ARIA tab, r=aaronlev, a=dsicore
git-svn-id: svn://10.0.0.236/trunk@237175 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2234,6 +2234,29 @@ nsAccessible::GetFinalState(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
// Apply ARIA states to be sure accessible states will be overriden.
|
||||
*aState |= GetARIAState();
|
||||
|
||||
if (mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_PAGETAB) {
|
||||
if (*aState & nsIAccessibleStates::STATE_FOCUSED) {
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
} else {
|
||||
// Expose 'selected' state on ARIA tab if the focus is on internal element
|
||||
// of related tabpanel.
|
||||
nsCOMPtr<nsIAccessible> tabPanel;
|
||||
rv = GetAccessibleRelated(nsIAccessibleRelation::RELATION_LABEL_FOR,
|
||||
getter_AddRefs(tabPanel));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (tabPanel && Role(tabPanel) == nsIAccessibleRole::ROLE_PROPERTYPAGE) {
|
||||
nsCOMPtr<nsIAccessNode> tabPanelAccessNode(do_QueryInterface(tabPanel));
|
||||
nsCOMPtr<nsIDOMNode> tabPanelNode;
|
||||
tabPanelAccessNode->GetDOMNode(getter_AddRefs(tabPanelNode));
|
||||
NS_ENSURE_STATE(tabPanelNode);
|
||||
|
||||
if (nsAccUtils::IsAncestorOf(tabPanelNode, gLastFocusedNode))
|
||||
*aState |= nsIAccessibleStates::STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set additional states which presence depends on another states.
|
||||
if (!aExtraState)
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user