Bug 491443 - Fire OBJECT_NAMECHANGE events when the HTML 5 media Play/Pause or Mute/Unmute buttons are pressed and the caption changes, r=marcoz, davidb

This commit is contained in:
Alexander Surkov 2009-05-14 13:27:40 +08:00
parent faa4d10c30
commit 60b110dbad
3 changed files with 37 additions and 18 deletions

View File

@ -1140,7 +1140,9 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
}
if (aAttribute == nsAccessibilityAtoms::alt ||
aAttribute == nsAccessibilityAtoms::title) {
aAttribute == nsAccessibilityAtoms::title ||
aAttribute == nsAccessibilityAtoms::aria_label ||
aAttribute == nsAccessibilityAtoms::aria_labelledby) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE,
targetNode);
return;

View File

@ -347,8 +347,14 @@ function prettyName(aIdentifier)
{
if (aIdentifier instanceof nsIAccessible) {
var acc = getAccessible(aIdentifier, [nsIAccessNode]);
return getNodePrettyName(acc.DOMNode) + ", role: " +
roleToString(acc.role);
var msg = "[" + getNodePrettyName(acc.DOMNode) +
", role: " + roleToString(acc.role);
if (acc.name)
msg += ", name: '" + acc.name + "'"
msg += "]";
return msg;
}
if (aIdentifier instanceof nsIDOMNode)

View File

@ -23,23 +23,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
<script type="application/javascript">
function focusChecker(aAcc, aName)
function focusChecker(aAcc)
{
this.type = EVENT_FOCUS;
this.target = aAcc;
this.getID = function focusChecker_getID()
{
return "focus handling";
}
}
function nameChecker(aAcc, aName)
{
this.type = EVENT_NAME_CHANGE;
this.target = aAcc;
this.getID = function nameChecker_getID()
{
return "name change handling";
},
this.check = function focusChecker_check(aEvent)
{
SimpleTest.executeSoon(
function()
{
is(aEvent.accessible.name, aName,
"Wrong name of " + prettyName(aEvent.accessible) + " on focus");
}
);
is(aEvent.accessible.name, aName,
"Wrong name of " + prettyName(aEvent.accessible) + " on focus");
}
}
@ -83,17 +88,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
var muteBtn = audioElm.lastChild;
var actions = [
{
ID: playBtn,
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [ new focusChecker(playBtn, "Pause") ],
},
{
ID: muteBtn,
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [ new focusChecker(muteBtn, "Unmute") ],
eventSeq: [
new focusChecker(muteBtn),
new nameChecker(muteBtn, "Unmute"),
]
},
{
ID: playBtn,
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [
new focusChecker(playBtn),
new nameChecker(playBtn, "Pause"),
]
}
];