Bug 499140 - Set container-live-role attribute for all containers with default or explicit aria-live; r=MarcoZ, r=surkov

This commit is contained in:
David Bolter 2009-06-19 13:44:13 -04:00
Родитель 3dbd873d97
Коммит 0215b1d90f
2 изменённых файлов: 24 добавлений и 9 удалений

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

@ -279,22 +279,20 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_relevant, relevant)) ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_relevant, relevant))
SetAccAttr(aAttributes, nsAccessibilityAtoms::containerRelevant, relevant); SetAccAttr(aAttributes, nsAccessibilityAtoms::containerRelevant, relevant);
// container-live attribute // container-live, and container-live-role attributes
if (live.IsEmpty()) { if (live.IsEmpty()) {
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(ancestor));
nsRoleMapEntry *role = GetRoleMapEntry(node);
if (nsAccUtils::HasDefinedARIAToken(ancestor, if (nsAccUtils::HasDefinedARIAToken(ancestor,
nsAccessibilityAtoms::aria_live)) { nsAccessibilityAtoms::aria_live)) {
ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_live, ancestor->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_live,
live); live);
} else if (role) {
GetLiveAttrValue(role->liveAttRule, live);
}
if (!live.IsEmpty()) {
SetAccAttr(aAttributes, nsAccessibilityAtoms::containerLive, live); SetAccAttr(aAttributes, nsAccessibilityAtoms::containerLive, live);
} else {
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(ancestor));
nsRoleMapEntry *role = GetRoleMapEntry(node);
if (role) { if (role) {
nsAutoString live;
GetLiveAttrValue(role->liveAttRule, live);
SetAccAttr(aAttributes, nsAccessibilityAtoms::containerLive, live);
// For default live containers, expose the container-live-role attribute
nsAccUtils::SetAccAttr(aAttributes, nsAccUtils::SetAccAttr(aAttributes,
nsAccessibilityAtoms::containerLiveRole, nsAccessibilityAtoms::containerLiveRole,
NS_ConvertASCIItoUTF16(role->roleString)); NS_ConvertASCIItoUTF16(role->roleString));

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

@ -40,6 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391829
testAttrs("live", {"live" : "polite"}, true); testAttrs("live", {"live" : "polite"}, true);
testAttrs("live2", {"live" : "polite"}, true); testAttrs("live2", {"live" : "polite"}, true);
testAttrs("log", {"live" : "polite"}, true); testAttrs("log", {"live" : "polite"}, true);
testAttrs("logAssertive", {"live" : "assertive"}, true);
testAttrs("marquee", {"live" : "off"}, true); testAttrs("marquee", {"live" : "off"}, true);
testAttrs("status", {"live" : "polite"}, true); testAttrs("status", {"live" : "polite"}, true);
testAttrs("timer", {"live" : "off"}, true); testAttrs("timer", {"live" : "off"}, true);
@ -48,20 +49,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391829
testAttrs("liveChild", {"container-live" : "polite"}, true); testAttrs("liveChild", {"container-live" : "polite"}, true);
testAttrs("live2Child", {"container-live" : "polite"}, true); testAttrs("live2Child", {"container-live" : "polite"}, true);
testAttrs("logChild", {"container-live" : "polite"}, true); testAttrs("logChild", {"container-live" : "polite"}, true);
testAttrs("logAssertiveChild", {"container-live" : "assertive"}, true);
testAttrs("marqueeChild", {"container-live" : "off"}, true); testAttrs("marqueeChild", {"container-live" : "off"}, true);
testAttrs("statusChild", {"container-live" : "polite"}, true); testAttrs("statusChild", {"container-live" : "polite"}, true);
testAttrs("timerChild", {"container-live" : "off"}, true); testAttrs("timerChild", {"container-live" : "off"}, true);
// container-live-role object attribute // container-live-role object attribute
testAttrs("log", {"container-live-role" : "log"}, true); testAttrs("log", {"container-live-role" : "log"}, true);
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
testAttrs("marquee", {"container-live-role" : "marquee"}, true); testAttrs("marquee", {"container-live-role" : "marquee"}, true);
testAttrs("status", {"container-live-role" : "status"}, true); testAttrs("status", {"container-live-role" : "status"}, true);
testAttrs("timer", {"container-live-role" : "timer"}, true); testAttrs("timer", {"container-live-role" : "timer"}, true);
testAttrs("logChild", {"container-live-role" : "log"}, true); testAttrs("logChild", {"container-live-role" : "log"}, true);
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
testAttrs("logAssertiveChild", {"container-live-role" : "log"}, true);
testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true); testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true);
testAttrs("statusChild", {"container-live-role" : "status"}, true); testAttrs("statusChild", {"container-live-role" : "status"}, true);
testAttrs("timerChild", {"container-live-role" : "timer"}, true); testAttrs("timerChild", {"container-live-role" : "timer"}, true);
// container that has no default live attribute
testAttrs("liveGroup", {"live" : "polite"}, true);
testAttrs("liveGroupChild", {"container-live" : "polite"}, true);
testAttrs("liveGroup", {"container-live-role" : "group"}, true);
testAttrs("liveGroupChild", {"container-live-role" : "group"}, true);
// html // html
testAttrs("radio", {"checkable" : "true"}, true); testAttrs("radio", {"checkable" : "true"}, true);
testAttrs("checkbox", {"checkable" : "true"}, true); testAttrs("checkbox", {"checkable" : "true"}, true);
@ -108,10 +119,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391829
<div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div> <div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
<div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div> <div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
<div id="log" role="log">excuse <div id="logChild">me</div></div> <div id="log" role="log">excuse <div id="logChild">me</div></div>
<div id="logAssertive" role="log" aria-live="assertive">excuse <div id="logAssertiveChild">me</div></div>
<div id="marquee" role="marquee">excuse <div id="marqueeChild">me</div></div> <div id="marquee" role="marquee">excuse <div id="marqueeChild">me</div></div>
<div id="status" role="status">excuse <div id="statusChild">me</div></div> <div id="status" role="status">excuse <div id="statusChild">me</div></div>
<div id="timer" role="timer">excuse <div id="timerChild">me</div></div> <div id="timer" role="timer">excuse <div id="timerChild">me</div></div>
<!-- unusual live case -->
<div id="liveGroup" role="group" aria-live="polite">
excuse <div id="liveGroupChild">me</div>
</div>
<!-- html --> <!-- html -->
<input id="radio" type="radio"/> <input id="radio" type="radio"/>
<input id="checkbox" type="checkbox"/> <input id="checkbox" type="checkbox"/>