layout/mathml/mathml.css

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 /* Put Cambria before Cambria Math as Cambria Math has neither bold nor   */
    15 /* italic.                                                                */
    16 /**************************************************************************/
    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 }
    45 /**************************************************************************/
    46 /* Token elements                                                         */
    47 /**************************************************************************/
    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  }
    62 /**************************************************************************/
    63 /* Links                                                                  */
    64 /**************************************************************************/
    65 :-moz-any-link {
    66   text-decoration: none !important;
    67 }
    69 /**************************************************************************/
    70 /* attributes common to all tags                                          */
    71 /**************************************************************************/
    73 /* These attributes are mapped to style in nsMathMLElement.cpp:
    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
    89 */
    92 /**************************************************************************/
    93 /* merror                                                                 */
    94 /**************************************************************************/
    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 }
   110 /**************************************************************************/
   111 /* mtable and its related tags                                            */
   112 /**************************************************************************/
   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 }
   130 mtr, mlabeledtr {
   131   display: table-row;
   132   vertical-align: baseline;
   133 }
   135 mtd {
   136   display: table-cell;
   137   vertical-align: inherit;
   138   text-align: -moz-center;
   139   white-space: nowrap;
   140 }
   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 }
   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 }
   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 }
   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 */
   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 }
   214 /**************************************************************************/
   215 /* Controlling Displaystyle and Scriptlevel                               */
   216 /**************************************************************************/
   218 /*
   219   http://www.w3.org/Math/draft-spec/chapter3.html#presm.scriptlevel
   221   The determination of -moz-math-display for <math> involves the displaystyle
   222   and display attributes. See the <math> section above.
   223 */
   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 }
   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; }
   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 }
   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 }
   261 /*
   262    The msub element [...] increments scriptlevel by 1, and sets displaystyle to
   263    "false", within subscript, but leaves both attributes unchanged within base.
   265    The msup element [...] increments scriptlevel by 1, and sets displaystyle to
   266    "false", within superscript, but leaves both attributes unchanged within
   267    base.
   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.
   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 }
   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.
   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.
   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 }
   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; }
   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 */

mercurial