|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 |
|
6 /**************************************************************************/ |
|
7 /* namespace for MathML elements */ |
|
8 /**************************************************************************/ |
|
9 |
|
10 @namespace url(http://www.w3.org/1998/Math/MathML); |
|
11 |
|
12 /**************************************************************************/ |
|
13 /* <math> - outermost math element */ |
|
14 /* Put Cambria before Cambria Math as Cambria Math has neither bold nor */ |
|
15 /* italic. */ |
|
16 /**************************************************************************/ |
|
17 |
|
18 math { |
|
19 direction: ltr; |
|
20 unicode-bidi: embed; |
|
21 display: inline; |
|
22 font-size: inherit; |
|
23 font-style: normal; |
|
24 font-family: MathJax_Main, STIXGeneral, Cambria, Cambria Math, XITS, Latin Modern Math, DejaVu Serif, DejaVu Sans, Times, Lucida Sans Unicode, OpenSymbol, Standard Symbols L, serif; |
|
25 text-rendering: optimizeLegibility; |
|
26 -moz-float-edge: margin-box; |
|
27 -moz-math-display: inline; |
|
28 } |
|
29 math[mode="display"], math[display="block"] { |
|
30 display: block; |
|
31 text-align: -moz-center; |
|
32 -moz-math-display: block; |
|
33 } |
|
34 math[display="inline"] { |
|
35 display: inline; |
|
36 -moz-math-display: inline; |
|
37 } |
|
38 math[displaystyle="false"] { |
|
39 -moz-math-display: inline; |
|
40 } |
|
41 math[displaystyle="true"] { |
|
42 -moz-math-display: block; |
|
43 } |
|
44 |
|
45 /**************************************************************************/ |
|
46 /* Token elements */ |
|
47 /**************************************************************************/ |
|
48 |
|
49 ms { |
|
50 display: inline; |
|
51 } |
|
52 ms:before, ms:after { |
|
53 content: "\0022" |
|
54 } |
|
55 ms[lquote]:before { |
|
56 content: attr(lquote) |
|
57 } |
|
58 ms[rquote]:after { |
|
59 content: attr(rquote) |
|
60 } |
|
61 |
|
62 /**************************************************************************/ |
|
63 /* Links */ |
|
64 /**************************************************************************/ |
|
65 :-moz-any-link { |
|
66 text-decoration: none !important; |
|
67 } |
|
68 |
|
69 /**************************************************************************/ |
|
70 /* attributes common to all tags */ |
|
71 /**************************************************************************/ |
|
72 |
|
73 /* These attributes are mapped to style in nsMathMLElement.cpp: |
|
74 |
|
75 - background -> background (deprecated) |
|
76 - color -> color (deprecated) |
|
77 - fontfamily -> font-family (deprecated) |
|
78 - fontsize -> font-size (deprecated) |
|
79 - fontstyle -> font-style (deprecated) |
|
80 - fontweight -> font-weight (deprecated) |
|
81 - mathvariant -> -moz-math-variant |
|
82 - scriptsizemultiplier -> -moz-script-size-multiplier |
|
83 - scriptminsize -> -moz-script-min-size |
|
84 - scriptlevel -> -moz-script-level |
|
85 - mathsize -> font-size |
|
86 - mathcolor -> color |
|
87 - mathbackground -> background |
|
88 |
|
89 */ |
|
90 |
|
91 |
|
92 /**************************************************************************/ |
|
93 /* merror */ |
|
94 /**************************************************************************/ |
|
95 |
|
96 merror { |
|
97 display: block; |
|
98 font-family: sans-serif; |
|
99 font-weight: bold; |
|
100 white-space: pre; |
|
101 margin: 1em; |
|
102 padding: 1em; |
|
103 border-width: thin; |
|
104 border-style: inset; |
|
105 border-color: red; |
|
106 font-size: 14pt; |
|
107 background-color: lightyellow; |
|
108 } |
|
109 |
|
110 /**************************************************************************/ |
|
111 /* mtable and its related tags */ |
|
112 /**************************************************************************/ |
|
113 |
|
114 mtable { |
|
115 display: inline-table; |
|
116 border-collapse: separate; |
|
117 border-spacing: 0; |
|
118 text-indent: 0; |
|
119 } |
|
120 mtable[frame="none"] { |
|
121 border: none; |
|
122 } |
|
123 mtable[frame="solid"] { |
|
124 border: solid thin; |
|
125 } |
|
126 mtable[frame="dashed"] { |
|
127 border: dashed thin; |
|
128 } |
|
129 |
|
130 mtr, mlabeledtr { |
|
131 display: table-row; |
|
132 vertical-align: baseline; |
|
133 } |
|
134 |
|
135 mtd { |
|
136 display: table-cell; |
|
137 vertical-align: inherit; |
|
138 text-align: -moz-center; |
|
139 white-space: nowrap; |
|
140 } |
|
141 |
|
142 /* Don't support m(labeled)tr without mtable, nor mtd without m(labeled)tr */ |
|
143 :not(mtable) > mtr, |
|
144 :not(mtable) > mlabeledtr, |
|
145 :not(mtr):not(mlabeledtr) > mtd { |
|
146 display: none !important; |
|
147 } |
|
148 |
|
149 /* Hide the label because mlabeledtr is not supported yet (bug 356870). This |
|
150 rule can be overriden by users. */ |
|
151 mlabeledtr > mtd:first-child { |
|
152 display: none; |
|
153 } |
|
154 |
|
155 /**********************************************************************/ |
|
156 /* rules to achieve the default spacing between cells. The back-end code |
|
157 will set the internal attributes depending on the cell's position. |
|
158 These rules are hard-coded, the comments indicate what would be |
|
159 desirable if the style data could be changed on the fly to pick |
|
160 the values that users may set with the attributes of <mtable> */ |
|
161 mtd { |
|
162 padding-right: 0.4em; /* half of columnspacing[colindex] */ |
|
163 padding-left: 0.4em; /* half of columnspacing[colindex-1] */ |
|
164 padding-bottom: 0.5ex; /* half of rowspacing[rowindex] */ |
|
165 padding-top: 0.5ex; /* half of rowspacing[rowindex-1] */ |
|
166 } |
|
167 /* turn off the spacing at the periphery of boundary cells */ |
|
168 mtr:first-child > mtd { |
|
169 padding-top: 0ex; |
|
170 } |
|
171 mtr:last-child > mtd { |
|
172 padding-bottom: 0ex; |
|
173 } |
|
174 mtd:first-child { |
|
175 -moz-padding-start: 0em; |
|
176 } |
|
177 mtd:last-child { |
|
178 -moz-padding-end: 0em; |
|
179 } |
|
180 /* re-instate the spacing if the table has a surrounding frame */ |
|
181 mtable[frame="solid"] > mtr:first-child > mtd, |
|
182 mtable[frame="dashed"] > mtr:first-child > mtd { |
|
183 padding-top: 0.5ex; /* framespacing.top */ |
|
184 } |
|
185 mtable[frame="solid"] > mtr:last-child > mtd, |
|
186 mtable[frame="dashed"] > mtr:last-child > mtd { |
|
187 padding-bottom: 0.5ex; /* framespacing.bottom */ |
|
188 } |
|
189 mtable[frame="solid"] > mtr > mtd:first-child, |
|
190 mtable[frame="dashed"] > mtr > mtd:first-child { |
|
191 -moz-padding-start: 0.4em; /* framespacing.left (or right in rtl)*/ |
|
192 } |
|
193 mtable[frame="solid"] > mtr > mtd:last-child, |
|
194 mtable[frame="dashed"] > mtr > mtd:last-child { |
|
195 -moz-padding-end: 0.4em; /* framespacing.right (or left in rtl)*/ |
|
196 } |
|
197 |
|
198 /**************************************************************************/ |
|
199 /* This rule is used to give a style context suitable for nsMathMLChars. |
|
200 We don't actually style -moz-math-anonymous by default. */ |
|
201 /* |
|
202 ::-moz-math-anonymous { |
|
203 } |
|
204 */ |
|
205 |
|
206 /**********************************************************************/ |
|
207 /* This is used when wrapping non-MathML inline elements inside math. */ |
|
208 *|*::-moz-mathml-anonymous-block { |
|
209 display: inline-block !important; |
|
210 position: static !important; |
|
211 text-indent: 0; |
|
212 } |
|
213 |
|
214 /**************************************************************************/ |
|
215 /* Controlling Displaystyle and Scriptlevel */ |
|
216 /**************************************************************************/ |
|
217 |
|
218 /* |
|
219 http://www.w3.org/Math/draft-spec/chapter3.html#presm.scriptlevel |
|
220 |
|
221 The determination of -moz-math-display for <math> involves the displaystyle |
|
222 and display attributes. See the <math> section above. |
|
223 */ |
|
224 |
|
225 /* |
|
226 Map mstyle@displaystyle to -moz-math-display. |
|
227 */ |
|
228 mstyle[displaystyle="false"] { |
|
229 -moz-math-display: inline; |
|
230 } |
|
231 mstyle[displaystyle="true"] { |
|
232 -moz-math-display: block; |
|
233 } |
|
234 |
|
235 /* munder, mover and munderover change the scriptlevels of their children |
|
236 using -moz-math-increment-script-level because regular CSS rules are |
|
237 insufficient to control when the scriptlevel should be incremented. All other |
|
238 cases can be described using regular CSS, so we do it this way because it's |
|
239 more efficient and less code. */ |
|
240 :-moz-math-increment-script-level { -moz-script-level: +1; } |
|
241 |
|
242 /* |
|
243 The mfrac element sets displaystyle to "false", or if it was already false |
|
244 increments scriptlevel by 1, within numerator and denominator. |
|
245 */ |
|
246 mfrac > * { |
|
247 -moz-script-level: auto; |
|
248 -moz-math-display: inline; |
|
249 } |
|
250 |
|
251 /* |
|
252 The mroot element increments scriptlevel by 2, and sets displaystyle to |
|
253 "false", within index, but leaves both attributes unchanged within base. |
|
254 The msqrt element leaves both attributes unchanged within its argument. |
|
255 */ |
|
256 mroot > :not(:first-child) { |
|
257 -moz-script-level: +2; |
|
258 -moz-math-display: inline; |
|
259 } |
|
260 |
|
261 /* |
|
262 The msub element [...] increments scriptlevel by 1, and sets displaystyle to |
|
263 "false", within subscript, but leaves both attributes unchanged within base. |
|
264 |
|
265 The msup element [...] increments scriptlevel by 1, and sets displaystyle to |
|
266 "false", within superscript, but leaves both attributes unchanged within |
|
267 base. |
|
268 |
|
269 The msubsup element [...] increments scriptlevel by 1, and sets displaystyle |
|
270 to "false", within subscript and superscript, but leaves both attributes |
|
271 unchanged within base. |
|
272 |
|
273 The mmultiscripts element increments scriptlevel by 1, and sets displaystyle |
|
274 to "false", within each of its arguments except base, but leaves both |
|
275 attributes unchanged within base. |
|
276 */ |
|
277 msub > :not(:first-child), |
|
278 msup > :not(:first-child), |
|
279 msubsup > :not(:first-child), |
|
280 mmultiscripts > :not(:first-child) { |
|
281 -moz-script-level: +1; |
|
282 -moz-math-display: inline; |
|
283 } |
|
284 |
|
285 /* |
|
286 The munder element [...] always sets displaystyle to "false" within the |
|
287 underscript, but increments scriptlevel by 1 only when accentunder is |
|
288 "false". Within base, it always leaves both attributes unchanged. |
|
289 |
|
290 The mover element [...] always sets displaystyle to "false" within |
|
291 overscript, but increments scriptlevel by 1 only when accent is "false". |
|
292 Within base, it always leaves both attributes unchanged. |
|
293 |
|
294 The munderover [..] always sets displaystyle to "false" within underscript |
|
295 and overscript, but increments scriptlevel by 1 only when accentunder or |
|
296 accent, respectively, are "false". Within base, it always leaves both |
|
297 attributes unchanged. |
|
298 */ |
|
299 munder > :not(:first-child), |
|
300 mover > :not(:first-child), |
|
301 munderover > :not(:first-child) { |
|
302 -moz-math-display: inline; |
|
303 } |
|
304 |
|
305 /* |
|
306 The displaystyle attribute is allowed on the mtable element to set the |
|
307 inherited value of the attribute. If the attribute is not present, the |
|
308 mtable element sets displaystyle to "false" within the table elements. |
|
309 */ |
|
310 mtable { -moz-math-display: inline; } |
|
311 mtable[displaystyle="true"] { -moz-math-display: block; } |
|
312 |
|
313 /* |
|
314 The mscarries element sets displaystyle to "false", and increments |
|
315 scriptlevel by 1, so the children are typically displayed in a smaller font. |
|
316 XXXfredw: This element is not implemented yet. See bug 534967. |
|
317 mscarries { |
|
318 -moz-script-level: +1; |
|
319 -moz-math-display: inline; |
|
320 } |
|
321 */ |