Changes between Initial Version and Version 1 of MathML/Early_2016_Refactoring

Mar 28, 2016 10:49:13 AM (6 years ago)



  • MathML/Early_2016_Refactoring

    v1 v1  
     1For the rationale and initial plan see [ Alex's message] on webkit-dev mailing list.
     3The idea is now to remove the flexbox dependency (CSS properties & class inheritance) only after having rewritten MathML layout functions from stratch. Hence we no longer need to temporarily "duplicate" flexbox code and this should make review easier. When refactoring renderer classes, we also remove the anonymous renderers (and their associated style) that were created for the sake of the flexbox-based layout.
     5[ The general box model for MathML renderers] is available on the MathML in HTML5 note where you can also find other rules specific to each element. During this first step, we do not always follow completely the layout suggested in that note. Also for now, we ignore the distinction between ink VS logical metrics as well as classical CSS features like margin, padding, border, absolute position, vertical layout or linebreaking. However we do pay attention to right-to-left rendering of mathematical formulas.
     7There are essentially four functions to look at:
     8* '''computePreferredLogicalWidths''': it sets the preferred min/max width. For now we do not do math line breaking so these widths are equal. They are only an estimate of the final width, because we do not know the exact width of stretchy operators (e.g. vertical parenthesis) until they get their final size.
     9* '''layoutBlock''': it calculates the (exact) logical width, the logical height and and position of child renderers.
     10* '''firstLineBaseLine''': it calculates the ascent of the renderer.
     11* '''paint''': it does special painting for e.g. fraction line or root overbar.
     13The initial goal is [ bug 153991]. It now depends on the following bugs. Patches are generally more or less independent, although test expectations will depend on the exact order in which they are applied.
     151) [ RenderMathMLRow]: layout a row of math items (numbers, operators, variables... or any subformulas), maybe with some operators stretching vertically.
     172) [ RenderMathMLUnderOver]: base with some scripts above and below.
     193) [ RenderMathMLFraction]: layout a fraction with numerator & denominator. The patch also fixes some bugs and uses some parameters from the OpenType MATH table.
     214) [ RenderMathMLScripts]: base with arbitrary number of pre/post scripts. Note that the patch introduces many parameters from the OpenType MATH table so be sure to read the [ corresponding section in the MathML in HTML5 note].
     235) [ Separate module for stretchy operators]: Some stretchy operators (e.g. the radical sign) are currently drawn using anonymous RenderMathMLOperators. Since we want to get rid of anonymous renderers, we need this preliminary step. It also improves a bit the rendering of horizontal operators.
     256) [ RenderMathMLRoot]: square root or arbitrary N-th root. Again, read [ the corresponding section in the MathML in HTML5 note] to understand all the parameters. Since we want to draw radical signs without anonymous renderers, we need bug 152244 first.
     277) [ RenderMathMLOperator and RenderMathMLToken]: Simple text (operators, variables, numbers etc). This removes anonymous renderers but the layout functions still rely on the RenderFlexibleBox's implementation. A new generic layout code will only be introduced for RenderMathMLBlock in bug 153991.
     298) [ RenderMathMLMenclose]: A RenderMathMLRow with some additional notations on it (strikes, boxes, circles etc). It is the follow up of bug 153208. See also [ this proposal].
     319) [ RenderMathMLSpace]: Simple renderer to insert blank boxes for adjusting spacing of math formulas.
     33This refactoring will fix many known MathML bugs and open the way for more bug fixes & features (see Bugzilla dependencies for details).