Bug 1635184 - Add actual support for input type='search' in MacOS, r=eeejay

The code in mozAccessible SubRole was actually never executed for inputs, so the SearchField sub role was never set. Moved the implementation to mozTextAccessible. Also reenabled the tests from bug 1634373, which now pass.

Depends on D73308

Differential Revision: https://phabricator.services.mozilla.com/D73735
This commit is contained in:
Marco Zehe 2020-05-05 17:45:52 +00:00
parent 69ff16e0cd
commit 0eedff8d8e
3 changed files with 10 additions and 12 deletions

View file

@ -903,7 +903,6 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
if (landmark == nsGkAtoms::main) return @"AXLandmarkMain"; if (landmark == nsGkAtoms::main) return @"AXLandmarkMain";
if (landmark == nsGkAtoms::navigation) return @"AXLandmarkNavigation"; if (landmark == nsGkAtoms::navigation) return @"AXLandmarkNavigation";
if (landmark == nsGkAtoms::search) return @"AXLandmarkSearch"; if (landmark == nsGkAtoms::search) return @"AXLandmarkSearch";
if (landmark == nsGkAtoms::searchbox) return @"AXSearchField";
} }
// macOS groups the specific landmark types of DPub ARIA into two broad // macOS groups the specific landmark types of DPub ARIA into two broad
@ -940,11 +939,6 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
case roles::LIST: case roles::LIST:
return @"AXContentList"; // 10.6+ NSAccessibilityContentListSubrole; return @"AXContentList"; // 10.6+ NSAccessibilityContentListSubrole;
case roles::ENTRY:
if ((accWrap && accWrap->IsSearchbox()) || (proxy && proxy->IsSearchbox()))
return @"AXSearchField";
break;
case roles::DEFINITION_LIST: case roles::DEFINITION_LIST:
return @"AXDefinitionList"; // 10.6+ NSAccessibilityDefinitionListSubrole; return @"AXDefinitionList"; // 10.6+ NSAccessibilityDefinitionListSubrole;

View file

@ -345,6 +345,14 @@ inline NSString* ToNSString(id aValue) {
- (NSString*)subrole { - (NSString*)subrole {
if (mRole == roles::PASSWORD_TEXT) return NSAccessibilitySecureTextFieldSubrole; if (mRole == roles::PASSWORD_TEXT) return NSAccessibilitySecureTextFieldSubrole;
if (mRole == roles::ENTRY) {
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];
if ((accWrap && accWrap->IsSearchbox()) || (proxy && proxy->IsSearchbox())) {
return @"AXSearchField";
}
}
return nil; return nil;
} }

View file

@ -92,9 +92,7 @@ addAccessibleTask(
testRoleAndSubRole(accDoc, "main", null, "AXLandmarkMain"); testRoleAndSubRole(accDoc, "main", null, "AXLandmarkMain");
testRoleAndSubRole(accDoc, "navigation", null, "AXLandmarkNavigation"); testRoleAndSubRole(accDoc, "navigation", null, "AXLandmarkNavigation");
testRoleAndSubRole(accDoc, "search", null, "AXLandmarkSearch"); testRoleAndSubRole(accDoc, "search", null, "AXLandmarkSearch");
// XXX Bug 1635184 remove this todo and uncomment the below test call. testRoleAndSubRole(accDoc, "searchbox", null, "AXSearchField");
todo(false, "Bug 1635184 - Exposure of SearchField subrole not working.");
// testRoleAndSubRole(accDoc, "searchbox", null, "AXSearchField");
// DPub roles map into two categories, sample one of each // DPub roles map into two categories, sample one of each
testRoleAndSubRole( testRoleAndSubRole(
@ -123,9 +121,7 @@ addAccessibleTask(
testRoleAndSubRole(accDoc, "tooltip", null, "AXUserInterfaceTooltip"); testRoleAndSubRole(accDoc, "tooltip", null, "AXUserInterfaceTooltip");
// True HTML5 search field // True HTML5 search field
// XXX Bug 1635184 remove this todo and uncomment the below test call. testRoleAndSubRole(accDoc, "htmlSearch", "AXTextField", "AXSearchField");
todo(false, "Bug 1635184 - Exposure of SearchField subrole not working.");
// testRoleAndSubRole(accDoc, "htmlSearch", "AXTextField", "AXSearchField");
// A button morphed into a toggle by ARIA // A button morphed into a toggle by ARIA
testRoleAndSubRole(accDoc, "toggle", "AXCheckBox", "AXToggle"); testRoleAndSubRole(accDoc, "toggle", "AXCheckBox", "AXToggle");