[Webkit-unassigned] [Bug 133845] New: Implement an internal -webkit-math-display property or similar

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 13 04:23:01 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=133845

           Summary: Implement an internal -webkit-math-display property or
                    similar
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: fred.wang at free.fr
                CC: bfulgham at webkit.org, cfleizach at apple.com,
                    mrobinson at webkit.org, gur.trio at gmail.com
            Blocks: 118737


In order to support the MathML displaystyle, the simplest and more reliable way would be to follow Gecko's behavior: implement an internal math-display CSS property or similar and use the value in the MathML code. I'm not familiar with the CSS code, so I can give more details without reading Source/WebCore/css/ first. Then the property can be used in

http://trac.webkit.org/browser/trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h#L71

and, after bug 118737, in other places in the MathML code.

The user agent stylesheet of Gecko is http://mxr.mozilla.org/mozilla-central/source/layout/mathml/mathml.css and the relevant rules are:

math {
  -moz-math-display: inline;
}
math[mode="display"], math[display="block"] {
  -moz-math-display: block;
}
math[display="inline"] {
  -moz-math-display: inline;
}
math[displaystyle="false"] {
  -moz-math-display: inline;
}
math[displaystyle="true"] {
  -moz-math-display: block;
}

/**************************************************************************/
/* 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 at 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;
}
*/

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list