gecko-dev/layout/mathml/mathml.css

356 строки
12 KiB
CSS
Исходник Обычный вид История

2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**************************************************************************/
/* namespace for MathML elements */
/**************************************************************************/
@namespace url(http://www.w3.org/1998/Math/MathML);
/**************************************************************************/
/* <math> - outermost math element */
/* Put Cambria before Cambria Math as Cambria Math has neither bold nor */
/* italic. */
/**************************************************************************/
math {
direction: ltr;
unicode-bidi: embed;
display: inline;
font-size: inherit;
font-style: normal;
font-family: MathJax_Main, STIXGeneral, DejaVu Serif, DejaVu Sans, Cambria, Cambria Math, Times, Lucida Sans Unicode, OpenSymbol, Standard Symbols L, serif;
text-rendering: optimizeLegibility;
-moz-float-edge: margin-box;
-moz-math-display: inline;
}
math[mode="display"], math[display="block"] {
display: block;
text-align: -moz-center;
-moz-math-display: block;
}
math[display="inline"] {
display: inline;
-moz-math-display: inline;
}
math[displaystyle="false"] {
-moz-math-display: inline;
}
math[displaystyle="true"] {
-moz-math-display: block;
}
/**************************************************************************/
/* Token elements */
/**************************************************************************/
ms {
display: inline;
}
ms:before, ms:after {
content: "\0022"
}
ms[lquote]:before {
content: attr(lquote)
}
ms[rquote]:after {
content: attr(rquote)
}
/**************************************************************************/
/* Links */
/**************************************************************************/
:-moz-any-link {
text-decoration: none !important;
}
/**************************************************************************/
/* attributes common to all tags */
/**************************************************************************/
/* These attributes are mapped to style in nsMathMLElement.cpp:
- background -> background (deprecated)
- color -> color (deprecated)
- fontfamily -> font-family (deprecated)
- fontsize -> font-size (deprecated)
- fontstyle -> font-style (deprecated)
- fontweight -> font-weight (deprecated)
- mathvariant -> -moz-math-variant
- scriptsizemultiplier -> -moz-script-size-multiplier
- scriptminsize -> -moz-script-min-size
- scriptlevel -> -moz-script-level
- mathsize -> font-size
- mathcolor -> color
- mathbackground -> background
*/
/**************************************************************************/
/* merror */
/**************************************************************************/
merror {
display: block;
font-family: sans-serif;
font-weight: bold;
white-space: pre;
margin: 1em;
padding: 1em;
border-width: thin;
border-style: inset;
border-color: red;
font-size: 14pt;
background-color: lightyellow;
}
/**************************************************************************/
/* mtable and its related tags */
/**************************************************************************/
2002-01-25 10:03:43 +03:00
mtable {
display: inline-table;
border-collapse: separate;
border-spacing: 0;
text-indent: 0;
2002-01-25 10:03:43 +03:00
}
mtable[frame="none"] {
border: none;
}
mtable[frame="solid"] {
border: solid thin;
}
mtable[frame="dashed"] {
border: dashed thin;
}
mtr, mlabeledtr {
display: table-row;
vertical-align: baseline;
}
mtd {
display: table-cell;
vertical-align: inherit;
2002-01-25 10:03:43 +03:00
text-align: -moz-center;
white-space: nowrap;
}
/* Don't support m(labeled)tr without mtable, nor mtd without m(labeled)tr */
:not(mtable) > mtr,
:not(mtable) > mlabeledtr,
:not(mtr):not(mlabeledtr) > mtd {
display: none !important;
}
2002-01-25 10:03:43 +03:00
/* Hide the label because mlabeledtr is not supported yet (bug 356870). This
rule can be overriden by users. */
mlabeledtr > mtd:first-child {
display: none;
}
2002-01-25 10:03:43 +03:00
/**********************************************************************/
/* rules to achieve the default spacing between cells. The back-end code
will set the internal attributes depending on the cell's position.
These rules are hard-coded, the comments indicate what would be
desirable if the style data could be changed on the fly to pick
the values that users may set with the attributes of <mtable> */
2002-01-25 10:03:43 +03:00
mtd {
padding-right: 0.4em; /* half of columnspacing[colindex] */
padding-left: 0.4em; /* half of columnspacing[colindex-1] */
padding-bottom: 0.5ex; /* half of rowspacing[rowindex] */
padding-top: 0.5ex; /* half of rowspacing[rowindex-1] */
}
/* turn off the spacing at the periphery of boundary cells */
mtr:first-child > mtd {
2002-01-25 10:03:43 +03:00
padding-top: 0ex;
}
mtr:last-child > mtd {
2002-01-26 00:57:47 +03:00
padding-bottom: 0ex;
2002-01-25 10:03:43 +03:00
}
mtd:first-child {
2002-01-26 00:57:47 +03:00
padding-left: 0em;
2002-01-25 10:03:43 +03:00
}
mtd:last-child {
2002-01-25 10:03:43 +03:00
padding-right: 0em;
}
/* re-instate the spacing if the table has a surrounding frame */
mtable[frame="solid"] > mtr:first-child > mtd,
mtable[frame="dashed"] > mtr:first-child > mtd {
2002-01-25 10:03:43 +03:00
padding-top: 0.5ex; /* framespacing.top */
}
mtable[frame="solid"] > mtr:last-child > mtd,
mtable[frame="dashed"] > mtr:last-child > mtd {
2002-01-25 10:03:43 +03:00
padding-bottom: 0.5ex; /* framespacing.bottom */
}
mtable[frame="solid"] > mtr > mtd:first-child,
mtable[frame="dashed"] > mtr > mtd:first-child {
2002-01-25 10:03:43 +03:00
padding-left: 0.4em; /* framespacing.left */
}
mtable[frame="solid"] > mtr > mtd:last-child,
mtable[frame="dashed"] > mtr > mtd:last-child {
2002-01-25 10:03:43 +03:00
padding-right: 0.4em; /* framespacing.right */
}
/**************************************************************************/
/* Style used for stretchy symbols *must* be normal to avoid misaligments */
/* By leaving the font-family empty, the MathML engine will use the value
provided by the mathfont-family property in the mathfont.properties file
or the value of the user's pref("font.mathfont-family", "...").
Authors can make elements on a document to be stretched with different
fonts, e.g.,
To request the use of STIX fonts, you can add a <style>...</style> with:
<mo myfonts="stix">...</mo> with the associated CSS declaration
mo[myfonts="stix"]::-moz-math-stretchy {
font-family: STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral;
}
To request the use of Asana fonts, you can add a <style>...</style> with:
<mo myfonts="asana">...</mo> with the associated CSS declaration
mo[myfonts="asana"]::-moz-math-stretchy {
font-family: Asana Math;
}
Of course, if you just want all of the stretchy characters in your
document to be stretched with your preferred list, you can just do:
::-moz-math-stretchy {
font-family: [your-particular-list]
}
Note that like other fonts in the document, users can override this by
clicking the pref to override document fonts.
/**************************************************************************/
::-moz-math-stretchy {
font-style: normal;
font-family: serif; /* an empty family is ignored as an error and behaves like inherit */
/* background-color: #3C6; */
}
/* Don't actually style -moz-math-anonymous by default */
/*
::-moz-math-anonymous {
}
*/
/**********************************************************************/
/* This is used when wrapping non-MathML inline elements inside math. */
*|*::-moz-mathml-anonymous-block {
display: inline-block !important;
position: static !important;
text-indent: 0;
}
/**************************************************************************/
/* Controlling Displaystyle and Scriptlevel */
/**************************************************************************/
/*
http://www.w3.org/Math/draft-spec/chapter3.html#presm.scriptlevel
The determination of -moz-math-display for <math> involves the displaystyle
and display attributes. See the <math> section above.
*/
/*
Map mstyle@displaystyle to -moz-math-display.
*/
mstyle[displaystyle="false"] {
-moz-math-display: inline;
}
mstyle[displaystyle="true"] {
-moz-math-display: block;
}
/* munder, mover and munderover change the scriptlevels of their children
using -moz-math-increment-script-level because regular CSS rules are
insufficient to control when the scriptlevel should be incremented. All other
cases can be described using regular CSS, so we do it this way because it's
more efficient and less code. */
:-moz-math-increment-script-level { -moz-script-level: +1; }
/*
The mfrac element sets displaystyle to "false", or if it was already false
increments scriptlevel by 1, within numerator and denominator.
*/
mfrac > * {
-moz-script-level: auto;
-moz-math-display: inline;
}
/*
The mroot element increments scriptlevel by 2, and sets displaystyle to
"false", within index, but leaves both attributes unchanged within base.
The msqrt element leaves both attributes unchanged within its argument.
*/
mroot > :not(:first-child) {
-moz-script-level: +2;
-moz-math-display: inline;
}
/*
The msub element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within subscript, but leaves both attributes unchanged within base.
The msup element [...] increments scriptlevel by 1, and sets displaystyle to
"false", within superscript, but leaves both attributes unchanged within
base.
The msubsup element [...] increments scriptlevel by 1, and sets displaystyle
to "false", within subscript and superscript, but leaves both attributes
unchanged within base.
The mmultiscripts element increments scriptlevel by 1, and sets displaystyle
to "false", within each of its arguments except base, but leaves both
attributes unchanged within base.
*/
msub > :not(:first-child),
msup > :not(:first-child),
msubsup > :not(:first-child),
mmultiscripts > :not(:first-child) {
-moz-script-level: +1;
-moz-math-display: inline;
}
/*
The munder element [...] always sets displaystyle to "false" within the
underscript, but increments scriptlevel by 1 only when accentunder is
"false". Within base, it always leaves both attributes unchanged.
The mover element [...] always sets displaystyle to "false" within
overscript, but increments scriptlevel by 1 only when accent is "false".
Within base, it always leaves both attributes unchanged.
The munderover [..] always sets displaystyle to "false" within underscript
and overscript, but increments scriptlevel by 1 only when accentunder or
accent, respectively, are "false". Within base, it always leaves both
attributes unchanged.
*/
munder > :not(:first-child),
mover > :not(:first-child),
munderover > :not(:first-child) {
-moz-math-display: inline;
}
/*
The displaystyle attribute is allowed on the mtable element to set the
inherited value of the attribute. If the attribute is not present, the
mtable element sets displaystyle to "false" within the table elements.
*/
mtable { -moz-math-display: inline; }
mtable[displaystyle="true"] { -moz-math-display: block; }
/*
The mscarries element sets displaystyle to "false", and increments
scriptlevel by 1, so the children are typically displayed in a smaller font.
XXXfredw: This element is not implemented yet. See bug 534967.
mscarries {
-moz-script-level: +1;
-moz-math-display: inline;
}
*/