mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 473732 - Provide actions to set ARIA sort and expanded, r=surkov, r=MarcoZ
This commit is contained in:
parent
002151e9b2
commit
a23626549a
@ -123,7 +123,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
"columnheader",
|
||||
nsIAccessibleRole::ROLE_COLUMNHEADER,
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eSortAction,
|
||||
eNoLiveAttr,
|
||||
kNoReqStates,
|
||||
{&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
|
||||
@ -417,7 +417,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
"rowheader",
|
||||
nsIAccessibleRole::ROLE_ROWHEADER,
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eSortAction,
|
||||
eNoLiveAttr,
|
||||
kNoReqStates,
|
||||
{&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
|
||||
|
@ -57,9 +57,11 @@ enum EActionRule
|
||||
eActivateAction,
|
||||
eClickAction,
|
||||
eCheckUncheckAction,
|
||||
eExpandAction,
|
||||
eJumpAction,
|
||||
eOpenCloseAction,
|
||||
eSelectAction,
|
||||
eSortAction,
|
||||
eSwitchAction
|
||||
};
|
||||
|
||||
|
@ -321,6 +321,8 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
||||
PRBool
|
||||
nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom)
|
||||
{
|
||||
NS_ASSERTION(aContent, "aContent is null in call to HasDefinedARIAToken!");
|
||||
|
||||
if (!aContent->HasAttr(kNameSpaceID_None, aAtom) ||
|
||||
aContent->AttrValueIs(kNameSpaceID_None, aAtom,
|
||||
nsAccessibilityAtoms::_empty, eCaseMatters) ||
|
||||
|
@ -2335,6 +2335,17 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
case eSwitchAction:
|
||||
aName.AssignLiteral("switch");
|
||||
return NS_OK;
|
||||
|
||||
case eSortAction:
|
||||
aName.AssignLiteral("sort");
|
||||
return NS_OK;
|
||||
|
||||
case eExpandAction:
|
||||
if (states & nsIAccessibleStates::STATE_COLLAPSED)
|
||||
aName.AssignLiteral("expand");
|
||||
else
|
||||
aName.AssignLiteral("collapse");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@ -3229,8 +3240,11 @@ nsAccessible::GetActionRule(PRUint32 aStates)
|
||||
if (aStates & nsIAccessibleStates::STATE_UNAVAILABLE)
|
||||
return eNoAction;
|
||||
|
||||
nsIContent* content = nsCoreUtils::GetRoleContent(mDOMNode);
|
||||
if (!content)
|
||||
return eNoAction;
|
||||
|
||||
// Check if it's simple xlink.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (nsCoreUtils::IsXLink(content))
|
||||
return eJumpAction;
|
||||
|
||||
@ -3240,11 +3254,17 @@ nsAccessible::GetActionRule(PRUint32 aStates)
|
||||
|
||||
if (isOnclick)
|
||||
return eClickAction;
|
||||
|
||||
|
||||
// Get an action based on ARIA role.
|
||||
if (mRoleMapEntry)
|
||||
if (mRoleMapEntry &&
|
||||
mRoleMapEntry->actionRule != eNoAction)
|
||||
return mRoleMapEntry->actionRule;
|
||||
|
||||
// Get an action based on ARIA attribute.
|
||||
if (nsAccUtils::HasDefinedARIAToken(content,
|
||||
nsAccessibilityAtoms::aria_expanded))
|
||||
return eExpandAction;
|
||||
|
||||
return eNoAction;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,21 @@
|
||||
ID: "treeitem",
|
||||
actionName: "activate",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "sortable",
|
||||
actionName: "sort",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "expandable",
|
||||
actionName: "expand",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "collapseable",
|
||||
actionName: "collapse",
|
||||
events: CLICK_EVENTS
|
||||
}
|
||||
];
|
||||
testActions(actionsArray);
|
||||
@ -160,5 +175,14 @@
|
||||
<div role="tree">
|
||||
<div id="treeitem" role="treeitem">Treeitem</div>
|
||||
</div>
|
||||
|
||||
<div role="grid">
|
||||
<div id="sortable" role="columnheader" aria-sort="ascending">
|
||||
Columnheader
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="expandable" aria-expanded="false">collapsed</div>
|
||||
<div id="collapseable" aria-expanded="true">expanded</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -19,7 +19,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=441737
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
// Get accessible for body tag.
|
||||
var docAcc = getAccessible(document, [nsIAccessibleDocument]);
|
||||
if (docAcc) {
|
||||
// nsIAccessible
|
||||
|
Loading…
Reference in New Issue
Block a user