Bug 396424 - calculate selected state for currently active ARIA tab, r=aaronlev, a=dsicore

This commit is contained in:
surkov.alexander%gmail.com 2007-10-03 09:31:41 +00:00
Родитель 3d8dd23c24
Коммит 0e7f28ccf3
1 изменённых файлов: 23 добавлений и 0 удалений

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

@ -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;