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/. */
6 /**************************************************************************/
7 /* namespace for MathML elements */
8 /**************************************************************************/
10 @namespace url
(http://www
.w3
.org
/1998/Math
/MathML
);
12 /**************************************************************************/
13 /* <math> - outermost math element */
14 /**************************************************************************/
17 writing-mode: horizontal-tb
!important
;
26 letter-spacing: normal
;
27 text-rendering: optimizeLegibility
;
28 -moz-float-edge: margin-box
;
29 -moz-math-display: inline
;
31 math
[mode
="display"], math
[display
="block"] {
33 text-align: -moz-center
;
34 -moz-math-display: block
;
36 math
[display
="inline"] {
38 -moz-math-display: inline
;
40 math
[displaystyle
="false"] {
41 -moz-math-display: inline
;
43 math
[displaystyle
="true"] {
44 -moz-math-display: block
;
47 /**************************************************************************/
49 /**************************************************************************/
64 /**************************************************************************/
66 /**************************************************************************/
68 text-decoration: none
!important
;
71 /**************************************************************************/
72 /* attributes common to all tags */
73 /**************************************************************************/
75 /* These attributes are mapped to style in nsMathMLElement.cpp:
77 - background -> background (deprecated)
78 - color -> color (deprecated)
79 - fontfamily -> font-family (deprecated)
80 - fontsize -> font-size (deprecated)
81 - fontstyle -> font-style (deprecated)
82 - fontweight -> font-weight (deprecated)
83 - mathvariant -> -moz-math-variant
84 - scriptsizemultiplier -> -moz-script-size-multiplier
85 - scriptminsize -> -moz-script-min-size
86 - scriptlevel -> -moz-script-level
87 - mathsize -> font-size
89 - mathbackground -> background
94 /**************************************************************************/
96 /**************************************************************************/
100 font-family: sans-serif
;
109 background-color: lightyellow
;
112 /**************************************************************************/
113 /* mtable and its related tags */
114 /**************************************************************************/
117 display: inline-table
;
118 border-collapse: separate
;
122 mtable
[frame
="none"] {
125 mtable
[frame
="solid"] {
128 mtable
[frame
="dashed"] {
134 vertical-align: baseline
;
139 vertical-align: inherit
;
140 text-align: -moz-center
;
144 /* Don't support m(labeled)tr without mtable, nor mtd without m(labeled)tr */
146 :not
(mtable
) > mlabeledtr
,
147 :not
(mtr
):not
(mlabeledtr
) > mtd
{
148 display: none
!important
;
151 /* Hide the label because mlabeledtr is not supported yet (bug 356870). This
152 rule can be overriden by users. */
153 mlabeledtr
> mtd:first-child
{
157 /**********************************************************************/
158 /* rules to achieve the default spacing between cells. When rowspacing,
159 columnspacing and framespacing aren't set on mtable. The back-end code
160 will set the internal attributes depending on the cell's position.
161 When they are set, the spacing behaviour is handled outside of CSS */
163 padding-right: 0.4em; /* half of columnspacing[colindex] */
164 padding-left: 0.4em; /* half of columnspacing[colindex-1] */
165 padding-bottom: 0.5ex; /* half of rowspacing[rowindex] */
166 padding-top: 0.5ex; /* half of rowspacing[rowindex-1] */
168 /* turn off the spacing at the periphery of boundary cells */
169 mtr:first-child
> mtd
{
172 mtr:last-child
> mtd
{
176 -moz-padding-start: 0em;
179 -moz-padding-end: 0em;
181 /* re-instate the spacing if the table has a surrounding frame */
182 mtable
[frame
="solid"] > mtr:first-child
> mtd
,
183 mtable
[frame
="dashed"] > mtr:first-child
> mtd
{
184 padding-top: 0.5ex; /* framespacing.top */
186 mtable
[frame
="solid"] > mtr:last-child
> mtd
,
187 mtable
[frame
="dashed"] > mtr:last-child
> mtd
{
188 padding-bottom: 0.5ex; /* framespacing.bottom */
190 mtable
[frame
="solid"] > mtr
> mtd:first-child
,
191 mtable
[frame
="dashed"] > mtr
> mtd:first-child
{
192 -moz-padding-start: 0.4em; /* framespacing.left (or right in rtl)*/
194 mtable
[frame
="solid"] > mtr
> mtd:last-child
,
195 mtable
[frame
="dashed"] > mtr
> mtd:last-child
{
196 -moz-padding-end: 0.4em; /* framespacing.right (or left in rtl)*/
199 mtable
[rowspacing
] > mtr
> mtd
,
200 mtable
[columnspacing
] > mtr
> mtd
,
201 mtable
[framespacing
] > mtr
> mtd
{
202 /* Spacing handled outside of CSS */
206 /**************************************************************************/
207 /* This rule is used to give a style context suitable for nsMathMLChars.
208 We don't actually style -moz-math-anonymous by default. */
210 ::-moz-math-anonymous {
214 /**********************************************************************/
215 /* This is used when wrapping non-MathML inline elements inside math. */
216 *|
*::-moz-mathml-anonymous-block
{
217 display: inline-block
!important
;
218 position: static
!important
;
222 /**************************************************************************/
223 /* Controlling Displaystyle and Scriptlevel */
224 /**************************************************************************/
227 http://www.w3.org/Math/draft-spec/chapter3.html#presm.scriptlevel
229 The determination of -moz-math-display for <math> involves the displaystyle
230 and display attributes. See the <math> section above.
234 Map mstyle@displaystyle to -moz-math-display.
236 mstyle
[displaystyle
="false"] {
237 -moz-math-display: inline
;
239 mstyle
[displaystyle
="true"] {
240 -moz-math-display: block
;
243 /* munder, mover and munderover change the scriptlevels of their children
244 using -moz-math-increment-script-level because regular CSS rules are
245 insufficient to control when the scriptlevel should be incremented. All other
246 cases can be described using regular CSS, so we do it this way because it's
247 more efficient and less code. */
248 :-moz-math-increment-script-level
{ -moz-script-level: +1; }
251 The mfrac element sets displaystyle to "false", or if it was already false
252 increments scriptlevel by 1, within numerator and denominator.
255 -moz-script-level: auto
;
256 -moz-math-display: inline
;
260 The mroot element increments scriptlevel by 2, and sets displaystyle to
261 "false", within index, but leaves both attributes unchanged within base.
262 The msqrt element leaves both attributes unchanged within its argument.
264 mroot
> :not
(:first-child
) {
265 -moz-script-level: +2;
266 -moz-math-display: inline
;
270 The msub element [...] increments scriptlevel by 1, and sets displaystyle to
271 "false", within subscript, but leaves both attributes unchanged within base.
273 The msup element [...] increments scriptlevel by 1, and sets displaystyle to
274 "false", within superscript, but leaves both attributes unchanged within
277 The msubsup element [...] increments scriptlevel by 1, and sets displaystyle
278 to "false", within subscript and superscript, but leaves both attributes
279 unchanged within base.
281 The mmultiscripts element increments scriptlevel by 1, and sets displaystyle
282 to "false", within each of its arguments except base, but leaves both
283 attributes unchanged within base.
285 msub
> :not
(:first-child
),
286 msup
> :not
(:first-child
),
287 msubsup
> :not
(:first-child
),
288 mmultiscripts
> :not
(:first-child
) {
289 -moz-script-level: +1;
290 -moz-math-display: inline
;
294 The munder element [...] always sets displaystyle to "false" within the
295 underscript, but increments scriptlevel by 1 only when accentunder is
296 "false". Within base, it always leaves both attributes unchanged.
298 The mover element [...] always sets displaystyle to "false" within
299 overscript, but increments scriptlevel by 1 only when accent is "false".
300 Within base, it always leaves both attributes unchanged.
302 The munderover [..] always sets displaystyle to "false" within underscript
303 and overscript, but increments scriptlevel by 1 only when accentunder or
304 accent, respectively, are "false". Within base, it always leaves both
305 attributes unchanged.
307 munder
> :not
(:first-child
),
308 mover
> :not
(:first-child
),
309 munderover
> :not
(:first-child
) {
310 -moz-math-display: inline
;
314 The displaystyle attribute is allowed on the mtable element to set the
315 inherited value of the attribute. If the attribute is not present, the
316 mtable element sets displaystyle to "false" within the table elements.
318 mtable
{ -moz-math-display: inline
; }
319 mtable
[displaystyle
="true"] { -moz-math-display: block
; }
322 The mscarries element sets displaystyle to "false", and increments
323 scriptlevel by 1, so the children are typically displayed in a smaller font.
324 XXXfredw: This element is not implemented yet. See bug 534967.
326 -moz-script-level: +1;
327 -moz-math-display: inline;
331 /* "The mphantom element renders invisibly, but with the same size and other
332 dimensions, including baseline position, that its contents would have if
333 they were rendered normally.".
334 Also, we do not expose the <mphantom> element to the accessible tree
335 (see bug 1108378). */