зеркало из https://github.com/mozilla/gecko-dev.git
Bug 396424 - calculate selected state for currently active ARIA tab, r=aaronlev, a=dsicore
This commit is contained in:
Родитель
fb0578606a
Коммит
f9911aaf0d
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче