Bug 118738

Summary: Improve how the script size is determined
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: MathMLAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://www.w3.org/TR/2010/REC-MathML3-20101021/chapter3.html#presm.scriptlevel
Bug Depends on: 49309    
Bug Blocks: 124907    
Description Flags
testcase none

Description Frédéric Wang (:fredw) 2013-07-16 10:03:11 PDT
Currently the script size is determined by the following CSS rule in WebCore/css/mathml.css:

msub > * + *, msup > * + *, msubsup > * + *, munder > * + *, mover > * + *, munderover > * + * {
    font-size: 0.75em; /* FIXME: MathML standard is 0.71em */

The MathML specification describes a more complicated way to compute that size using the scriptlevel, scriptminsize and  scriptsizemultiplier attributes. In Gecko these are implemented in the text rendering using private -moz-* CSS properties and then these properties are set by the MathML code. Some elements like scripts, fractions or roots increment the scriptlevel (the exact rules rely on the displaystyle value, see bug 118737).

See also bucket 3 of the MathML Acid3 tests:

and chapter 3 of the MathML spec for details:
Comment 1 Frédéric Wang (:fredw) 2013-07-16 10:24:56 PDT
Created attachment 206795 [details]

Here is a testcase. The scriptsizemultiplier is .5, mroot increments the scriptlevel of its script by 2 and there is no scriptminsize constraint (set to 0). So the size of "SCRIPT" should be 0.5 ^ 2 = 25%, which is the size of "REFERENCE".