From ef52011bc4f0a55712c9112d5e7e616a50a69400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Fri, 19 Jun 2015 15:55:00 +0200 Subject: [PATCH] Bug 1175269 - Add MathML roles/subroles for NSAccessibility. r=surkov --- accessible/base/RoleMap.h | 68 ++++++++++++++++----------------- accessible/mac/mozAccessible.mm | 60 +++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 34 deletions(-) diff --git a/accessible/base/RoleMap.h b/accessible/base/RoleMap.h index 16489fd6c40..aedca120f2b 100644 --- a/accessible/base/RoleMap.h +++ b/accessible/base/RoleMap.h @@ -1067,7 +1067,7 @@ ROLE(SWITCH, ROLE(MATHML_MATH, "math", ATK_ROLE_MATH, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION, eNoNameRule) @@ -1075,7 +1075,7 @@ ROLE(MATHML_MATH, ROLE(MATHML_IDENTIFIER, "mathml identifier", ATK_ROLE_STATIC, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNameFromSubtreeRule) @@ -1083,7 +1083,7 @@ ROLE(MATHML_IDENTIFIER, ROLE(MATHML_NUMBER, "mathml number", ATK_ROLE_STATIC, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNameFromSubtreeRule) @@ -1091,7 +1091,7 @@ ROLE(MATHML_NUMBER, ROLE(MATHML_OPERATOR, "mathml operator", ATK_ROLE_STATIC, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNameFromSubtreeRule) @@ -1099,7 +1099,7 @@ ROLE(MATHML_OPERATOR, ROLE(MATHML_TEXT, "mathml text", ATK_ROLE_STATIC, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNameFromSubtreeRule) @@ -1107,7 +1107,7 @@ ROLE(MATHML_TEXT, ROLE(MATHML_STRING_LITERAL, "mathml string literal", ATK_ROLE_STATIC, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNameFromSubtreeRule) @@ -1115,7 +1115,7 @@ ROLE(MATHML_STRING_LITERAL, ROLE(MATHML_GLYPH, "mathml glyph", ATK_ROLE_IMAGE, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNameFromSubtreeRule) @@ -1123,7 +1123,7 @@ ROLE(MATHML_GLYPH, ROLE(MATHML_ROW, "mathml row", ATK_ROLE_PANEL, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1131,7 +1131,7 @@ ROLE(MATHML_ROW, ROLE(MATHML_FRACTION, "mathml fraction", ATK_ROLE_MATH_FRACTION, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1139,7 +1139,7 @@ ROLE(MATHML_FRACTION, ROLE(MATHML_SQUARE_ROOT, "mathml square root", ATK_ROLE_MATH_ROOT, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1147,7 +1147,7 @@ ROLE(MATHML_SQUARE_ROOT, ROLE(MATHML_ROOT, "mathml root", ATK_ROLE_MATH_ROOT, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1155,7 +1155,7 @@ ROLE(MATHML_ROOT, ROLE(MATHML_FENCED, "mathml fenced", ATK_ROLE_PANEL, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1163,7 +1163,7 @@ ROLE(MATHML_FENCED, ROLE(MATHML_ENCLOSED, "mathml enclosed", ATK_ROLE_PANEL, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1171,7 +1171,7 @@ ROLE(MATHML_ENCLOSED, ROLE(MATHML_STYLE, "mathml style", ATK_ROLE_PANEL, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1179,7 +1179,7 @@ ROLE(MATHML_STYLE, ROLE(MATHML_SUB, "mathml sub", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1187,7 +1187,7 @@ ROLE(MATHML_SUB, ROLE(MATHML_SUP, "mathml sup", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1195,7 +1195,7 @@ ROLE(MATHML_SUP, ROLE(MATHML_SUB_SUP, "mathml sub sup", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1203,7 +1203,7 @@ ROLE(MATHML_SUB_SUP, ROLE(MATHML_UNDER, "mathml under", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1211,7 +1211,7 @@ ROLE(MATHML_UNDER, ROLE(MATHML_OVER, "mathml over", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1219,7 +1219,7 @@ ROLE(MATHML_OVER, ROLE(MATHML_UNDER_OVER, "mathml under over", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1227,7 +1227,7 @@ ROLE(MATHML_UNDER_OVER, ROLE(MATHML_MULTISCRIPTS, "mathml multiscripts", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1235,7 +1235,7 @@ ROLE(MATHML_MULTISCRIPTS, ROLE(MATHML_TABLE, "mathml table", ATK_ROLE_TABLE, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1243,7 +1243,7 @@ ROLE(MATHML_TABLE, ROLE(MATHML_LABELED_ROW, "mathml labeled row", ATK_ROLE_TABLE_ROW, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1251,7 +1251,7 @@ ROLE(MATHML_LABELED_ROW, ROLE(MATHML_TABLE_ROW, "mathml table row", ATK_ROLE_TABLE_ROW, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1259,7 +1259,7 @@ ROLE(MATHML_TABLE_ROW, ROLE(MATHML_CELL, "mathml cell", ATK_ROLE_TABLE_CELL, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1267,7 +1267,7 @@ ROLE(MATHML_CELL, ROLE(MATHML_ACTION, "mathml action", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1275,7 +1275,7 @@ ROLE(MATHML_ACTION, ROLE(MATHML_ERROR, "mathml error", ATK_ROLE_PANEL, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1283,7 +1283,7 @@ ROLE(MATHML_ERROR, ROLE(MATHML_STACK, "mathml stack", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1291,7 +1291,7 @@ ROLE(MATHML_STACK, ROLE(MATHML_LONG_DIVISION, "mathml long division", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1299,7 +1299,7 @@ ROLE(MATHML_LONG_DIVISION, ROLE(MATHML_STACK_GROUP, "mathml stack group", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1307,7 +1307,7 @@ ROLE(MATHML_STACK_GROUP, ROLE(MATHML_STACK_ROW, "mathml stack row", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1315,7 +1315,7 @@ ROLE(MATHML_STACK_ROW, ROLE(MATHML_STACK_CARRIES, "mathml stack carries", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1323,7 +1323,7 @@ ROLE(MATHML_STACK_CARRIES, ROLE(MATHML_STACK_CARRY, "mathml stack carry", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) @@ -1331,7 +1331,7 @@ ROLE(MATHML_STACK_CARRY, ROLE(MATHML_STACK_LINE, "mathml stack line", ATK_ROLE_UNKNOWN, - NSAccessibilityUnknownRole, + NSAccessibilityGroupRole, 0, IA2_ROLE_UNKNOWN, eNoNameRule) diff --git a/accessible/mac/mozAccessible.mm b/accessible/mac/mozAccessible.mm index 39ca37dba32..66adb2b2bbd 100644 --- a/accessible/mac/mozAccessible.mm +++ b/accessible/mac/mozAccessible.mm @@ -503,6 +503,66 @@ GetClosestInterestingAccessible(id anObject) case roles::DEFINITION: return @"AXDefinition"; + case roles::MATHML_MATH: + return @"AXDocumentMath"; + + case roles::MATHML_FRACTION: + return @"AXMathFraction"; + + case roles::MATHML_FENCED: + // XXX 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: + 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. + case roles::MATHML_OPERATOR: + return @"AXMathOperator"; + + case roles::MATHML_MULTISCRIPTS: + return @"AXMathMultiscript"; + case roles::SWITCH: return @"AXSwitch";