mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 924284 - Output accessible values. r=yzen
This commit is contained in:
parent
42c89d9026
commit
1ed676b7ac
@ -11,8 +11,9 @@ const Cr = Components.results;
|
||||
|
||||
const INCLUDE_DESC = 0x01;
|
||||
const INCLUDE_NAME = 0x02;
|
||||
const INCLUDE_CUSTOM = 0x04;
|
||||
const NAME_FROM_SUBTREE_RULE = 0x08;
|
||||
const INCLUDE_VALUE = 0x04;
|
||||
const INCLUDE_CUSTOM = 0x08;
|
||||
const NAME_FROM_SUBTREE_RULE = 0x10;
|
||||
|
||||
const OUTPUT_DESC_FIRST = 0;
|
||||
const OUTPUT_DESC_LAST = 1;
|
||||
@ -64,8 +65,9 @@ this.OutputGenerator = {
|
||||
let nameRule = self.roleRuleMap[roleString] || 0;
|
||||
// Ignore subtree if the name is explicit and the role's name rule is the
|
||||
// NAME_FROM_SUBTREE_RULE.
|
||||
return (nameRule & NAME_FROM_SUBTREE_RULE) &&
|
||||
(Utils.getAttributes(aAccessible)['explicit-name'] === 'true');
|
||||
return (((nameRule & INCLUDE_VALUE) && aAccessible.value) ||
|
||||
((nameRule & NAME_FROM_SUBTREE_RULE) &&
|
||||
Utils.getAttributes(aAccessible)['explicit-name'] === 'true'));
|
||||
};
|
||||
|
||||
let contextStart = this._getContextStart(aContext);
|
||||
@ -256,9 +258,9 @@ this.OutputGenerator = {
|
||||
'buttondropdown': NAME_FROM_SUBTREE_RULE,
|
||||
'combobox': INCLUDE_DESC,
|
||||
'droplist': INCLUDE_DESC,
|
||||
'progressbar': INCLUDE_DESC,
|
||||
'slider': INCLUDE_DESC,
|
||||
'spinbutton': INCLUDE_DESC,
|
||||
'progressbar': INCLUDE_DESC | INCLUDE_VALUE,
|
||||
'slider': INCLUDE_DESC | INCLUDE_VALUE,
|
||||
'spinbutton': INCLUDE_DESC | INCLUDE_VALUE,
|
||||
'diagram': INCLUDE_DESC,
|
||||
'animation': INCLUDE_DESC,
|
||||
'equation': INCLUDE_DESC,
|
||||
@ -278,7 +280,7 @@ this.OutputGenerator = {
|
||||
'parent menuitem': NAME_FROM_SUBTREE_RULE,
|
||||
'header': INCLUDE_DESC,
|
||||
'footer': INCLUDE_DESC,
|
||||
'entry': INCLUDE_DESC | INCLUDE_NAME,
|
||||
'entry': INCLUDE_DESC | INCLUDE_NAME | INCLUDE_VALUE,
|
||||
'caption': INCLUDE_DESC,
|
||||
'document frame': INCLUDE_DESC,
|
||||
'heading': INCLUDE_DESC,
|
||||
@ -309,6 +311,14 @@ this.OutputGenerator = {
|
||||
output.push(desc.join(' '));
|
||||
}
|
||||
|
||||
if (aFlags & INCLUDE_VALUE) {
|
||||
let value = aAccessible.value;
|
||||
if (value) {
|
||||
output[this.outputOrder === OUTPUT_DESC_FIRST ?
|
||||
'push' : 'unshift'](value);
|
||||
}
|
||||
}
|
||||
|
||||
this._addName(output, aAccessible, aFlags);
|
||||
this._addLandmark(output, aAccessible);
|
||||
|
||||
@ -327,18 +337,10 @@ this.OutputGenerator = {
|
||||
},
|
||||
|
||||
entry: function entry(aAccessible, aRoleStr, aStates, aFlags) {
|
||||
let output = [];
|
||||
let desc = this._getLocalizedStates(aStates);
|
||||
desc.push(this._getLocalizedRole(
|
||||
(aStates.ext & Ci.nsIAccessibleStates.EXT_STATE_MULTI_LINE) ?
|
||||
'textarea' : 'entry'));
|
||||
|
||||
output.push(desc.join(' '));
|
||||
|
||||
this._addName(output, aAccessible, aFlags);
|
||||
this._addLandmark(output, aAccessible);
|
||||
|
||||
return output;
|
||||
let rolestr = (aStates.ext & Ci.nsIAccessibleStates.EXT_STATE_MULTI_LINE) ?
|
||||
'textarea' : 'entry';
|
||||
return this.objectOutputFunctions.defaultFunc.apply(
|
||||
this, [aAccessible, rolestr, aStates, aFlags]);
|
||||
},
|
||||
|
||||
pagetab: function pagetab(aAccessible, aRoleStr, aStates, aFlags) {
|
||||
|
@ -25,7 +25,9 @@ function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator
|
||||
var output = aGenerator.genForContext(context).output;
|
||||
|
||||
isDeeply(output, expected,
|
||||
"Context output is correct for " + aAccOrElmOrID);
|
||||
"Context output is correct for " + aAccOrElmOrID +
|
||||
" (output: " + output.join(", ") + ") ==" +
|
||||
" (expected: " + expected.join(", ") + ")");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=876475
|
||||
},{
|
||||
accOrElmOrID: "textarea",
|
||||
expected: [["txtarea", "Here lies treasure."], ["Here lies treasure.", "txtarea"]]
|
||||
},{
|
||||
accOrElmOrID: "textentry",
|
||||
expected: [["entry", "Mario", "First name:"], ["First name:", "Mario", "entry"]]
|
||||
},{
|
||||
accOrElmOrID: "range",
|
||||
expected: [["slider", "3", "Points:"], ["Points:", "3", "slider"]]
|
||||
}];
|
||||
|
||||
// Test all possible braille order preference values.
|
||||
@ -109,6 +115,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=876475
|
||||
<textarea id="textarea" cols="80" rows="5">
|
||||
Here lies treasure.
|
||||
</textarea>
|
||||
<label>First name: <input id="textentry" value="Mario"></label>
|
||||
<label>Points: <input id="range" type="range" name="points" min="1" max="10" value="3"></label>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,7 +28,7 @@
|
||||
expected: ["button", "Press me"]
|
||||
}, {
|
||||
accOrElmOrID: "textarea1",
|
||||
expected: ["text area", "Test Text Area", "This is the text area text."]
|
||||
expected: ["text area", "This is the text area text.", "Test Text Area"]
|
||||
}, {
|
||||
accOrElmOrID: "textarea2",
|
||||
expected: ["text area", "This is the text area text."]
|
||||
|
@ -171,6 +171,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
accOrElmOrID: "input1",
|
||||
expected: [['not checked check button', 'Orange'],
|
||||
['Orange', 'not checked check button']]
|
||||
},
|
||||
{
|
||||
// Landing on this label should mimic landing on the entry.
|
||||
accOrElmOrID: "label3",
|
||||
expected: [['entry', 'Joe', 'First name:'],
|
||||
['First name:', 'Joe', 'entry']]
|
||||
},
|
||||
{
|
||||
// This is a nested control with a value.
|
||||
accOrElmOrID: "input3",
|
||||
expected: [['entry', 'Joe', 'First name:'],
|
||||
['First name:', 'Joe', 'entry']]
|
||||
},
|
||||
{
|
||||
// This is a nested control with a value.
|
||||
accOrElmOrID: "input4",
|
||||
expected: [['slider', '3', 'Points:'],
|
||||
['Points:', '3', 'slider']]
|
||||
}];
|
||||
|
||||
// Test all possible utterance order preference values.
|
||||
@ -254,6 +272,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
<label id="label1"><input id="input1" type="checkbox">Orange</label>
|
||||
<input id="input2" type="checkbox"><label id="label2" for="input2">Blue</label>
|
||||
</form>
|
||||
<label id="label3">First name: <input id="input3" value="Joe"></label>
|
||||
<label id="label4">Points:
|
||||
<input id="input4" type="range" name="points" min="1" max="10" value="3">
|
||||
</label>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user