Bug 1668663: Add support for navigation by blockquote r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D92145
This commit is contained in:
Morgan Reschenberg 2020-10-05 19:52:09 +00:00
parent a20d386028
commit 8ea7a5cbaf
3 changed files with 77 additions and 4 deletions

View File

@ -242,10 +242,9 @@ using namespace mozilla::a11y;
}
if ([key isEqualToString:@"AXCheckboxSearchKey"]) {
RotorRoleRule rule =
mImmediateDescendantsOnly
? RotorRoleRule(roles::CHECKBUTTON, geckoRootAcc)
: RotorRoleRule(roles::CHECKBUTTON);
RotorRoleRule rule = mImmediateDescendantsOnly
? RotorRoleRule(roles::CHECKBUTTON, geckoRootAcc)
: RotorRoleRule(roles::CHECKBUTTON);
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
}
@ -255,6 +254,13 @@ using namespace mozilla::a11y;
: RotorStaticTextRule();
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
}
if ([key isEqualToString:@"AXBlockquoteSearchKey"]) {
RotorRoleRule rule = mImmediateDescendantsOnly
? RotorRoleRule(roles::BLOCKQUOTE, geckoRootAcc)
: RotorRoleRule(roles::BLOCKQUOTE);
[matches addObjectsFromArray:[self getMatchesForRule:rule]];
}
}
return matches;

View File

@ -36,3 +36,4 @@ skip-if = os == 'mac' && debug # Bug 1664577
[browser_rotor.js]
[browser_rootgroup.js]
[browser_text_selection.js]
[browser_navigate.js]

View File

@ -0,0 +1,66 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/*
* Test rotor with blockquotes
*/
addAccessibleTask(
`
<blockquote id="first">hello I am a blockquote</blockquote>
<blockquote id="second">
I am also a blockquote of the same level
<br>
<blockquote id="third">but I have a different level</blockquote>
</blockquote>
`,
(browser, accDoc) => {
let searchPred = {
AXSearchKey: "AXBlockquoteSearchKey",
AXImmediateDescendantsOnly: 0,
AXResultsLimit: -1,
AXDirection: "AXDirectionNext",
};
const webArea = accDoc.nativeInterface.QueryInterface(
Ci.nsIAccessibleMacInterface
);
is(
webArea.getAttributeValue("AXRole"),
"AXWebArea",
"Got web area accessible"
);
let bquotes = webArea.getParameterizedAttributeValue(
"AXUIElementsForSearchPredicate",
NSDictionary(searchPred)
);
is(bquotes.length, 3, "Found three blockquotes");
const first = getNativeInterface(accDoc, "first");
const second = getNativeInterface(accDoc, "second");
const third = getNativeInterface(accDoc, "third");
console.log("values :");
console.log(first.getAttributeValue("AXValue"));
is(
first.getAttributeValue("AXValue"),
bquotes[0].getAttributeValue("AXValue"),
"Found correct first blockquote"
);
is(
second.getAttributeValue("AXValue"),
bquotes[1].getAttributeValue("AXValue"),
"Found correct second blockquote"
);
is(
third.getAttributeValue("AXValue"),
bquotes[2].getAttributeValue("AXValue"),
"Found correct third blockquote"
);
}
);