1@namespace "http://www.w3.org/1998/Math/MathML";
2
3math {
4    -webkit-line-box-contain: glyphs replaced;
5    text-indent: 0;
6    direction: ltr;
7}
8mtext {
9    line-height: 1.0;
10}
11
12/* Keep font-family and other defaults here consistent with http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathml.css and feedback from www-math. */
13math {
14#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
15    /* We explicitly include the font Symbol as it's the iOS equivalent of font STIXGeneral. */
16    font-family: STIXGeneral, Symbol, "Times New Roman", sans-serif;
17#else
18    font-family: "Latin Modern Math", MathJax_Main, STIXGeneral, STIXSizeOneSym, "DejaVu Sans", "DejaVu Serif", Cambria, "Cambria Math", "Lucida Sans Unicode", "Arial Unicode MS", "Lucida Grande", OpenSymbol, "Standard Symbols L", Times, serif;
19#endif
20}
21
22math {
23    display: -webkit-inline-flex !important;
24    padding-left: 1px;
25    padding-right: 1px;
26}
27
28math[display="block"] {
29    display: -webkit-flex !important;
30    -webkit-justify-content: center;
31    page-break-inside: avoid;
32    /* -webkit-margin-before: 1em; -- FIXME: Ask www-math for a default MathML stylesheet, including this (or margin-top). */
33    -webkit-margin-after: 1em;
34}
35
36mi, mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose {
37    display: -webkit-inline-flex !important;
38}
39
40math, mrow, mfenced, merror, mphantom, mstyle, menclose {
41    -webkit-align-items: baseline;
42}
43
44mo, mfrac, munder, mover, munderover {
45    -webkit-flex-direction: column;
46}
47
48munder, mover, munderover {
49    -webkit-align-items: center;
50}
51
52mfrac > * {
53    -webkit-align-self: center;
54}
55mfrac[numalign="left"] > :first-child {
56    -webkit-align-self: flex-start;
57}
58mfrac[numalign="right"] > :first-child {
59    -webkit-align-self: flex-end;
60}
61mfrac[denomalign="left"] > :last-child {
62    -webkit-align-self: flex-start;
63}
64mfrac[denomalign="right"] > :last-child {
65    -webkit-align-self: flex-end;
66}
67mfrac > :first-child {
68    -webkit-margin-after: 0.2em;
69}
70mfrac > :last-child {
71    -webkit-margin-before: 0.2em;
72}
73mfrac {
74    -webkit-margin-start: 1px;
75    -webkit-margin-end: 1px;
76}
77
78mover > :last-child, munderover > :last-child {
79    -webkit-order: -1;
80}
81
82msub > * + *, msup > * + *, msubsup > * + *, mmultiscripts > * + *, munder > * + *, mover > * + *, munderover > * + * {
83    font-size: 0.75em; /* FIXME: MathML standard is 0.71em */
84}
85mroot > *:last-child {
86    font-size: 0.5625em; /* This 0.75^2 since the scriptlevel is incremented by 2 in the index. */
87}
88
89mi {
90    -webkit-padding-end: 0.1em;
91}
92msub > mi:first-child, msubsup > mi:first-child {
93    -webkit-padding-end: 0;
94}
95msubsup > mi:first-child + * + * {
96    -webkit-margin-start: 0.14em; /* This is larger than 0.1em because the child's font-size is smaller than the <msubsup>'s. */
97}
98
99math[mathvariant="normal"], mstyle[mathvariant="normal"], mo[mathvariant="normal"], mn[mathvariant="normal"], mi[mathvariant="normal"], mtext[mathvariant="normal"], mspace[mathvariant="normal"], ms[mathvariant="normal"] {
100    font-style: normal;
101    font-weight: normal;
102}
103
104math[mathvariant="bold"], mstyle[mathvariant="bold"], mo[mathvariant="bold"], mn[mathvariant="bold"], mi[mathvariant="bold"], mtext[mathvariant="bold"], mspace[mathvariant="bold"], ms[mathvariant="bold"] {
105    font-style: normal;
106    font-weight: bold;
107}
108
109math[mathvariant="italic"], mstyle[mathvariant="italic"], mo[mathvariant="italic"], mn[mathvariant="italic"], mi[mathvariant="italic"], mtext[mathvariant="italic"], mspace[mathvariant="italic"], ms[mathvariant="italic"] {
110    font-style: italic;
111    font-weight: normal;
112}
113
114math[mathvariant="bold-italic"], mstyle[mathvariant="bold-italic"], mo[mathvariant="bold-italic"], mn[mathvariant="bold-italic"], mi[mathvariant="bold-italic"], mtext[mathvariant="bold-italic"], mspace[mathvariant="bold-italic"], ms[mathvariant="bold-italic"] {
115    font-weight: bold;
116    font-style: italic;
117}
118
119math[mathsize="small"], mstyle[mathsize="small"], mo[mathsize="small"], mn[mathsize="small"], mi[mathsize="small"], mtext[mathsize="small"], mspace[mathsize="small"], ms[mathsize="small"] {
120    font-size: 0.75em;
121}
122
123math[mathsize="normal"], mstyle[mathsize="normal"], mo[mathsize="normal"], mn[mathsize="normal"], mi[mathsize="normal"], mtext[mathsize="normal"], mspace[mathsize="normal"], ms[mathsize="normal"] {
124    font-size: 1em;
125}
126
127math[mathsize="big"], mstyle[mathsize="big"], mo[mathsize="big"], mn[mathsize="big"], mi[mathsize="big"], mtext[mathsize="big"], mspace[mathsize="big"], ms[mathsize="big"] {
128    font-size: 1.5em;
129}
130 
131mphantom {
132    visibility: hidden;
133}
134
135/* This is a special style for erroneous markup:
136  - <merror> element.
137  - extra children in script elements.
138  - <mprescripts/> and <none/> elements in msub/msup/msubsup.
139 */
140merror, msub > * + * + *, msup > * + * + *, msubsup > * + * + * + *, msub > mprescripts, msup > mprescripts, msubsup > mprescripts, msub > none, msup > none, msubsup > none, mmultiscripts > mprescripts ~ mprescripts, mmultiscripts > mprescripts ~ mprescripts ~ * {
141    outline: solid thin red;
142    font-weight: bold;
143    font-family: sans-serif;
144    background-color: lightYellow;
145}
146
147mtable {
148    display: inline-table;
149    text-align: center;
150}
151
152mtr {
153    display: table-row;
154}
155
156mtd {
157    display: table-cell;
158    padding: 0.5ex;
159}
160
161mtable[columnalign="left"], mtr[columnalign="left"], mtd[columnalign="left"] {
162    text-align: left;
163}
164
165mtable[columnalign="right"], mtr[columnalign="right"], mtd[columnalign="right"] {
166    text-align: right;
167}
168
169mtable[rowalign="top"] mtd, mtable mtr[rowalign="top"] mtd, mtable mtr mtd[rowalign="top"] {
170    vertical-align: top;
171}
172
173mtable[rowalign="bottom"] mtd, mtable mtr[rowalign="bottom"] mtd, mtable mtr mtd[rowalign="bottom"] {
174    vertical-align: bottom;
175}
176
177mtable[rowalign="center"] mtd, mtable mtr[rowalign="center"] mtd, mtable mtr mtd[rowalign="center"] {
178    vertical-align: middle;
179}
180
181mtable[frame="solid"] {
182    border: solid thin;
183}
184
185mtable[frame="dashed"] {
186    border: dashed thin;
187}
188
189mtable[rowlines="solid"], mtable[rowlines="dashed"], mtable[columnlines="solid"], mtable[columnlines="dashed"] {
190    border-collapse: collapse;
191}
192
193mtable[rowlines="solid"] > mtr + mtr {
194    border-top: solid thin;
195}
196
197mtable[rowlines="dashed"] > mtr + mtr {
198    border-top: dashed thin;
199}
200
201mtable[columnlines="solid"] > mtr > mtd + mtd {
202    border-left: solid thin;
203}
204
205mtable[columnlines="dashed"] > mtr > mtd + mtd {
206    border-left: dashed thin;
207}
208