Bug 1001634 - Add basic MathML accessibility implementation, r=surkov, marcoz, patch=jwei, surkov

This commit is contained in:
Jonathan Wei 2015-03-09 08:16:12 -04:00
parent 3f92d8c4be
commit 2607d4ed90
12 changed files with 1534 additions and 12 deletions

View File

@ -103,6 +103,186 @@ MARKUPMAP(li,
New_HTMLListitem,
0)
MARKUPMAP(math,
New_HyperText,
roles::MATHML_MATH)
MARKUPMAP(mi_,
New_HyperText,
roles::MATHML_IDENTIFIER)
MARKUPMAP(mn_,
New_HyperText,
roles::MATHML_NUMBER)
MARKUPMAP(mo_,
New_HyperText,
roles::MATHML_OPERATOR,
AttrFromDOM(accent_, accent_),
AttrFromDOM(fence_, fence_),
AttrFromDOM(separator_, separator_),
AttrFromDOM(largeop_, largeop_))
MARKUPMAP(mtext_,
New_HyperText,
roles::MATHML_TEXT)
MARKUPMAP(ms_,
New_HyperText,
roles::MATHML_STRING_LITERAL)
MARKUPMAP(mglyph_,
New_HyperText,
roles::MATHML_GLYPH)
MARKUPMAP(mrow_,
New_HyperText,
roles::MATHML_ROW)
MARKUPMAP(mfrac_,
New_HyperText,
roles::MATHML_FRACTION,
AttrFromDOM(bevelled_, bevelled_),
AttrFromDOM(linethickness_, linethickness_))
MARKUPMAP(msqrt_,
New_HyperText,
roles::MATHML_SQUARE_ROOT)
MARKUPMAP(mroot_,
New_HyperText,
roles::MATHML_ROOT)
MARKUPMAP(mfenced_,
New_HyperText,
roles::MATHML_FENCED,
AttrFromDOM(close, close),
AttrFromDOM(open, open),
AttrFromDOM(separators_, separators_))
MARKUPMAP(menclose_,
New_HyperText,
roles::MATHML_ENCLOSED,
AttrFromDOM(notation_, notation_))
MARKUPMAP(mstyle_,
New_HyperText,
roles::MATHML_STYLE)
MARKUPMAP(msub_,
New_HyperText,
roles::MATHML_SUB)
MARKUPMAP(msup_,
New_HyperText,
roles::MATHML_SUP)
MARKUPMAP(msubsup_,
New_HyperText,
roles::MATHML_SUB_SUP)
MARKUPMAP(munder_,
New_HyperText,
roles::MATHML_UNDER,
AttrFromDOM(accentunder_, accentunder_),
AttrFromDOM(align, align))
MARKUPMAP(mover_,
New_HyperText,
roles::MATHML_OVER,
AttrFromDOM(accent_, accent_),
AttrFromDOM(align, align))
MARKUPMAP(munderover_,
New_HyperText,
roles::MATHML_UNDER_OVER,
AttrFromDOM(accent_, accent_),
AttrFromDOM(accentunder_, accentunder_),
AttrFromDOM(align, align))
MARKUPMAP(mmultiscripts_,
New_HyperText,
roles::MATHML_MULTISCRIPTS)
MARKUPMAP(mtable_,
New_HyperText,
roles::MATHML_TABLE,
AttrFromDOM(align, align),
AttrFromDOM(columnlines_, columnlines_),
AttrFromDOM(rowlines_, rowlines_))
MARKUPMAP(mlabeledtr_,
New_HyperText,
roles::MATHML_LABELED_ROW)
MARKUPMAP(mtr_,
New_HyperText,
roles::MATHML_TABLE_ROW)
MARKUPMAP(mtd_,
New_HyperText,
roles::MATHML_CELL)
MARKUPMAP(maction_,
New_HyperText,
roles::MATHML_ACTION,
AttrFromDOM(actiontype_, actiontype_),
AttrFromDOM(selection_, selection_))
MARKUPMAP(merror_,
New_HyperText,
roles::MATHML_ERROR)
MARKUPMAP(semantics_,
New_HyperText,
roles::MATHML_SEMANTICS)
MARKUPMAP(annotation_,
New_HyperText,
roles::MATHML_ANNOTATION)
MARKUPMAP(annotation_xml_,
New_HyperText,
roles::MATHML_XML_ANNOTATION)
MARKUPMAP(mstack_,
New_HyperText,
roles::MATHML_STACK,
AttrFromDOM(align, align),
AttrFromDOM(position, position))
MARKUPMAP(mlongdiv_,
New_HyperText,
roles::MATHML_LONG_DIVISION,
AttrFromDOM(longdivstyle_, longdivstyle_))
MARKUPMAP(msgroup_,
New_HyperText,
roles::MATHML_STACK_GROUP,
AttrFromDOM(position, position),
AttrFromDOM(shift_, shift_))
MARKUPMAP(msrow_,
New_HyperText,
roles::MATHML_STACK_ROW,
AttrFromDOM(position, position))
MARKUPMAP(mscarries_,
New_HyperText,
roles::MATHML_STACK_CARRIES,
AttrFromDOM(location_, location_),
AttrFromDOM(position, position))
MARKUPMAP(mscarry_,
New_HyperText,
roles::MATHML_STACK_CARRY,
AttrFromDOM(crossout_, crossout_))
MARKUPMAP(msline_,
New_HyperText,
roles::MATHML_STACK_LINE,
AttrFromDOM(position, position))
MARKUPMAP(nav,
New_HyperText,
roles::SECTION)

View File

@ -790,7 +790,193 @@ enum Role {
*/
SWITCH = 130,
LAST_ROLE = SWITCH
/**
* A block of MathML code (math).
*/
MATHML_MATH = 131,
/**
* A MathML identifier (mi in MathML).
*/
MATHML_IDENTIFIER = 132,
/**
* A MathML number (mn in MathML).
*/
MATHML_NUMBER = 133,
/**
* A MathML operator (mo in MathML).
*/
MATHML_OPERATOR = 134,
/**
* A MathML text (mtext in MathML).
*/
MATHML_TEXT = 135,
/**
* A MathML string literal (ms in MathML).
*/
MATHML_STRING_LITERAL = 136,
/**
* A MathML glyph (mglyph in MathML).
*/
MATHML_GLYPH = 137,
/**
* A MathML row (mrow in MathML).
*/
MATHML_ROW = 138,
/**
* A MathML fraction (mfrac in MathML).
*/
MATHML_FRACTION = 139,
/**
* A MathML square root (msqrt in MathML).
*/
MATHML_SQUARE_ROOT = 140,
/**
* A MathML root (mroot in MathML).
*/
MATHML_ROOT = 141,
/**
* A MathML fenced element (mfenced in MathML).
*/
MATHML_FENCED = 142,
/**
* A MathML enclosed element (menclose in MathML).
*/
MATHML_ENCLOSED = 143,
/**
* A MathML styling element (mstyle in MathML).
*/
MATHML_STYLE = 144,
/**
* A MathML subscript (msub in MathML).
*/
MATHML_SUB = 145,
/**
* A MathML superscript (msup in MathML).
*/
MATHML_SUP = 146,
/**
* A MathML subscript and superscript (msubsup in MathML).
*/
MATHML_SUB_SUP = 147,
/**
* A MathML underscript (munder in MathML).
*/
MATHML_UNDER = 148,
/**
* A MathML overscript (mover in MathML).
*/
MATHML_OVER = 149,
/**
* A MathML underscript and overscript (munderover in MathML).
*/
MATHML_UNDER_OVER = 150,
/**
* A MathML multiple subscript and superscript element (mmultiscripts in
* MathML).
*/
MATHML_MULTISCRIPTS = 151,
/**
* A MathML table (mtable in MathML).
*/
MATHML_TABLE = 152,
/**
* A MathML labelled table row (mlabeledtr in MathML).
*/
MATHML_LABELED_ROW = 153,
/**
* A MathML table row (mtr in MathML).
*/
MATHML_TABLE_ROW = 154,
/**
* A MathML table entry or cell (mtd in MathML).
*/
MATHML_CELL = 155,
/**
* A MathML interactive element (maction in MathML).
*/
MATHML_ACTION = 156,
/**
* A MathML error message (merror in MathML).
*/
MATHML_ERROR = 157,
/**
* A MathML semantics annotation element (semantics in MathML).
*/
MATHML_SEMANTICS = 158,
/**
* A MathML annotation (annotation in MathML).
*/
MATHML_ANNOTATION = 159,
/**
* A MathML XML annotation (annotation-xml in MathML).
*/
MATHML_XML_ANNOTATION = 160,
/**
* A MathML stacked (rows of numbers) element (mstack in MathML).
*/
MATHML_STACK = 161,
/**
* A MathML long division element (mlongdiv in MathML).
*/
MATHML_LONG_DIVISION = 162,
/**
* A MathML stack group (msgroup in MathML).
*/
MATHML_STACK_GROUP = 163,
/**
* A MathML stack row (msrow in MathML).
*/
MATHML_STACK_ROW = 164,
/**
* MathML carries, borrows, or crossouts for a row (mscarries in MathML).
*/
MATHML_STACK_CARRIES = 165,
/**
* A MathML carry, borrow, or crossout for a column (mscarry in MathML).
*/
MATHML_STACK_CARRY = 166,
/**
* A MathML line in a stack (msline in MathML).
*/
MATHML_STACK_LINE = 167,
LAST_ROLE = MATHML_STACK_LINE
};
} // namespace role

View File

@ -1063,3 +1063,299 @@ ROLE(SWITCH,
ROLE_SYSTEM_CHECKBUTTON,
IA2_ROLE_TOGGLE_BUTTON,
eNameFromSubtreeRule)
ROLE(MATHML_MATH,
"math",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
ROLE_SYSTEM_EQUATION,
ROLE_SYSTEM_EQUATION,
eNoNameRule)
ROLE(MATHML_IDENTIFIER,
"mathml identifier",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNameFromSubtreeRule)
ROLE(MATHML_NUMBER,
"mathml number",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNameFromSubtreeRule)
ROLE(MATHML_OPERATOR,
"mathml operator",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNameFromSubtreeRule)
ROLE(MATHML_TEXT,
"mathml text",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNameFromSubtreeRule)
ROLE(MATHML_STRING_LITERAL,
"mathml string literal",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNameFromSubtreeRule)
ROLE(MATHML_GLYPH,
"mathml glyph",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNameFromSubtreeRule)
ROLE(MATHML_ROW,
"mathml row",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_FRACTION,
"mathml fraction",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_SQUARE_ROOT,
"mathml square root",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_ROOT,
"mathml root",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_FENCED,
"mathml fenced",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_ENCLOSED,
"mathml enclosed",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STYLE,
"mathml style",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_SUB,
"mathml sub",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_SUP,
"mathml sup",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_SUB_SUP,
"mathml sub sup",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_UNDER,
"mathml under",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_OVER,
"mathml over",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_UNDER_OVER,
"mathml under over",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_MULTISCRIPTS,
"mathml multiscripts",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_TABLE,
"mathml table",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_LABELED_ROW,
"mathml labeled row",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_TABLE_ROW,
"mathml table row",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_CELL,
"mathml cell",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_ACTION,
"mathml action",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_ERROR,
"mathml error",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_SEMANTICS,
"mathml semantics",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_ANNOTATION,
"mathml annotation",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_XML_ANNOTATION,
"mathml xml annotation",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STACK,
"mathml stack",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_LONG_DIVISION,
"mathml long division",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STACK_GROUP,
"mathml stack group",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STACK_ROW,
"mathml stack row",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STACK_CARRIES,
"mathml stack carries",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STACK_CARRY,
"mathml stack carry",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)
ROLE(MATHML_STACK_LINE,
"mathml stack line",
ATK_ROLE_UNKNOWN,
NSAccessibilityUnknownRole,
0,
IA2_ROLE_UNKNOWN,
eNoNameRule)

View File

@ -1170,11 +1170,21 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
} else if (content->IsSVGElement(nsGkAtoms::svg)) {
newAcc = new EnumRoleAccessible<roles::DIAGRAM>(content, document);
}
} else if (content->IsMathMLElement()) {
if (content->IsMathMLElement(nsGkAtoms::math))
newAcc = new EnumRoleAccessible<roles::EQUATION>(content, document);
else
const MarkupMapInfo* markupMap =
mMarkupMaps.Get(content->NodeInfo()->NameAtom());
if (markupMap && markupMap->new_func)
newAcc = markupMap->new_func(content, aContext);
// Fall back to text when encountering Content MathML.
if (!newAcc && !content->IsAnyOfMathMLElements(nsGkAtoms::mpadded_,
nsGkAtoms::mphantom_,
nsGkAtoms::maligngroup_,
nsGkAtoms::malignmark_,
nsGkAtoms::mspace_)) {
newAcc = new HyperTextAccessible(content, document);
}
}
}

View File

@ -57,7 +57,7 @@ struct MarkupMapInfo {
nsIAtom** tag;
New_Accessible* new_func;
a11y::role role;
MarkupAttrInfo attrs[2];
MarkupAttrInfo attrs[4];
};
} // namespace a11y

View File

@ -39,6 +39,7 @@ class HTMLLIAccessible;
class HyperTextAccessible;
class ImageAccessible;
class KeyBinding;
class MathMLAccessible;
class ProxyAccessible;
class Relation;
class RootAccessible;

View File

@ -8,7 +8,7 @@
/**
* Defines cross platform (Gecko) roles.
*/
[scriptable, uuid(76ce835f-ef86-47c0-ac7b-e871417f1b6e)]
[scriptable, uuid(55581ec3-ba6e-4805-8108-260ed34cdcbb)]
interface nsIAccessibleRole : nsISupports
{
/**
@ -783,4 +783,190 @@ interface nsIAccessibleRole : nsISupports
* A switch control widget.
*/
const unsigned long ROLE_SWITCH = 130;
/**
* A block of MathML code (math).
*/
const unsigned long ROLE_MATHML_MATH = 131;
/**
* A MathML identifier (mi in MathML).
*/
const unsigned long ROLE_MATHML_IDENTIFIER = 132;
/**
* A MathML number (mn in MathML).
*/
const unsigned long ROLE_MATHML_NUMBER = 133;
/**
* A MathML operator (mo in MathML).
*/
const unsigned long ROLE_MATHML_OPERATOR = 134;
/**
* A MathML text (mtext in MathML).
*/
const unsigned long ROLE_MATHML_TEXT = 135;
/**
* A MathML string literal (ms in MathML).
*/
const unsigned long ROLE_MATHML_STRING_LITERAL = 136;
/**
* A MathML glyph (mglyph in MathML).
*/
const unsigned long ROLE_MATHML_GLYPH = 137;
/**
* A MathML row (mrow in MathML).
*/
const unsigned long ROLE_MATHML_ROW = 138;
/**
* A MathML fraction (mfrac in MathML).
*/
const unsigned long ROLE_MATHML_FRACTION = 139;
/**
* A MathML square root (msqrt in MathML).
*/
const unsigned long ROLE_MATHML_SQUARE_ROOT = 140;
/**
* A MathML root (mroot in MathML).
*/
const unsigned long ROLE_MATHML_ROOT = 141;
/**
* A MathML fenced element (mfenced in MathML).
*/
const unsigned long ROLE_MATHML_FENCED = 142;
/**
* A MathML enclosed element (menclose in MathML).
*/
const unsigned long ROLE_MATHML_ENCLOSED = 143;
/**
* A MathML styling element (mstyle in MathML).
*/
const unsigned long ROLE_MATHML_STYLE = 144;
/**
* A MathML subscript (msub in MathML).
*/
const unsigned long ROLE_MATHML_SUB = 145;
/**
* A MathML superscript (msup in MathML).
*/
const unsigned long ROLE_MATHML_SUP = 146;
/**
* A MathML subscript and superscript (msubsup in MathML).
*/
const unsigned long ROLE_MATHML_SUB_SUP = 147;
/**
* A MathML underscript (munder in MathML).
*/
const unsigned long ROLE_MATHML_UNDER = 148;
/**
* A MathML overscript (mover in MathML).
*/
const unsigned long ROLE_MATHML_OVER = 149;
/**
* A MathML underscript and overscript (munderover in MathML).
*/
const unsigned long ROLE_MATHML_UNDER_OVER = 150;
/**
* A MathML multiple subscript and superscript element (mmultiscripts in
* MathML).
*/
const unsigned long ROLE_MATHML_MULTISCRIPTS = 151;
/**
* A MathML table (mtable in MathML).
*/
const unsigned long ROLE_MATHML_TABLE = 152;
/**
* A MathML labelled table row (mlabeledtr in MathML).
*/
const unsigned long ROLE_MATHML_LABELED_ROW = 153;
/**
* A MathML table row (mtr in MathML).
*/
const unsigned long ROLE_MATHML_TABLE_ROW = 154;
/**
* A MathML table entry or cell (mtd in MathML).
*/
const unsigned long ROLE_MATHML_CELL = 155;
/**
* A MathML interactive element (maction in MathML).
*/
const unsigned long ROLE_MATHML_ACTION = 156;
/**
* A MathML error message (merror in MathML).
*/
const unsigned long ROLE_MATHML_ERROR = 157;
/**
* A MathML semantics annotation element (semantics in MathML).
*/
const unsigned long ROLE_MATHML_SEMANTICS = 158;
/**
* A MathML annotation (annotation in MathML).
*/
const unsigned long ROLE_MATHML_ANNOTATION = 159;
/**
* A MathML XML annotation (annotation-xml in MathML).
*/
const unsigned long ROLE_MATHML_XML_ANNOTATION = 160;
/**
* A MathML stacked (rows of numbers) element (mstack in MathML).
*/
const unsigned long ROLE_MATHML_STACK = 161;
/**
* A MathML long division element (mlongdiv in MathML).
*/
const unsigned long ROLE_MATHML_LONG_DIVISION = 162;
/**
* A MathML stack group (msgroup in MathML).
*/
const unsigned long ROLE_MATHML_STACK_GROUP = 163;
/**
* A MathML stack row (msrow in MathML).
*/
const unsigned long ROLE_MATHML_STACK_ROW = 164;
/**
* MathML carries, borrows, or crossouts for a row (mscarries in MathML).
*/
const unsigned long ROLE_MATHML_STACK_CARRIES = 165;
/**
* A MathML carry, borrow, or crossout for a column (mscarry in MathML).
*/
const unsigned long ROLE_MATHML_STACK_CARRY = 166;
/**
* A MathML line in a stack (msline in MathML).
*/
const unsigned long ROLE_MATHML_STACK_LINE = 167;
};

View File

@ -4,6 +4,7 @@
skip-if = buildapp == 'mulet'
[test_figure.html]
[test_listbox.xul]
[test_MathMLSpec.html]
[test_nsApplicationAcc.html]
[test_plugin.html]
skip-if = buildapp == 'mulet'

View File

@ -941,7 +941,7 @@
// HTML:math
obj = {
role: ROLE_EQUATION
role: ROLE_MATHML_MATH
};
testElm("math", obj);

View File

@ -0,0 +1,625 @@
<!DOCTYPE html>
<html>
<head>
<title>HTML a11y spec tests</title>
<link id="link" rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../actions.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../attributes.js"></script>
<script type="application/javascript"
src="../relations.js"></script>
<script type="application/javascript"
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// math
obj = {
role: ROLE_MATHML_MATH,
};
testElm("math", obj);
//////////////////////////////////////////////////////////////////////////
// mi
obj = {
role: ROLE_MATHML_IDENTIFIER,
};
testElm("mi", obj);
//////////////////////////////////////////////////////////////////////////
// mn
obj = {
role: ROLE_MATHML_NUMBER,
};
testElm("mn", obj);
//////////////////////////////////////////////////////////////////////////
// mo
obj = {
role: ROLE_MATHML_OPERATOR,
attributes: { accent: "true", largeop: "true" }
};
testElm("mo", obj);
obj = {
role: ROLE_MATHML_OPERATOR,
attributes: { fence: "true" }
};
testElm("mo_fence", obj);
obj = {
role: ROLE_MATHML_OPERATOR,
attributes: { separator: "true" }
};
testElm("mo_separator", obj);
//////////////////////////////////////////////////////////////////////////
// mtext
obj = {
role: ROLE_MATHML_TEXT,
};
testElm("mtext", obj);
//////////////////////////////////////////////////////////////////////////
// ms
obj = {
role: ROLE_MATHML_STRING_LITERAL,
};
testElm("ms", obj);
//////////////////////////////////////////////////////////////////////////
// mglyph
obj = {
role: ROLE_MATHML_GLYPH,
};
testElm("mglyph", obj);
//////////////////////////////////////////////////////////////////////////
// mrow
obj = {
role: ROLE_MATHML_ROW,
};
testElm("mrow", obj);
//////////////////////////////////////////////////////////////////////////
// mfrac
obj = {
role: ROLE_MATHML_FRACTION,
attributes: { bevelled: "true", linethickness: "thick" }
};
testElm("mfrac", obj);
//////////////////////////////////////////////////////////////////////////
// msqrt
obj = {
role: ROLE_MATHML_SQUARE_ROOT,
};
testElm("msqrt", obj);
//////////////////////////////////////////////////////////////////////////
// mroot
obj = {
role: ROLE_MATHML_ROOT,
};
testElm("mroot", obj);
//////////////////////////////////////////////////////////////////////////
// mfenced
obj = {
role: ROLE_MATHML_FENCED,
attributes: { open: "]", close: "[", separators: "." }
};
testElm("mfenced", obj);
//////////////////////////////////////////////////////////////////////////
// menclose
obj = {
role: ROLE_MATHML_ENCLOSED,
attributes: { notation: "circle" }
};
testElm("menclose", obj);
//////////////////////////////////////////////////////////////////////////
// mstyle, mpadded, mphantom
obj = {
role: ROLE_MATHML_STYLE,
};
testElm("mstyle", obj);
ok(!isAccessible("mpadded"), "mpadded should not have accessible");
ok(!isAccessible("mphantom"), "mphantom should not have accessible");
//////////////////////////////////////////////////////////////////////////
// msub
obj = {
role: ROLE_MATHML_SUB,
};
testElm("msub", obj);
//////////////////////////////////////////////////////////////////////////
// msup
obj = {
role: ROLE_MATHML_SUP,
};
testElm("msup", obj);
//////////////////////////////////////////////////////////////////////////
// msubsup
obj = {
role: ROLE_MATHML_SUB_SUP,
};
testElm("msubsup", obj);
//////////////////////////////////////////////////////////////////////////
// munder
obj = {
role: ROLE_MATHML_UNDER,
attributes: { accentunder: "true", align: "center" }
};
testElm("munder", obj);
//////////////////////////////////////////////////////////////////////////
// mover
obj = {
role: ROLE_MATHML_OVER,
attributes: { accent: "true", align: "center" }
};
testElm("mover", obj);
//////////////////////////////////////////////////////////////////////////
// munderover
obj = {
role: ROLE_MATHML_UNDER_OVER,
attributes: { accent: "true", accentunder: "true", align: "center" },
};
testElm("munderover", obj);
//////////////////////////////////////////////////////////////////////////
// mmultiscripts
obj = {
role: ROLE_MATHML_MULTISCRIPTS,
};
testElm("mmultiscripts", obj);
//////////////////////////////////////////////////////////////////////////
// mtable
obj = {
role: ROLE_MATHML_TABLE,
attributes: { align: "center", columnlines: "solid", rowlines: "solid" }
};
testElm("mtable", obj);
//////////////////////////////////////////////////////////////////////////
// mlabeledtr
obj = {
role: ROLE_MATHML_LABELED_ROW,
};
testElm("mlabeledtr", obj);
//////////////////////////////////////////////////////////////////////////
// mtr
obj = {
role: ROLE_MATHML_TABLE_ROW,
};
testElm("mtr", obj);
//////////////////////////////////////////////////////////////////////////
// mtd
obj = {
role: ROLE_MATHML_CELL,
};
testElm("mtd", obj);
//////////////////////////////////////////////////////////////////////////
// maction
obj = {
role: ROLE_MATHML_ACTION,
attributes: { actiontype: "toggle", selection: "1" }
};
testElm("maction", obj);
//////////////////////////////////////////////////////////////////////////
// merror
obj = {
role: ROLE_MATHML_ERROR,
};
testElm("merror", obj);
//////////////////////////////////////////////////////////////////////////
// semantics
obj = {
role: ROLE_MATHML_SEMANTICS,
};
testElm("semantics", obj);
//////////////////////////////////////////////////////////////////////////
// annotation
obj = {
role: ROLE_MATHML_ANNOTATION,
};
testElm("annotation", obj);
//////////////////////////////////////////////////////////////////////////
// annotation-xml
obj = {
role: ROLE_MATHML_XML_ANNOTATION,
};
testElm("annotation-xml", obj);
//////////////////////////////////////////////////////////////////////////
// mstack
obj = {
role: ROLE_MATHML_STACK,
attributes: { align: "center" }
};
testElm("mstack", obj);
//////////////////////////////////////////////////////////////////////////
// mlongdiv
obj = {
role: ROLE_MATHML_LONG_DIVISION,
attributes: { longdivstyle: "stackedrightright" }
};
testElm("mlongdiv", obj);
//////////////////////////////////////////////////////////////////////////
// msgroup
obj = {
role: ROLE_MATHML_STACK_GROUP,
attributes: { position: "2", shift: "-1" }
};
testElm("msgroup", obj);
//////////////////////////////////////////////////////////////////////////
// msrow
obj = {
role: ROLE_MATHML_STACK_ROW,
attributes: { position: "1" }
};
testElm("msrow", obj);
//////////////////////////////////////////////////////////////////////////
// mscarries
obj = {
role: ROLE_MATHML_STACK_CARRIES,
attributes: { location: "nw", position: "1" }
};
testElm("mscarries", obj);
//////////////////////////////////////////////////////////////////////////
// mscarry
obj = {
role: ROLE_MATHML_STACK_CARRY,
attributes: { crossout: "updiagonalstrike" }
};
testElm("mscarry", obj);
//////////////////////////////////////////////////////////////////////////
// msline
obj = {
role: ROLE_MATHML_STACK_LINE,
attributes: { position: "1" }
};
testElm("msline", obj);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
</head>
<body>
<a target="_blank"
title="Implement figure and figcaption accessibility"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=658272">
Mozilla Bug 658272
</a><br/>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<math id="math">
<mrow id="mrow">
<mrow>
<msup id="msup">
<mi id="mi">a</mi>
<mn id="mn">2</mn>
</msup>
<mo id="mo" accent="true" largeop="true">+</mo>
<msqrt id="msqrt">
<mn>2</mn>
</msqrt>
</mrow>
<mo>=</mo>
<msub id="msub">
<mi>c</mi>
<mn>2</mn>
</msub>
</mrow>
<mspace id="mspace" width="1em"/>
<mtext id="mtext">Arbitrary text</mtext>
<mspace width="1em"/>
<ms id="ms">InterpretedStringLiteral</ms>
<mi>
<mglyph id="mglyph" src="../letters.gif" alt="letters"/>
</mi>
<mfrac id="mfrac" bevelled="true" linethickness="thick">
<mi>x</mi>
<mn>2</mn>
</mfrac>
<mroot id="mroot">
<mi>x</mi>
<mn>5</mn>
</mroot>
<mspace width="1em"/>
<mfenced id="mfenced" close="[" open="]" separators=".">
<mrow>
<mi>x</mi>
<mi>y</mi>
</mrow>
</mfenced>
<mrow>
<mo id="mo_fence" fence="true">[</mo>
<mrow>
X
<mo id="mo_separator" separator="true">,</mo>
Y
</mrow>
<mo fence="true"> closing-fence </mo>
</mrow>
<mspace width="1em"/>
<menclose id="menclose" notation="circle">
<mi>a</mi>
<mo>+</mo>
<mi>b</mi>
</menclose>
<mstyle id="mstyle" dir="rtl" mathcolor="blue">
<mpadded id="mpadded" height="100px" width="200px">
<mi>x</mi>
<mphantom id="mphantom">
<mo>+</mo>
<mi>y</mi>
</mphantom>
</mpadded>
</mstyle>
<msubsup id="msubsup">
<mi>b</mi>
<mn>1</mn>
<mn>2</mn>
</msubsup>
<munder id="munder" accentunder="true" align="center">
<mrow>
<mi> x </mi>
<mo> + </mo>
<mi> y </mi>
<mo> + </mo>
<mi> z </mi>
</mrow>
<mo> &#x23DF;<!--BOTTOM CURLY BRACKET--> </mo>
</munder>
<mspace width="1em"/>
<mover id="mover" accent="true" align="center">
<mi> x </mi>
<mo> &#x5E;<!--CIRCUMFLEX ACCENT--> </mo>
</mover>
<munderover id="munderover" accentunder="true" accent="true" align="center">
<mo> &#x222B;<!--INTEGRAL--> </mo>
<mn> 0 </mn>
<mi> &#x221E;<!--INFINITY--> </mi>
</munderover>
<mmultiscripts id="mmultiscripts">
<mi> R </mi>
<mi> i </mi>
<none/>
<none/>
<mi> j </mi>
<mi> k </mi>
<none/>
<mi> l </mi>
<none/>
</mmultiscripts>
<mtable id="mtable" align="center" columnlines="solid" rowlines="solid">
<mlabeledtr id="mlabeledtr">
<mtd>
<mtext> (2.1) </mtext>
</mtd>
<mtd>
<mrow>
<mi>E</mi>
<mo>=</mo>
<mrow>
<mi>m</mi>
<mo>&#x2062;<!--INVISIBLE TIMES--></mo>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</mrow>
</mrow>
</mtd>
</mlabeledtr>
</mtable>
<mrow>
<mo> ( </mo>
<mtable>
<mtr id="mtr">
<mtd id="mtd"> <mn>1</mn> </mtd>
<mtd> <mn>0</mn> </mtd>
<mtd> <mn>0</mn> </mtd>
</mtr>
<mtr>
<mtd> <mn>0</mn> </mtd>
<mtd> <mn>1</mn> </mtd>
<mtd> <mn>0</mn> </mtd>
</mtr>
<mtr>
<mtd> <mn>0</mn> </mtd>
<mtd> <mn>0</mn> </mtd>
<mtd> <mn>1</mn> </mtd>
</mtr>
</mtable>
<mo> ) </mo>
</mrow>
<maction id="maction" actiontype="toggle" selection="1">
<mfrac>
<mn>6</mn>
<mn>8</mn>
</mfrac>
<mfrac>
<mrow>
<mn>3</mn>
<mo></mo>
<mn>2</mn>
</mrow>
<mrow>
<mn>4</mn>
<mo></mo>
<mn>2</mn>
</mrow>
</mfrac>
<mfrac>
<mn>3</mn>
<mn>4</mn>
</mfrac>
</maction>
<merror id="merror">
<mrow>
<mtext>Division by zero: </mtext>
<mfrac>
<mn>1</mn>
<mn>0</mn>
</mfrac>
</mrow>
</merror>
<semantics id="semantics">
<!-- Presentation MathML -->
<mrow>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<mi>y</mi>
</mrow>
<!-- Content MathML -->
<annotation-xml id="annotation-xml" encoding="MathML-Content">
<apply>
<plus/>
<apply>
<power/>
<ci>x</ci>
<cn type="integer">2</cn>
</apply>
<ci>y</ci>
</apply>
</annotation-xml>
<!-- annotate TeX -->
<annotation id="annotation" encoding="application/x-tex">
x^{2} + y
</annotation>
</semantics>
<mstack id="mstack" align="center">
<mscarries id="mscarries" location="nw" position="1">
<none/>
<mscarry id="mscarry" crossout="updiagonalstrike">
<mn>1</mn>
</mscarry>
<mscarry location="w">
<mn>1</mn>
</mscarry>
</mscarries>
<mn>523</mn>
<msrow id="msrow" position="1">
<mo>-</mo>
<none/>
<mn>15</mn>
</msrow>
<msline id="msline" position="1"/>
<mn>508</mn>
</mstack>
<mspace width="1em"/>
<mlongdiv id="mlongdiv" longdivstyle="stackedrightright">
<mn>5</mn>
<mn>1</mn>
<mn>5</mn>
</mlongdiv>
<mstack>
<msgroup id="msgroup" position="2" shift="-1">
<mn>123</mn>
<msrow><mo>&#xD7;<!--MULTIPLICATION SIGN--></mo><mn>321</mn></msrow>
</msgroup>
<msline/>
<msgroup shift="1">
<mn>123</mn>
<mn>246</mn>
<mn>369</mn>
</msgroup>
<msline/>
</mstack>
</math>
</body>
</html>

View File

@ -41,6 +41,43 @@ const ROLE_LINK = nsIAccessibleRole.ROLE_LINK;
const ROLE_LIST = nsIAccessibleRole.ROLE_LIST;
const ROLE_LISTBOX = nsIAccessibleRole.ROLE_LISTBOX;
const ROLE_LISTITEM = nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_MATHML_MATH = nsIAccessibleRole.ROLE_MATHML_MATH;
const ROLE_MATHML_IDENTIFIER = nsIAccessibleRole.ROLE_MATHML_IDENTIFIER;
const ROLE_MATHML_NUMBER = nsIAccessibleRole.ROLE_MATHML_NUMBER;
const ROLE_MATHML_OPERATOR = nsIAccessibleRole.ROLE_MATHML_OPERATOR;
const ROLE_MATHML_TEXT = nsIAccessibleRole.ROLE_MATHML_TEXT;
const ROLE_MATHML_STRING_LITERAL = nsIAccessibleRole.ROLE_MATHML_STRING_LITERAL;
const ROLE_MATHML_GLYPH = nsIAccessibleRole.ROLE_MATHML_GLYPH;
const ROLE_MATHML_ROW = nsIAccessibleRole.ROLE_MATHML_ROW;
const ROLE_MATHML_FRACTION = nsIAccessibleRole.ROLE_MATHML_FRACTION;
const ROLE_MATHML_SQUARE_ROOT = nsIAccessibleRole.ROLE_MATHML_SQUARE_ROOT;
const ROLE_MATHML_ROOT = nsIAccessibleRole.ROLE_MATHML_ROOT;
const ROLE_MATHML_FENCED = nsIAccessibleRole.ROLE_MATHML_FENCED;
const ROLE_MATHML_ENCLOSED = nsIAccessibleRole.ROLE_MATHML_ENCLOSED;
const ROLE_MATHML_STYLE = nsIAccessibleRole.ROLE_MATHML_STYLE;
const ROLE_MATHML_SUB = nsIAccessibleRole.ROLE_MATHML_SUB;
const ROLE_MATHML_SUP = nsIAccessibleRole.ROLE_MATHML_SUP;
const ROLE_MATHML_SUB_SUP = nsIAccessibleRole.ROLE_MATHML_SUB_SUP;
const ROLE_MATHML_UNDER = nsIAccessibleRole.ROLE_MATHML_UNDER;
const ROLE_MATHML_OVER = nsIAccessibleRole.ROLE_MATHML_OVER;
const ROLE_MATHML_UNDER_OVER = nsIAccessibleRole.ROLE_MATHML_UNDER_OVER;
const ROLE_MATHML_MULTISCRIPTS = nsIAccessibleRole.ROLE_MATHML_MULTISCRIPTS;
const ROLE_MATHML_TABLE = nsIAccessibleRole.ROLE_MATHML_TABLE;
const ROLE_MATHML_LABELED_ROW = nsIAccessibleRole.ROLE_MATHML_LABELED_ROW;
const ROLE_MATHML_TABLE_ROW = nsIAccessibleRole.ROLE_MATHML_TABLE_ROW;
const ROLE_MATHML_CELL = nsIAccessibleRole.ROLE_MATHML_CELL;
const ROLE_MATHML_ACTION = nsIAccessibleRole.ROLE_MATHML_ACTION;
const ROLE_MATHML_ERROR = nsIAccessibleRole.ROLE_MATHML_ERROR;
const ROLE_MATHML_SEMANTICS = nsIAccessibleRole.ROLE_MATHML_SEMANTICS;
const ROLE_MATHML_ANNOTATION = nsIAccessibleRole.ROLE_MATHML_ANNOTATION;
const ROLE_MATHML_XML_ANNOTATION = nsIAccessibleRole.ROLE_MATHML_XML_ANNOTATION;
const ROLE_MATHML_STACK = nsIAccessibleRole.ROLE_MATHML_STACK;
const ROLE_MATHML_LONG_DIVISION = nsIAccessibleRole.ROLE_MATHML_LONG_DIVISION;
const ROLE_MATHML_STACK_GROUP = nsIAccessibleRole.ROLE_MATHML_STACK_GROUP;
const ROLE_MATHML_STACK_ROW = nsIAccessibleRole.ROLE_MATHML_STACK_ROW;
const ROLE_MATHML_STACK_CARRIES = nsIAccessibleRole.ROLE_MATHML_STACK_CARRIES;
const ROLE_MATHML_STACK_CARRY = nsIAccessibleRole.ROLE_MATHML_STACK_CARRY;
const ROLE_MATHML_STACK_LINE = nsIAccessibleRole.ROLE_MATHML_STACK_LINE;
const ROLE_MENUBAR = nsIAccessibleRole.ROLE_MENUBAR;
const ROLE_MENUITEM = nsIAccessibleRole.ROLE_MENUITEM;
const ROLE_MENUPOPUP = nsIAccessibleRole.ROLE_MENUPOPUP;