mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 972630 - Add a flag to ignore explicit names, and ignore names of chrome window and app root. r=yzen
This commit is contained in:
parent
8962e6363c
commit
a1c009c3d7
@ -14,6 +14,7 @@ const INCLUDE_NAME = 0x02;
|
||||
const INCLUDE_VALUE = 0x04;
|
||||
const INCLUDE_CUSTOM = 0x08;
|
||||
const NAME_FROM_SUBTREE_RULE = 0x10;
|
||||
const IGNORE_EXPLICIT_NAME = 0x20;
|
||||
|
||||
const OUTPUT_DESC_FIRST = 0;
|
||||
const OUTPUT_DESC_LAST = 1;
|
||||
@ -67,7 +68,8 @@ this.OutputGenerator = {
|
||||
// NAME_FROM_SUBTREE_RULE.
|
||||
return (((nameRule & INCLUDE_VALUE) && aAccessible.value) ||
|
||||
((nameRule & NAME_FROM_SUBTREE_RULE) &&
|
||||
Utils.getAttributes(aAccessible)['explicit-name'] === 'true'));
|
||||
(Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
|
||||
!(nameRule & IGNORE_EXPLICIT_NAME))));
|
||||
};
|
||||
|
||||
let contextStart = this._getContextStart(aContext);
|
||||
@ -157,8 +159,8 @@ this.OutputGenerator = {
|
||||
|
||||
_addName: function _addName(aOutput, aAccessible, aFlags) {
|
||||
let name;
|
||||
if (Utils.getAttributes(aAccessible)['explicit-name'] === 'true' ||
|
||||
(aFlags & INCLUDE_NAME)) {
|
||||
if ((Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
|
||||
!(aFlags & IGNORE_EXPLICIT_NAME)) || (aFlags & INCLUDE_NAME)) {
|
||||
name = aAccessible.name;
|
||||
}
|
||||
|
||||
@ -319,7 +321,9 @@ this.OutputGenerator = {
|
||||
'option': INCLUDE_DESC,
|
||||
'listbox': INCLUDE_DESC,
|
||||
'definitionlist': INCLUDE_DESC | INCLUDE_NAME,
|
||||
'dialog': INCLUDE_DESC | INCLUDE_NAME },
|
||||
'dialog': INCLUDE_DESC | INCLUDE_NAME,
|
||||
'chrome window': IGNORE_EXPLICIT_NAME,
|
||||
'app root': IGNORE_EXPLICIT_NAME },
|
||||
|
||||
objectOutputFunctions: {
|
||||
_generateBaseOutput: function _generateBaseOutput(aAccessible, aRoleStr, aState, aFlags) {
|
||||
|
@ -18,13 +18,26 @@ Cu.import("resource://gre/modules/accessibility/OutputGenerator.jsm", this);
|
||||
* scoped to the "root" element in markup.
|
||||
*/
|
||||
function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator) {
|
||||
aOldAccOrElmOrID = aOldAccOrElmOrID || "root";
|
||||
var accessible = getAccessible(aAccOrElmOrID);
|
||||
var oldAccessible = getAccessible(aOldAccOrElmOrID);
|
||||
var oldAccessible = aOldAccOrElmOrID !== null ?
|
||||
getAccessible(aOldAccOrElmOrID || 'root') : null;
|
||||
var context = new PivotContext(accessible, oldAccessible);
|
||||
var output = aGenerator.genForContext(context).output;
|
||||
|
||||
isDeeply(output, expected,
|
||||
// Create a version of the output that has null members where we have
|
||||
// null members in the expected output. Those are indexes that are not testable
|
||||
// because of the changing nature of the test (different window names), or strings
|
||||
// that are inaccessible to us, like the title of parent documents.
|
||||
var masked_output = [];
|
||||
for (var i=0; i < output.length; i++) {
|
||||
if (expected[i] === null) {
|
||||
masked_output.push(null);
|
||||
} else {
|
||||
masked_output[i] = output[i];
|
||||
}
|
||||
}
|
||||
|
||||
isDeeply(masked_output, expected,
|
||||
"Context output is correct for " + aAccOrElmOrID +
|
||||
" (output: " + output.join(", ") + ") ==" +
|
||||
" (expected: " + expected.join(", ") + ")");
|
||||
|
@ -35,6 +35,11 @@
|
||||
}, {
|
||||
accOrElmOrID: "heading1",
|
||||
expected: ["heading level 1", "Test heading", "This is the heading."]
|
||||
}, {
|
||||
accOrElmOrID: "heading1",
|
||||
oldAccOrElmOrID: null,
|
||||
expected: [null /* parent doc title */, document.title,
|
||||
"heading level 1", "Test heading", "This is the heading."]
|
||||
}, {
|
||||
accOrElmOrID: "heading2",
|
||||
expected: ["heading level 1", "This is the heading."]
|
||||
|
Loading…
Reference in New Issue
Block a user