зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1136563 - ARIA 1.1: Support role 'switch', r=surkov
This commit is contained in:
Родитель
2ccb1ce2ad
Коммит
871757e5e6
|
@ -540,6 +540,17 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
|||
kGenericAccType,
|
||||
kNoReqStates
|
||||
},
|
||||
{ // switch
|
||||
&nsGkAtoms::_switch,
|
||||
roles::SWITCH,
|
||||
kUseMapRole,
|
||||
eNoValue,
|
||||
eCheckUncheckAction,
|
||||
eNoLiveAttr,
|
||||
kGenericAccType,
|
||||
kNoReqStates,
|
||||
eARIACheckableBool
|
||||
},
|
||||
{ // tab
|
||||
&nsGkAtoms::tab,
|
||||
roles::PAGETAB,
|
||||
|
|
|
@ -785,7 +785,12 @@ enum Role {
|
|||
*/
|
||||
KEY = 129,
|
||||
|
||||
LAST_ROLE = KEY
|
||||
/**
|
||||
* Represent a switch control widget (ARIA role "switch").
|
||||
*/
|
||||
SWITCH = 130,
|
||||
|
||||
LAST_ROLE = SWITCH
|
||||
};
|
||||
|
||||
} // namespace role
|
||||
|
|
|
@ -1055,3 +1055,11 @@ ROLE(KEY,
|
|||
ROLE_SYSTEM_PUSHBUTTON,
|
||||
ROLE_SYSTEM_PUSHBUTTON,
|
||||
eNameFromSubtreeRule)
|
||||
|
||||
ROLE(SWITCH,
|
||||
"switch",
|
||||
ATK_ROLE_TOGGLE_BUTTON,
|
||||
NSAccessibilityCheckBoxRole,
|
||||
ROLE_SYSTEM_CHECKBUTTON,
|
||||
IA2_ROLE_TOGGLE_BUTTON,
|
||||
eNameFromSubtreeRule)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
/**
|
||||
* Defines cross platform (Gecko) roles.
|
||||
*/
|
||||
[scriptable, uuid(50db5e86-9a45-4637-a5c3-4ff148c33270)]
|
||||
[scriptable, uuid(76ce835f-ef86-47c0-ac7b-e871417f1b6e)]
|
||||
interface nsIAccessibleRole : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -778,4 +778,9 @@ interface nsIAccessibleRole : nsISupports
|
|||
* A keyboard or keypad key.
|
||||
*/
|
||||
const unsigned long ROLE_KEY = 129;
|
||||
|
||||
/**
|
||||
* A switch control widget.
|
||||
*/
|
||||
const unsigned long ROLE_SWITCH = 130;
|
||||
};
|
||||
|
|
|
@ -475,6 +475,9 @@ GetClosestInterestingAccessible(id anObject)
|
|||
case roles::DEFINITION:
|
||||
return @"AXDefinition";
|
||||
|
||||
case roles::SWITCH:
|
||||
return @"AXSwitch";
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,16 @@
|
|||
actionName: "select",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "switch_unchecked",
|
||||
actionName: "check",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "switch_checked",
|
||||
actionName: "uncheck",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "tab",
|
||||
actionName: "switch",
|
||||
|
@ -166,6 +176,10 @@
|
|||
<div id="radio" role="radio">Radio</div>
|
||||
</div>
|
||||
|
||||
<div id="switch_unchecked" role="switch">Switch</div>
|
||||
|
||||
<div id="switch_checked" role="switch" aria-checked="true">Switch</div>
|
||||
|
||||
<div role="tablist">
|
||||
<div id="tab" role="tab">Tab</div>
|
||||
</div>
|
||||
|
|
|
@ -107,17 +107,28 @@
|
|||
new setAttrOfMixedType(aID, "aria-checked", STATE_CHECKED, aValue);
|
||||
}
|
||||
|
||||
function buildQueueForAttr(aList, aQueue, aID, aInvokerFunc)
|
||||
{
|
||||
for (var i = 0; i < aList.length; i++) {
|
||||
for (var j = i + 1; j < aList.length; j++) {
|
||||
// XXX: changes from/to "undefined"/"" shouldn't fire state change
|
||||
// events, bug 472142.
|
||||
aQueue.push(new aInvokerFunc(aID, aList[i]));
|
||||
aQueue.push(new aInvokerFunc(aID, aList[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildQueueForAttrOfMixedType(aQueue, aID, aInvokerFunc)
|
||||
{
|
||||
var list = [ "", "undefined", "false", "true", "mixed" ];
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
for (var j = i + 1; j < list.length; j++) {
|
||||
// XXX: changes from/to "undefined"/"" shouldn't fire state change
|
||||
// events, bug 472142.
|
||||
aQueue.push(new aInvokerFunc(aID, list[i]));
|
||||
aQueue.push(new aInvokerFunc(aID, list[j]));
|
||||
}
|
||||
}
|
||||
buildQueueForAttr(list, aQueue, aID, aInvokerFunc);
|
||||
}
|
||||
|
||||
function buildQueueForAttrOfBoolType(aQueue, aID, aInvokerFunc)
|
||||
{
|
||||
var list = [ "", "undefined", "false", "true" ];
|
||||
buildQueueForAttr(list, aQueue, aID, aInvokerFunc);
|
||||
}
|
||||
|
||||
function doTests()
|
||||
|
@ -135,6 +146,7 @@
|
|||
buildQueueForAttrOfMixedType(gQueue, "pressable", setPressed);
|
||||
buildQueueForAttrOfMixedType(gQueue, "pressable_native", setPressed);
|
||||
buildQueueForAttrOfMixedType(gQueue, "checkable", setChecked);
|
||||
buildQueueForAttrOfBoolType(gQueue, "checkableBool", setChecked);
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
@ -166,6 +178,11 @@
|
|||
title="Pressed state is not exposed on a button element with aria-pressed attribute"
|
||||
Mozilla Bug 989958
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563"
|
||||
title="Support ARIA 1.1 switch role"
|
||||
Mozilla Bug 1136563
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
@ -186,5 +203,6 @@
|
|||
|
||||
<!-- aria-checked -->
|
||||
<div id="checkable" role="checkbox"></div>
|
||||
<div id="checkableBool" role="switch"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -70,6 +70,7 @@ const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER;
|
|||
const ROLE_SPINBUTTON = nsIAccessibleRole.ROLE_SPINBUTTON;
|
||||
const ROLE_STATICTEXT = nsIAccessibleRole.ROLE_STATICTEXT;
|
||||
const ROLE_STATUSBAR = nsIAccessibleRole.ROLE_STATUSBAR;
|
||||
const ROLE_SWITCH = nsIAccessibleRole.ROLE_SWITCH;
|
||||
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
|
||||
const ROLE_TERM = nsIAccessibleRole.ROLE_TERM;
|
||||
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
testRole("aria_slider", ROLE_SLIDER);
|
||||
testRole("aria_spinbutton", ROLE_SPINBUTTON);
|
||||
testRole("aria_status", ROLE_STATUSBAR);
|
||||
testRole("aria_switch", ROLE_SWITCH);
|
||||
testRole("aria_tab", ROLE_PAGETAB);
|
||||
testRole("aria_tablist", ROLE_PAGETABLIST);
|
||||
testRole("aria_tabpanel", ROLE_PROPERTYPAGE);
|
||||
|
@ -178,6 +179,11 @@
|
|||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645">
|
||||
Bug 735645
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563"
|
||||
title="Support ARIA 1.1 switch role"
|
||||
Bug 1136563
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -225,6 +231,7 @@
|
|||
<span id="aria_slider" role="slider"/>
|
||||
<span id="aria_spinbutton" role="spinbutton"/>
|
||||
<span id="aria_status" role="status"/>
|
||||
<span id="aria_switch" role="switch"/>
|
||||
<span id="aria_tab" role="tab"/>
|
||||
<span id="aria_tablist" role="tablist"/>
|
||||
<span id="aria_tabpanel" role="tabpanel"/>
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
// aria-checked
|
||||
testStates("aria_checked_checkbox", STATE_CHECKED);
|
||||
testStates("aria_mixed_checkbox", STATE_MIXED);
|
||||
testStates("aria_checked_switch", STATE_CHECKED);
|
||||
testStates("aria_mixed_switch", 0, 0, STATE_MIXED); // unsupported
|
||||
|
||||
// test disabled group and all its descendants to see if they are
|
||||
// disabled, too. See bug 429285.
|
||||
|
@ -350,6 +352,11 @@
|
|||
title="Pressed state is not exposed on a button element with aria-pressed attribute"
|
||||
Mozilla Bug 989958
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563"
|
||||
title="Support ARIA 1.1 switch role"
|
||||
Mozilla Bug 1136563
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
@ -383,6 +390,15 @@
|
|||
<div id="aria_mixed_checkbox" role="checkbox" aria-checked="mixed">
|
||||
I might agree
|
||||
</div>
|
||||
|
||||
<div id="aria_checked_switch" role="switch" aria-checked="true">
|
||||
I am switched on
|
||||
</div>
|
||||
|
||||
<div id="aria_mixed_switch" role="switch" aria-checked="mixed">
|
||||
I am unsupported
|
||||
</div>
|
||||
|
||||
<div id="aria_modal" aria-modal="true">modal stuff</div>
|
||||
<div id="aria_modal_false" aria-modal="false">non modal stuff</div>div>
|
||||
<div id="aria_multiline_textbox" role="textbox" aria-multiline="true"></div>
|
||||
|
|
|
@ -2296,6 +2296,7 @@ GK_ATOM(setsize, "setsize")
|
|||
GK_ATOM(spelling, "spelling")
|
||||
GK_ATOM(spinbutton, "spinbutton")
|
||||
GK_ATOM(status, "status")
|
||||
GK_ATOM(_switch, "switch")
|
||||
GK_ATOM(tableCellIndex, "table-cell-index")
|
||||
GK_ATOM(tablist, "tablist")
|
||||
GK_ATOM(textIndent, "text-indent")
|
||||
|
|
Загрузка…
Ссылка в новой задаче