Bug 1678712 - Support AXLangauge. r=morgan
The important part here is to have the text leafs inherit their parents' language. Differential Revision: https://phabricator.services.mozilla.com/D212604
This commit is contained in:
@@ -338,6 +338,9 @@
|
||||
// AXPlaceholderValue
|
||||
- (NSString* _Nullable)moxPlaceholderValue;
|
||||
|
||||
// AXLanguage
|
||||
- (NSString* _Nullable)moxLanguage;
|
||||
|
||||
// AXMozDebugDescription
|
||||
- (NSString* _Nullable)moxMozDebugDescription;
|
||||
|
||||
|
||||
@@ -245,6 +245,9 @@ enum CheckedState {
|
||||
// override
|
||||
- (id)moxFocusableAncestor;
|
||||
|
||||
// override
|
||||
- (NSString*)moxLanguage;
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
// override
|
||||
- (NSString*)moxMozDebugDescription;
|
||||
|
||||
@@ -757,6 +757,15 @@ struct RoleDescrComparator {
|
||||
return [self moxEditableAncestor];
|
||||
}
|
||||
|
||||
- (NSString*)moxLanguage {
|
||||
MOZ_ASSERT(mGeckoAccessible);
|
||||
|
||||
nsAutoString lang;
|
||||
mGeckoAccessible->Language(lang);
|
||||
|
||||
return nsCocoaUtils::ToNSString(lang);
|
||||
}
|
||||
|
||||
#ifndef RELEASE_OR_BETA
|
||||
- (NSString*)moxMozDebugDescription {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
@@ -85,3 +85,21 @@ addAccessibleTask(
|
||||
},
|
||||
{ chrome: true, iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
||||
// Text leaf inherits container's AXLanguage, and container's default AXLanguage is the doc one.
|
||||
addAccessibleTask(
|
||||
`<p id="ar">العربية</p>
|
||||
<p id="es" lang="es">Español</p>`,
|
||||
async (browser, accDoc) => {
|
||||
const es = getNativeInterface(accDoc, "es");
|
||||
const ar = getNativeInterface(accDoc, "ar");
|
||||
const firstChild = a => a.getAttributeValue("AXChildren")[0];
|
||||
|
||||
is(es.getAttributeValue("AXLanguage"), "es");
|
||||
is(firstChild(es).getAttributeValue("AXLanguage"), "es");
|
||||
|
||||
is(ar.getAttributeValue("AXLanguage"), "ar");
|
||||
is(firstChild(ar).getAttributeValue("AXLanguage"), "ar");
|
||||
},
|
||||
{ chrome: true, contentDocBodyAttrs: { lang: "ar" } }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user