зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1641932: Add Mac subroles to role map. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D77500
This commit is contained in:
Родитель
529ff034d6
Коммит
3083026d43
|
@ -579,9 +579,9 @@ AccessibleWrap::AttributeArrayToProperties(
|
|||
}
|
||||
|
||||
int32_t AccessibleWrap::GetAndroidClass(role aRole) {
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
return androidClass;
|
||||
|
||||
switch (aRole) {
|
||||
|
|
|
@ -583,10 +583,10 @@ AtkRole getRoleCB(AtkObject* aAtkObj) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
aAtkObj->role = atkRole; \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
aAtkObj->role = atkRole; \
|
||||
break;
|
||||
|
||||
switch (acc.Role()) {
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
static_assert( \
|
||||
static_cast<uint32_t>(roles::geckoRole) == \
|
||||
static_cast<uint32_t>(nsIAccessibleRole::ROLE_##geckoRole), \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
static_assert( \
|
||||
static_cast<uint32_t>(roles::geckoRole) == \
|
||||
static_cast<uint32_t>(nsIAccessibleRole::ROLE_##geckoRole), \
|
||||
"internal and xpcom roles differ!");
|
||||
#include "RoleMap.h"
|
||||
#undef ROLE
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -678,10 +678,10 @@ void nsAccessibilityService::RecreateAccessible(PresShell* aPresShell,
|
|||
}
|
||||
|
||||
void nsAccessibilityService::GetStringRole(uint32_t aRole, nsAString& aString) {
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
aString.AssignLiteral(stringRole); \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
aString.AssignLiteral(stringRole); \
|
||||
return;
|
||||
|
||||
switch (aRole) {
|
||||
|
|
|
@ -313,9 +313,9 @@ bool nsTextEquivUtils::AppendString(nsAString* aString,
|
|||
}
|
||||
|
||||
uint32_t nsTextEquivUtils::GetRoleRule(role aRole) {
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
return nameRule;
|
||||
|
||||
switch (aRole) {
|
||||
|
|
|
@ -345,8 +345,9 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
|
|||
}
|
||||
|
||||
- (NSString*)moxRole {
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, androidClass, nameRule) \
|
||||
case roles::geckoRole: \
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, ia2Role, androidClass, \
|
||||
nameRule) \
|
||||
case roles::geckoRole: \
|
||||
return macRole;
|
||||
|
||||
switch (mRole) {
|
||||
|
@ -368,7 +369,6 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
|
|||
// Deal with landmarks first
|
||||
// macOS groups the specific landmark types of DPub ARIA into two broad
|
||||
// categories with corresponding subroles: Navigation and region/container.
|
||||
if (mRole == roles::NAVIGATION) return @"AXLandmarkNavigation";
|
||||
if (mRole == roles::LANDMARK) {
|
||||
nsAtom* landmark = acc ? acc->LandmarkRole() : proxy->LandmarkRole();
|
||||
// HTML Elements treated as landmarks, and ARIA landmarks.
|
||||
|
@ -387,197 +387,74 @@ static const uint64_t kCacheInitialized = ((uint64_t)0x1) << 63;
|
|||
|
||||
// Now, deal with widget roles
|
||||
nsStaticAtom* roleAtom = nullptr;
|
||||
switch (mRole) {
|
||||
case roles::LIST:
|
||||
return @"AXContentList"; // 10.6+ NSAccessibilityContentListSubrole;
|
||||
|
||||
case roles::DEFINITION_LIST:
|
||||
return @"AXDefinitionList"; // 10.6+ NSAccessibilityDefinitionListSubrole;
|
||||
if (mRole == roles::DIALOG) {
|
||||
if (acc && acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
roleAtom = roleMap->roleAtom;
|
||||
} else if (proxy) {
|
||||
roleAtom = proxy->ARIARoleAtom();
|
||||
}
|
||||
|
||||
case roles::TERM:
|
||||
return @"AXTerm";
|
||||
|
||||
case roles::DEFINITION:
|
||||
return @"AXDefinition";
|
||||
|
||||
case roles::MATHML_MATH:
|
||||
return @"AXDocumentMath";
|
||||
|
||||
case roles::MATHML_FRACTION:
|
||||
return @"AXMathFraction";
|
||||
|
||||
case roles::MATHML_FENCED:
|
||||
// XXX bug 1176970
|
||||
// This should be AXMathFence, but doing so without implementing the
|
||||
// whole fence interface seems to make VoiceOver crash, so we present it
|
||||
// as a row for now.
|
||||
return @"AXMathRow";
|
||||
|
||||
case roles::MATHML_SUB:
|
||||
case roles::MATHML_SUP:
|
||||
case roles::MATHML_SUB_SUP:
|
||||
return @"AXMathSubscriptSuperscript";
|
||||
|
||||
case roles::MATHML_ROW:
|
||||
case roles::MATHML_STYLE:
|
||||
case roles::MATHML_ERROR:
|
||||
return @"AXMathRow";
|
||||
|
||||
case roles::MATHML_UNDER:
|
||||
case roles::MATHML_OVER:
|
||||
case roles::MATHML_UNDER_OVER:
|
||||
return @"AXMathUnderOver";
|
||||
|
||||
case roles::MATHML_SQUARE_ROOT:
|
||||
return @"AXMathSquareRoot";
|
||||
|
||||
case roles::MATHML_ROOT:
|
||||
return @"AXMathRoot";
|
||||
|
||||
case roles::MATHML_TEXT:
|
||||
return @"AXMathText";
|
||||
|
||||
case roles::MATHML_NUMBER:
|
||||
return @"AXMathNumber";
|
||||
|
||||
case roles::MATHML_IDENTIFIER:
|
||||
return @"AXMathIdentifier";
|
||||
|
||||
case roles::MATHML_TABLE:
|
||||
return @"AXMathTable";
|
||||
|
||||
case roles::MATHML_TABLE_ROW:
|
||||
return @"AXMathTableRow";
|
||||
|
||||
case roles::MATHML_CELL:
|
||||
return @"AXMathTableCell";
|
||||
|
||||
// XXX: NSAccessibility also uses subroles AXMathSeparatorOperator and
|
||||
// AXMathFenceOperator. We should use the NS_MATHML_OPERATOR_FENCE and
|
||||
// NS_MATHML_OPERATOR_SEPARATOR bits of nsOperatorFlags, but currently they
|
||||
// are only available from the MathML layout code. Hence we just fallback
|
||||
// to subrole AXMathOperator for now.
|
||||
// XXX bug 1175747 WebKit also creates anonymous operators for <mfenced>
|
||||
// which have subroles AXMathSeparatorOperator and AXMathFenceOperator.
|
||||
case roles::MATHML_OPERATOR:
|
||||
return @"AXMathOperator";
|
||||
|
||||
case roles::MATHML_MULTISCRIPTS:
|
||||
return @"AXMathMultiscript";
|
||||
|
||||
case roles::SWITCH:
|
||||
return @"AXSwitch";
|
||||
|
||||
case roles::ALERT:
|
||||
return @"AXApplicationAlert";
|
||||
|
||||
case roles::DIALOG:
|
||||
if (acc && acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
roleAtom = roleMap->roleAtom;
|
||||
if (roleAtom) {
|
||||
if (roleAtom == nsGkAtoms::alertdialog) {
|
||||
return @"AXApplicationAlertDialog";
|
||||
}
|
||||
if (proxy) roleAtom = proxy->ARIARoleAtom();
|
||||
if (roleAtom) {
|
||||
if (roleAtom == nsGkAtoms::alertdialog) return @"AXApplicationAlertDialog";
|
||||
if (roleAtom == nsGkAtoms::dialog) return @"AXApplicationDialog";
|
||||
if (roleAtom == nsGkAtoms::dialog) {
|
||||
return @"AXApplicationDialog";
|
||||
}
|
||||
break;
|
||||
|
||||
case roles::APPLICATION:
|
||||
return @"AXLandmarkApplication";
|
||||
|
||||
case roles::FORM:
|
||||
// This only gets exposed as a landmark if the role comes from ARIA.
|
||||
if (acc && acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
roleAtom = roleMap->roleAtom;
|
||||
}
|
||||
if (proxy) roleAtom = proxy->ARIARoleAtom();
|
||||
if (roleAtom && roleAtom == nsGkAtoms::form) return @"AXLandmarkForm";
|
||||
break;
|
||||
|
||||
case roles::FORM_LANDMARK:
|
||||
// This is a form element that got landmark properties via an accessible
|
||||
// name.
|
||||
return @"AXLandmarkForm";
|
||||
|
||||
case roles::ANIMATION:
|
||||
return @"AXApplicationMarquee";
|
||||
|
||||
case roles::FLAT_EQUATION:
|
||||
return @"AXDocumentMath";
|
||||
|
||||
case roles::REGION:
|
||||
return @"AXLandmarkRegion";
|
||||
|
||||
case roles::STATUSBAR:
|
||||
return @"AXApplicationStatus";
|
||||
|
||||
case roles::PROPERTYPAGE:
|
||||
return @"AXTabPanel";
|
||||
|
||||
case roles::TOOLTIP:
|
||||
return @"AXUserInterfaceTooltip";
|
||||
|
||||
case roles::DETAILS:
|
||||
return @"AXDetails";
|
||||
|
||||
case roles::SUMMARY:
|
||||
return @"AXSummary";
|
||||
|
||||
case roles::NOTE:
|
||||
return @"AXDocumentNote";
|
||||
|
||||
case roles::OUTLINEITEM:
|
||||
return @"AXOutlineRow";
|
||||
|
||||
case roles::ARTICLE:
|
||||
return @"AXDocumentArticle";
|
||||
|
||||
case roles::NON_NATIVE_DOCUMENT:
|
||||
return @"AXDocument";
|
||||
|
||||
case roles::CONTENT_DELETION:
|
||||
return @"AXDeleteStyleGroup";
|
||||
|
||||
case roles::CONTENT_INSERTION:
|
||||
return @"AXInsertStyleGroup";
|
||||
|
||||
case roles::CODE:
|
||||
return @"AXCodeStyleGroup";
|
||||
|
||||
case roles::TOGGLE_BUTTON:
|
||||
return @"AXToggle";
|
||||
|
||||
case roles::PAGETAB:
|
||||
return @"AXTabButton";
|
||||
|
||||
case roles::SEPARATOR:
|
||||
return @"AXContentSeparator";
|
||||
|
||||
default:
|
||||
// These are special. They map to roles::NOTHING
|
||||
// and are instructed by the ARIA map to use the native host role.
|
||||
if (acc && acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
roleAtom = roleMap->roleAtom;
|
||||
}
|
||||
if (proxy) roleAtom = proxy->ARIARoleAtom();
|
||||
|
||||
if (roleAtom) {
|
||||
if (roleAtom == nsGkAtoms::log_) return @"AXApplicationLog";
|
||||
if (roleAtom == nsGkAtoms::timer) return @"AXApplicationTimer";
|
||||
// macOS added an AXSubrole value to distinguish generic AXGroup objects
|
||||
// from those which are AXGroups as a result of an explicit ARIA role,
|
||||
// such as the non-landmark, non-listitem text containers in DPub ARIA.
|
||||
if (mRole == roles::FOOTNOTE || mRole == roles::SECTION) {
|
||||
return @"AXApplicationGroup";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
if (mRole == roles::FORM) {
|
||||
// This only gets exposed as a landmark if the role comes from ARIA.
|
||||
if (acc && acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
roleAtom = roleMap->roleAtom;
|
||||
} else if (proxy) {
|
||||
roleAtom = proxy->ARIARoleAtom();
|
||||
}
|
||||
|
||||
if (roleAtom && roleAtom == nsGkAtoms::form) {
|
||||
return @"AXLandmarkForm";
|
||||
}
|
||||
}
|
||||
|
||||
#define ROLE(geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, ia2Role, androidClass, \
|
||||
nameRule) \
|
||||
case roles::geckoRole: \
|
||||
if (![macSubrole isEqualToString:NSAccessibilityUnknownSubrole]) { \
|
||||
return macSubrole; \
|
||||
} else { \
|
||||
break; \
|
||||
}
|
||||
|
||||
switch (mRole) {
|
||||
#include "RoleMap.h"
|
||||
}
|
||||
|
||||
// These are special. They map to roles::NOTHING
|
||||
// and are instructed by the ARIA map to use the native host role.
|
||||
if (acc && acc->HasARIARole()) {
|
||||
const nsRoleMapEntry* roleMap = acc->ARIARoleMap();
|
||||
roleAtom = roleMap->roleAtom;
|
||||
}
|
||||
if (proxy) roleAtom = proxy->ARIARoleAtom();
|
||||
|
||||
if (roleAtom) {
|
||||
if (roleAtom == nsGkAtoms::log_) return @"AXApplicationLog";
|
||||
if (roleAtom == nsGkAtoms::timer) return @"AXApplicationTimer";
|
||||
// macOS added an AXSubrole value to distinguish generic AXGroup objects
|
||||
// from those which are AXGroups as a result of an explicit ARIA role,
|
||||
// such as the non-landmark, non-listitem text containers in DPub ARIA.
|
||||
if (mRole == roles::FOOTNOTE || mRole == roles::SECTION) {
|
||||
return @"AXApplicationGroup";
|
||||
}
|
||||
}
|
||||
|
||||
return NSAccessibilityUnknownSubrole;
|
||||
|
||||
#undef ROLE
|
||||
}
|
||||
|
||||
struct RoleDescrMap {
|
||||
|
|
|
@ -154,10 +154,10 @@ ia2Accessible::role(long* aRole) {
|
|||
AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
|
||||
if (acc->IsDefunct()) return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
case roles::_geckoRole: \
|
||||
*aRole = ia2Role; \
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, macSubrole, msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
case roles::_geckoRole: \
|
||||
*aRole = ia2Role; \
|
||||
break;
|
||||
|
||||
a11y::role geckoRole;
|
||||
|
|
|
@ -462,10 +462,10 @@ AccessibleWrap::get_accRole(
|
|||
|
||||
uint32_t msaaRole = 0;
|
||||
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, _msaaRole, ia2Role, \
|
||||
androidClass, nameRule) \
|
||||
case roles::_geckoRole: \
|
||||
msaaRole = _msaaRole; \
|
||||
#define ROLE(_geckoRole, stringRole, atkRole, macRole, macSubrole, _msaaRole, \
|
||||
ia2Role, androidClass, nameRule) \
|
||||
case roles::_geckoRole: \
|
||||
msaaRole = _msaaRole; \
|
||||
break;
|
||||
|
||||
switch (geckoRole) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче