Bug 1666348: Add support for AXListSearchKey to VO rotor r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D90917
This commit is contained in:
Morgan Reschenberg 2020-09-21 23:15:33 +00:00
parent 22f3d85175
commit a5ce9d8bd3
4 changed files with 78 additions and 0 deletions

View File

@ -151,6 +151,13 @@ using namespace mozilla::a11y;
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
}
if ([key isEqualToString:@"AXListSearchKey"]) {
RotorListRule rule = mImmediateDescendantsOnly
? RotorListRule(geckoStartAcc)
: RotorListRule();
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
}
if ([key isEqualToString:@"AXLinkSearchKey"]) {
RotorLinkRule rule = mImmediateDescendantsOnly
? RotorLinkRule(geckoStartAcc)

View File

@ -39,6 +39,12 @@ class RotorLandmarkRule final : public PivotRoleRule {
explicit RotorLandmarkRule(AccessibleOrProxy& aDirectDescendantsFrom);
};
class RotorListRule final : public PivotRoleRule {
public:
explicit RotorListRule();
explicit RotorListRule(AccessibleOrProxy& aDirectDescendantsFrom);
};
class RotorButtonRule final : public PivotRoleRule {
public:
explicit RotorButtonRule();

View File

@ -34,6 +34,11 @@ RotorLandmarkRule::RotorLandmarkRule() : PivotRoleRule(roles::LANDMARK) {}
RotorLandmarkRule::RotorLandmarkRule(AccessibleOrProxy& aDirectDescendantsFrom)
: PivotRoleRule(roles::LANDMARK, aDirectDescendantsFrom) {}
RotorListRule::RotorListRule() : PivotRoleRule(roles::LIST) {}
RotorListRule::RotorListRule(AccessibleOrProxy& aDirectDescendantsFrom)
: PivotRoleRule(roles::LIST, aDirectDescendantsFrom) {}
RotorButtonRule::RotorButtonRule() : PivotRoleRule(roles::PUSHBUTTON) {}
RotorButtonRule::RotorButtonRule(AccessibleOrProxy& aDirectDescendantsFrom)

View File

@ -1049,6 +1049,66 @@ addAccessibleTask(
}
);
/**
* Test rotor with lists
*/
addAccessibleTask(
`
<ul id="unordered">
<li>hello</li>
<li>world</li>
</ul>
<ol id="ordered">
<li>item one</li>
<li>item two</li>
</ol>
`,
async (browser, accDoc) => {
const searchPred = {
AXSearchKey: "AXListSearchKey",
AXImmediateDescendants: 1,
AXResultsLimit: -1,
AXDirection: "AXDirectionNext",
};
const webArea = accDoc.nativeInterface.QueryInterface(
Ci.nsIAccessibleMacInterface
);
is(
webArea.getAttributeValue("AXRole"),
"AXWebArea",
"Got web area accessible"
);
const listCount = webArea.getParameterizedAttributeValue(
"AXUIElementCountForSearchPredicate",
NSDictionary(searchPred)
);
is(2, listCount, "Found 2 lists");
const lists = webArea.getParameterizedAttributeValue(
"AXUIElementsForSearchPredicate",
NSDictionary(searchPred)
);
const ordered = getNativeInterface(accDoc, "ordered");
const unordered = getNativeInterface(accDoc, "unordered");
is(
unordered.getAttributeValue("AXChildren")[0].getAttributeValue("AXTitle"),
lists[0].getAttributeValue("AXChildren")[0].getAttributeValue("AXTitle"),
"Found correct unordered list"
);
is(
ordered.getAttributeValue("AXChildren")[0].getAttributeValue("AXTitle"),
lists[1].getAttributeValue("AXChildren")[0].getAttributeValue("AXTitle"),
"Found correct ordered list"
);
}
);
/*
* Test rotor with images
*/