Bug 752131 - Remove empty strings from utterances. r=davidb

This commit is contained in:
Eitan Isaacson 2012-05-07 11:21:21 -07:00
parent b420bdaffd
commit 7ece5297e9

View File

@ -179,9 +179,9 @@ var UtteranceGenerator = {
let name = (aFlags & INCLUDE_NAME) ? (aAccessible.name || '') : '';
let desc = (aFlags & INCLUDE_ROLE) ? this._getLocalizedRole(aRoleStr) : '';
if (!name && !desc)
return [];
let utterance = [];
if (desc) {
let state = {};
let extState = {};
aAccessible.getState(state, extState);
@ -198,16 +198,26 @@ var UtteranceGenerator = {
desc = gStringBundle.formatStringFromName(stateStr, [desc], 1);
}
return [desc, name];
utterance.push(desc);
}
if (name)
utterance.push(name);
return utterance;
},
heading: function(aAccessible, aRoleStr, aFlags) {
let name = (aFlags & INCLUDE_NAME) ? (aAccessible.name || '') : '';
let level = {};
aAccessible.groupPosition(level, {}, {});
let desc = gStringBundle.formatStringFromName('headingLevel',
[level.value], 1);
return [desc, name];
let utterance =
[gStringBundle.formatStringFromName('headingLevel', [level.value], 1)];
if (name)
utterance.push(name);
return utterance;
},
listitem: function(aAccessible, aRoleStr, aFlags) {
@ -216,10 +226,14 @@ var UtteranceGenerator = {
let itemno = {};
let itemof = {};
aAccessible.groupPosition({}, itemof, itemno);
let desc = gStringBundle.formatStringFromName(
'objItemOf', [localizedRole, itemno.value, itemof.value], 3);
let utterance =
[gStringBundle.formatStringFromName(
'objItemOf', [localizedRole, itemno.value, itemof.value], 3)];
return [desc, name];
if (name)
utterance.push(name);
return utterance;
}
},