layout/mathml/mathml.css

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial