michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /**************************************************************************/ michael@0: /* namespace for MathML elements */ michael@0: /**************************************************************************/ michael@0: michael@0: @namespace url(http://www.w3.org/1998/Math/MathML); michael@0: michael@0: /**************************************************************************/ michael@0: /* - outermost math element */ michael@0: /* Put Cambria before Cambria Math as Cambria Math has neither bold nor */ michael@0: /* italic. */ michael@0: /**************************************************************************/ michael@0: michael@0: math { michael@0: direction: ltr; michael@0: unicode-bidi: embed; michael@0: display: inline; michael@0: font-size: inherit; michael@0: font-style: normal; michael@0: 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; michael@0: text-rendering: optimizeLegibility; michael@0: -moz-float-edge: margin-box; michael@0: -moz-math-display: inline; michael@0: } michael@0: math[mode="display"], math[display="block"] { michael@0: display: block; michael@0: text-align: -moz-center; michael@0: -moz-math-display: block; michael@0: } michael@0: math[display="inline"] { michael@0: display: inline; michael@0: -moz-math-display: inline; michael@0: } michael@0: math[displaystyle="false"] { michael@0: -moz-math-display: inline; michael@0: } michael@0: math[displaystyle="true"] { michael@0: -moz-math-display: block; michael@0: } michael@0: michael@0: /**************************************************************************/ michael@0: /* Token elements */ michael@0: /**************************************************************************/ michael@0: michael@0: ms { michael@0: display: inline; michael@0: } michael@0: ms:before, ms:after { michael@0: content: "\0022" michael@0: } michael@0: ms[lquote]:before { michael@0: content: attr(lquote) michael@0: } michael@0: ms[rquote]:after { michael@0: content: attr(rquote) michael@0: } michael@0: michael@0: /**************************************************************************/ michael@0: /* Links */ michael@0: /**************************************************************************/ michael@0: :-moz-any-link { michael@0: text-decoration: none !important; michael@0: } michael@0: michael@0: /**************************************************************************/ michael@0: /* attributes common to all tags */ michael@0: /**************************************************************************/ michael@0: michael@0: /* These attributes are mapped to style in nsMathMLElement.cpp: michael@0: michael@0: - background -> background (deprecated) michael@0: - color -> color (deprecated) michael@0: - fontfamily -> font-family (deprecated) michael@0: - fontsize -> font-size (deprecated) michael@0: - fontstyle -> font-style (deprecated) michael@0: - fontweight -> font-weight (deprecated) michael@0: - mathvariant -> -moz-math-variant michael@0: - scriptsizemultiplier -> -moz-script-size-multiplier michael@0: - scriptminsize -> -moz-script-min-size michael@0: - scriptlevel -> -moz-script-level michael@0: - mathsize -> font-size michael@0: - mathcolor -> color michael@0: - mathbackground -> background michael@0: michael@0: */ michael@0: michael@0: michael@0: /**************************************************************************/ michael@0: /* merror */ michael@0: /**************************************************************************/ michael@0: michael@0: merror { michael@0: display: block; michael@0: font-family: sans-serif; michael@0: font-weight: bold; michael@0: white-space: pre; michael@0: margin: 1em; michael@0: padding: 1em; michael@0: border-width: thin; michael@0: border-style: inset; michael@0: border-color: red; michael@0: font-size: 14pt; michael@0: background-color: lightyellow; michael@0: } michael@0: michael@0: /**************************************************************************/ michael@0: /* mtable and its related tags */ michael@0: /**************************************************************************/ michael@0: michael@0: mtable { michael@0: display: inline-table; michael@0: border-collapse: separate; michael@0: border-spacing: 0; michael@0: text-indent: 0; michael@0: } michael@0: mtable[frame="none"] { michael@0: border: none; michael@0: } michael@0: mtable[frame="solid"] { michael@0: border: solid thin; michael@0: } michael@0: mtable[frame="dashed"] { michael@0: border: dashed thin; michael@0: } michael@0: michael@0: mtr, mlabeledtr { michael@0: display: table-row; michael@0: vertical-align: baseline; michael@0: } michael@0: michael@0: mtd { michael@0: display: table-cell; michael@0: vertical-align: inherit; michael@0: text-align: -moz-center; michael@0: white-space: nowrap; michael@0: } michael@0: michael@0: /* Don't support m(labeled)tr without mtable, nor mtd without m(labeled)tr */ michael@0: :not(mtable) > mtr, michael@0: :not(mtable) > mlabeledtr, michael@0: :not(mtr):not(mlabeledtr) > mtd { michael@0: display: none !important; michael@0: } michael@0: michael@0: /* Hide the label because mlabeledtr is not supported yet (bug 356870). This michael@0: rule can be overriden by users. */ michael@0: mlabeledtr > mtd:first-child { michael@0: display: none; michael@0: } michael@0: michael@0: /**********************************************************************/ michael@0: /* rules to achieve the default spacing between cells. The back-end code michael@0: will set the internal attributes depending on the cell's position. michael@0: These rules are hard-coded, the comments indicate what would be michael@0: desirable if the style data could be changed on the fly to pick michael@0: the values that users may set with the attributes of */ michael@0: mtd { michael@0: padding-right: 0.4em; /* half of columnspacing[colindex] */ michael@0: padding-left: 0.4em; /* half of columnspacing[colindex-1] */ michael@0: padding-bottom: 0.5ex; /* half of rowspacing[rowindex] */ michael@0: padding-top: 0.5ex; /* half of rowspacing[rowindex-1] */ michael@0: } michael@0: /* turn off the spacing at the periphery of boundary cells */ michael@0: mtr:first-child > mtd { michael@0: padding-top: 0ex; michael@0: } michael@0: mtr:last-child > mtd { michael@0: padding-bottom: 0ex; michael@0: } michael@0: mtd:first-child { michael@0: -moz-padding-start: 0em; michael@0: } michael@0: mtd:last-child { michael@0: -moz-padding-end: 0em; michael@0: } michael@0: /* re-instate the spacing if the table has a surrounding frame */ michael@0: mtable[frame="solid"] > mtr:first-child > mtd, michael@0: mtable[frame="dashed"] > mtr:first-child > mtd { michael@0: padding-top: 0.5ex; /* framespacing.top */ michael@0: } michael@0: mtable[frame="solid"] > mtr:last-child > mtd, michael@0: mtable[frame="dashed"] > mtr:last-child > mtd { michael@0: padding-bottom: 0.5ex; /* framespacing.bottom */ michael@0: } michael@0: mtable[frame="solid"] > mtr > mtd:first-child, michael@0: mtable[frame="dashed"] > mtr > mtd:first-child { michael@0: -moz-padding-start: 0.4em; /* framespacing.left (or right in rtl)*/ michael@0: } michael@0: mtable[frame="solid"] > mtr > mtd:last-child, michael@0: mtable[frame="dashed"] > mtr > mtd:last-child { michael@0: -moz-padding-end: 0.4em; /* framespacing.right (or left in rtl)*/ michael@0: } michael@0: michael@0: /**************************************************************************/ michael@0: /* This rule is used to give a style context suitable for nsMathMLChars. michael@0: We don't actually style -moz-math-anonymous by default. */ michael@0: /* michael@0: ::-moz-math-anonymous { michael@0: } michael@0: */ michael@0: michael@0: /**********************************************************************/ michael@0: /* This is used when wrapping non-MathML inline elements inside math. */ michael@0: *|*::-moz-mathml-anonymous-block { michael@0: display: inline-block !important; michael@0: position: static !important; michael@0: text-indent: 0; michael@0: } michael@0: michael@0: /**************************************************************************/ michael@0: /* Controlling Displaystyle and Scriptlevel */ michael@0: /**************************************************************************/ michael@0: michael@0: /* michael@0: http://www.w3.org/Math/draft-spec/chapter3.html#presm.scriptlevel michael@0: michael@0: The determination of -moz-math-display for involves the displaystyle michael@0: and display attributes. See the section above. michael@0: */ michael@0: michael@0: /* michael@0: Map mstyle@displaystyle to -moz-math-display. michael@0: */ michael@0: mstyle[displaystyle="false"] { michael@0: -moz-math-display: inline; michael@0: } michael@0: mstyle[displaystyle="true"] { michael@0: -moz-math-display: block; michael@0: } michael@0: michael@0: /* munder, mover and munderover change the scriptlevels of their children michael@0: using -moz-math-increment-script-level because regular CSS rules are michael@0: insufficient to control when the scriptlevel should be incremented. All other michael@0: cases can be described using regular CSS, so we do it this way because it's michael@0: more efficient and less code. */ michael@0: :-moz-math-increment-script-level { -moz-script-level: +1; } michael@0: michael@0: /* michael@0: The mfrac element sets displaystyle to "false", or if it was already false michael@0: increments scriptlevel by 1, within numerator and denominator. michael@0: */ michael@0: mfrac > * { michael@0: -moz-script-level: auto; michael@0: -moz-math-display: inline; michael@0: } michael@0: michael@0: /* michael@0: The mroot element increments scriptlevel by 2, and sets displaystyle to michael@0: "false", within index, but leaves both attributes unchanged within base. michael@0: The msqrt element leaves both attributes unchanged within its argument. michael@0: */ michael@0: mroot > :not(:first-child) { michael@0: -moz-script-level: +2; michael@0: -moz-math-display: inline; michael@0: } michael@0: michael@0: /* michael@0: The msub element [...] increments scriptlevel by 1, and sets displaystyle to michael@0: "false", within subscript, but leaves both attributes unchanged within base. michael@0: michael@0: The msup element [...] increments scriptlevel by 1, and sets displaystyle to michael@0: "false", within superscript, but leaves both attributes unchanged within michael@0: base. michael@0: michael@0: The msubsup element [...] increments scriptlevel by 1, and sets displaystyle michael@0: to "false", within subscript and superscript, but leaves both attributes michael@0: unchanged within base. michael@0: michael@0: The mmultiscripts element increments scriptlevel by 1, and sets displaystyle michael@0: to "false", within each of its arguments except base, but leaves both michael@0: attributes unchanged within base. michael@0: */ michael@0: msub > :not(:first-child), michael@0: msup > :not(:first-child), michael@0: msubsup > :not(:first-child), michael@0: mmultiscripts > :not(:first-child) { michael@0: -moz-script-level: +1; michael@0: -moz-math-display: inline; michael@0: } michael@0: michael@0: /* michael@0: The munder element [...] always sets displaystyle to "false" within the michael@0: underscript, but increments scriptlevel by 1 only when accentunder is michael@0: "false". Within base, it always leaves both attributes unchanged. michael@0: michael@0: The mover element [...] always sets displaystyle to "false" within michael@0: overscript, but increments scriptlevel by 1 only when accent is "false". michael@0: Within base, it always leaves both attributes unchanged. michael@0: michael@0: The munderover [..] always sets displaystyle to "false" within underscript michael@0: and overscript, but increments scriptlevel by 1 only when accentunder or michael@0: accent, respectively, are "false". Within base, it always leaves both michael@0: attributes unchanged. michael@0: */ michael@0: munder > :not(:first-child), michael@0: mover > :not(:first-child), michael@0: munderover > :not(:first-child) { michael@0: -moz-math-display: inline; michael@0: } michael@0: michael@0: /* michael@0: The displaystyle attribute is allowed on the mtable element to set the michael@0: inherited value of the attribute. If the attribute is not present, the michael@0: mtable element sets displaystyle to "false" within the table elements. michael@0: */ michael@0: mtable { -moz-math-display: inline; } michael@0: mtable[displaystyle="true"] { -moz-math-display: block; } michael@0: michael@0: /* michael@0: The mscarries element sets displaystyle to "false", and increments michael@0: scriptlevel by 1, so the children are typically displayed in a smaller font. michael@0: XXXfredw: This element is not implemented yet. See bug 534967. michael@0: mscarries { michael@0: -moz-script-level: +1; michael@0: -moz-math-display: inline; michael@0: } michael@0: */