Bug 1665962: Introduce roles::LISTITEM_MARKER to rolemap, add mac mapping to AXListMarker r=eeejay,Jamie

Differential Revision: https://phabricator.services.mozilla.com/D90745
This commit is contained in:
Morgan Reschenberg 2020-09-29 15:41:09 +00:00
Родитель 4b060415fc
Коммит 8e5014ba1b
21 изменённых файлов: 139 добавлений и 30 удалений

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

@ -1071,7 +1071,13 @@ enum Role {
*/
TIME_EDITOR = 183,
LAST_ROLE = TIME_EDITOR
/**
* Represents the marker associated with a list item. In unordered lists,
* this is a bullet, while in ordered lists this is a number.
*/
LISTITEM_MARKER = 184,
LAST_ROLE = LISTITEM_MARKER
};
} // namespace roles

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

@ -1866,4 +1866,14 @@ ROLE(TIME_EDITOR,
ROLE_SYSTEM_GROUPING,
java::SessionAccessibility::CLASSNAME_VIEW,
eNameFromSubtreeIfReqRule)
ROLE(LISTITEM_MARKER,
"list item marker",
ATK_ROLE_UNKNOWN,
@"AXListMarker",
NSAccessibilityUnknownSubrole,
ROLE_SYSTEM_STATICTEXT,
ROLE_SYSTEM_STATICTEXT,
java::SessionAccessibility::CLASSNAME_VIEW,
eNoNameRule)
// clang-format on

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

@ -578,7 +578,8 @@ TextAttrsMgr::AutoGeneratedTextAttr::AutoGeneratedTextAttr(
if (aAccessible)
mIsDefined = mNativeValue =
(aAccessible->NativeRole() == roles::STATICTEXT);
((aAccessible->NativeRole() == roles::STATICTEXT) ||
(aAccessible->NativeRole() == roles::LISTITEM_MARKER));
}
bool TextAttrsMgr::AutoGeneratedTextAttr::GetValueFor(Accessible* aAccessible,

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

@ -154,7 +154,9 @@ ENameValueFlag HTMLListBulletAccessible::Name(nsString& aName) const {
return eNameOK;
}
role HTMLListBulletAccessible::NativeRole() const { return roles::STATICTEXT; }
role HTMLListBulletAccessible::NativeRole() const {
return roles::LISTITEM_MARKER;
}
uint64_t HTMLListBulletAccessible::NativeState() const {
return LeafAccessible::NativeState() | states::READONLY;

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

@ -1065,4 +1065,10 @@ interface nsIAccessibleRole : nsISupports
*/
const unsigned long ROLE_TIME_EDITOR = 183;
/**
* Represents the marker associated with a list item. In unordered lists,
* this is a bullet, while in ordered lists this is a number.
*/
const unsigned long ROLE_LISTITEM_MARKER = 184;
};

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

@ -25,7 +25,7 @@ addAccessibleTask(
role: ROLE_LISTITEM,
children: [
{
role: ROLE_STATICTEXT,
role: ROLE_LISTITEM_MARKER,
children: [],
},
{

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

@ -37,7 +37,7 @@ addAccessibleTask(
{
role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT, name: "1. ", children: [] },
{ role: ROLE_LISTITEM_MARKER, name: "1. ", children: [] },
{ role: ROLE_TEXT_LEAF, children: [] },
],
},

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

@ -46,7 +46,7 @@ addAccessibleTask(
{
LIST: [
{
LISTITEM: [{ STATICTEXT: [] }, { TEXT_LEAF: [] }],
LISTITEM: [{ LISTITEM_MARKER: [] }, { TEXT_LEAF: [] }],
},
],
},

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

@ -117,7 +117,10 @@ addAccessibleTask(
{
LIST: [
{
LISTITEM: [{ STATICTEXT: [] }, { TEXT_LEAF: [] }],
LISTITEM: [
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
],
},
],
},

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

@ -669,7 +669,7 @@ addAccessibleTask(
range,
];
for (let i = 0; i < toCheck.length; i++) {
for (let i = 0; i < toCheck.length; i) {
is(
toCheck[i].getAttributeValue("AXValue"),
controls[i].getAttributeValue("AXValue"),
@ -1098,6 +1098,86 @@ addAccessibleTask(
}
);
/**
* Test rotor with static text
*/
addAccessibleTask(
`
<h1>Hello I am a heading</h1>
This is some regular text.<p>this is some paragraph text</p><br>
This is a list:<ul>
<li>List item one</li>
<li>List item two</li>
</ul>
<a href="http://example.com">This is a link</a>
`,
async (browser, accDoc) => {
const searchPred = {
AXSearchKey: "AXStaticTextSearchKey",
AXImmediateDescendants: 0,
AXResultsLimit: -1,
AXDirection: "AXDirectionNext",
};
const webArea = accDoc.nativeInterface.QueryInterface(
Ci.nsIAccessibleMacInterface
);
is(
webArea.getAttributeValue("AXRole"),
"AXWebArea",
"Got web area accessible"
);
const textCount = webArea.getParameterizedAttributeValue(
"AXUIElementCountForSearchPredicate",
NSDictionary(searchPred)
);
is(7, textCount, "Found 7 pieces of text");
const text = webArea.getParameterizedAttributeValue(
"AXUIElementsForSearchPredicate",
NSDictionary(searchPred)
);
is(
"Hello I am a heading",
text[0].getAttributeValue("AXValue"),
"Found correct text node for heading"
);
is(
"This is some regular text.",
text[1].getAttributeValue("AXValue"),
"Found correct text node"
);
is(
"this is some paragraph text",
text[2].getAttributeValue("AXValue"),
"Found correct text node for paragraph"
);
is(
"This is a list:",
text[3].getAttributeValue("AXValue"),
"Found correct text node for pre-list text node"
);
is(
"List item one",
text[4].getAttributeValue("AXValue"),
"Found correct text node for list item one"
);
is(
"List item two",
text[5].getAttributeValue("AXValue"),
"Found correct text node for list item two"
);
is(
"This is a link",
text[6].getAttributeValue("AXValue"),
"Found correct text node for link"
);
}
);
/**
* Test rotor with lists
*/

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

@ -1030,21 +1030,21 @@
children: [
{ role: ROLE_LISTITEM,
children: [ // home
{ role: ROLE_STATICTEXT },
{ role: ROLE_LISTITEM_MARKER },
{ role: ROLE_TEXT_LEAF }
]
},
{
role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT },
{ role: ROLE_LISTITEM_MARKER },
{ role: ROLE_TEXT_LEAF }, // about
{
role: ROLE_LIST, // menu
children: [
{ role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT },
{ role: ROLE_LISTITEM_MARKER },
{ role: ROLE_TEXT_LEAF } // our story
]
},
@ -1062,7 +1062,7 @@
{
role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT },
{ role: ROLE_LISTITEM_MARKER },
{
role: ROLE_PUSHBUTTON,
children: [
@ -1075,7 +1075,7 @@
{
role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT },
{ role: ROLE_LISTITEM_MARKER },
{
role: ROLE_PUSHBUTTON,
children: [

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

@ -62,7 +62,7 @@ var ObjectTraversalRule = {
rv = FILTER_IGNORE_SUBTREE | FILTER_MATCH;
} else if (
aAccessible.childCount == 0 &&
role != ROLE_STATICTEXT &&
role != ROLE_LISTITEM_MARKER &&
aAccessible.name.trim()
) {
rv = FILTER_MATCH;

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

@ -55,6 +55,7 @@ const ROLE_LINK = nsIAccessibleRole.ROLE_LINK;
const ROLE_LIST = nsIAccessibleRole.ROLE_LIST;
const ROLE_LISTBOX = nsIAccessibleRole.ROLE_LISTBOX;
const ROLE_LISTITEM = nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_LISTITEM_MARKER = nsIAccessibleRole.ROLE_LISTITEM_MARKER;
const ROLE_MARK = nsIAccessibleRole.ROLE_MARK;
const ROLE_MATHML_MATH = nsIAccessibleRole.ROLE_MATHML_MATH;
const ROLE_MATHML_IDENTIFIER = nsIAccessibleRole.ROLE_MATHML_IDENTIFIER;

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

@ -19,7 +19,7 @@
{ SECTION: [ // container
{ MENUPOPUP: [ // menu
{ MENUITEM: [
{ STATICTEXT: [] }, // bullet
{ LISTITEM_MARKER: [] }, // bullet
{ TEXT_LEAF: [] },
] },
] },
@ -31,7 +31,7 @@
{ SECTION: [ // container
{ MENUPOPUP: [ // menu
{ MENUITEM: [
{ STATICTEXT: [] }, // bullet
{ LISTITEM_MARKER: [] }, // bullet
{ TEXT_LEAF: [] },
] },
] },
@ -43,7 +43,7 @@
{ SECTION: [ // container
{ MENUPOPUP: [ // menu
{ PARENT_MENUITEM: [ // menuitem with aria-haspopup="true"
{ STATICTEXT: [] }, // bullet
{ LISTITEM_MARKER: [] }, // bullet
{ TEXT_LEAF: [] },
] },
] },

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

@ -77,11 +77,11 @@
tree =
{ PUSHBUTTON: [ // ul
{ TEXT_CONTAINER: [ // li
{ STATICTEXT: [ ] },
{ LISTITEM_MARKER: [ ] },
{ TEXT_LEAF: [ ] },
] },
{ TEXT_CONTAINER: [ // span styled as a list
{ STATICTEXT: [ ] },
{ LISTITEM_MARKER: [ ] },
{ TEXT_LEAF: [ ] },
] },
] };
@ -90,7 +90,7 @@
tree =
{ PUSHBUTTON: [ // ol
{ TEXT_CONTAINER: [ // li
{ STATICTEXT: [ ] },
{ LISTITEM_MARKER: [ ] },
{ TEXT_LEAF: [ ] },
] },
] };

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

@ -18,11 +18,11 @@ function doTest() {
let tree =
{ LIST: [
{ LISTITEM: [
{ STATICTEXT: [] },
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
]},
{ LISTITEM: [
{ STATICTEXT: [] },
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
]},
] };

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

@ -18,7 +18,7 @@
role: ROLE_LISTITEM,
children: [
{
role: ROLE_STATICTEXT,
role: ROLE_LISTITEM_MARKER,
name: aBulletText,
},
{
@ -106,7 +106,7 @@
tree =
{ LIST: [ // ol
{ LISTITEM: [ // li
{ STATICTEXT: [ ] },
{ LISTITEM_MARKER: [ ] },
{ DEFINITION_LIST: [ // dl
{ TERM: [ // dt
{ TEXT_LEAF: [] },

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

@ -197,7 +197,7 @@
function listItemReframe() {
testAccessibleTree("li",{ LISTITEM: [
{ STATICTEXT: [] },
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
] });
@ -206,7 +206,7 @@
window.windowUtils.advanceTimeAndRefresh(100);
testAccessibleTree("li",{ LISTITEM: [
{ STATICTEXT: [] },
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
] });

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

@ -120,7 +120,7 @@
{ SECTION: [ // container
{ LIST: [
{ LISTITEM: [
{ STATICTEXT: [] },
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
] },
] },

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

@ -26,7 +26,7 @@
role: ROLE_LISTITEM,
children: [
{
role: ROLE_STATICTEXT,
role: ROLE_LISTITEM_MARKER,
children: [],
},
{
@ -87,7 +87,7 @@
this.onProcessed = function textReplaceProcessor_onProcessed() {
var tree = {
LISTITEM: [
{ STATICTEXT: [] },
{ LISTITEM_MARKER: [] },
{ TEXT_LEAF: [] },
],
};

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

@ -42,7 +42,7 @@
role: ROLE_LISTITEM,
children: [
{
role: ROLE_STATICTEXT,
role: ROLE_LISTITEM_MARKER,
name: "1. ",
children: [],
},