mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 1628922 - Support landmark navigation in GeckoView. r=Jamie
Added a traversal rule and piped through xml-roles as role descriptions. Differential Revision: https://phabricator.services.mozilla.com/D70950 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e2df076d45
commit
d09e5861c1
@ -23,6 +23,7 @@
|
||||
#include "nsIAccessibleAnnouncementEvent.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "RootAccessible.h"
|
||||
|
||||
#include "mozilla/a11y/PDocAccessibleChild.h"
|
||||
@ -544,6 +545,20 @@ void AccessibleWrap::GetRoleDescription(role aRole,
|
||||
}
|
||||
}
|
||||
|
||||
if ((aRole == roles::LANDMARK || aRole == roles::REGION) && aAttributes) {
|
||||
nsAutoString xmlRoles;
|
||||
if (NS_SUCCEEDED(aAttributes->GetStringProperty(
|
||||
NS_LITERAL_CSTRING("xml-roles"), xmlRoles))) {
|
||||
nsWhitespaceTokenizer tokenizer(xmlRoles);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
if (LocalizeString(NS_ConvertUTF16toUTF8(tokenizer.nextToken()).get(),
|
||||
aRoleDescription)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetAccService()->GetStringRole(aRole, aGeckoRole);
|
||||
LocalizeString(NS_ConvertUTF16toUTF8(aGeckoRole).get(), aRoleDescription);
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ uint16_t TraversalRule::Match(Accessible* aAccessible) {
|
||||
case java::SessionAccessibility::HTML_GRANULARITY_HEADING:
|
||||
result |= HeadingMatch(aAccessible);
|
||||
break;
|
||||
case java::SessionAccessibility::HTML_GRANULARITY_LANDMARK:
|
||||
result |= LandmarkMatch(aAccessible);
|
||||
break;
|
||||
default:
|
||||
result |= DefaultMatch(aAccessible);
|
||||
break;
|
||||
@ -150,6 +153,14 @@ uint16_t TraversalRule::SectionMatch(Accessible* aAccessible) {
|
||||
return nsIAccessibleTraversalRule::FILTER_IGNORE;
|
||||
}
|
||||
|
||||
uint16_t TraversalRule::LandmarkMatch(Accessible* aAccessible) {
|
||||
if (aAccessible->LandmarkRole()) {
|
||||
return nsIAccessibleTraversalRule::FILTER_MATCH;
|
||||
}
|
||||
|
||||
return nsIAccessibleTraversalRule::FILTER_IGNORE;
|
||||
}
|
||||
|
||||
uint16_t TraversalRule::ControlMatch(Accessible* aAccessible) {
|
||||
switch (aAccessible->Role()) {
|
||||
case roles::PUSHBUTTON:
|
||||
|
@ -45,6 +45,8 @@ class TraversalRule final : public PivotRule {
|
||||
|
||||
uint16_t SectionMatch(Accessible* aAccessible);
|
||||
|
||||
uint16_t LandmarkMatch(Accessible* aAccessible);
|
||||
|
||||
int32_t mGranularity;
|
||||
};
|
||||
|
||||
|
@ -129,6 +129,7 @@ contentinfo = content info
|
||||
main = main
|
||||
navigation = navigation
|
||||
search = search
|
||||
region = region
|
||||
|
||||
# LOCALIZATION NOTE (tblColumnInfo): Semi-colon list of plural forms.
|
||||
# Number of columns within the table.
|
||||
|
Loading…
x
Reference in New Issue
Block a user