MathML in Web Browsers

Project Roadmap

Below is the project roadmap that was completed in 2019 on Igalia’s downstream branch of Chromium. Since then, a huge effort has been made to upstream that code so that they are shipped in all Chromium-based browsers. Goals have been slightly adapted according to feedback from Chromium reviewers and agreement in standardization groups. Such changes are indicated by a pen symbol β€œπŸ–Šβ€οΈ together with the amendment details.

As of September 2021, a significant amount of the work is upstreamed and already available in official Chromium builds under the Experimental Web Platform Features flag. The latest status is indicated by a green check mark β€œβœ…β€ (work upstreamed), a roadwork sign β€œπŸš§β€ (upstream work in progress) and a red cross β€œβŒβ€ (upstreaming not started yet).

βœ… Basic Setup

  • βœ… Simple grouping <math> (with its display attribute), <mrow>, <mstyle>, <merror> (with special CSS style), <mpadded>, <mphantom> (with visibility: hidden).
  • βœ… Simple text container: <mi>, <mn>, <mo>, <mtext> and <ms>.
  • βœ… Simple spacing: <mspace> element with width, depth, height attributes.
  • βœ… dir, mathcolor, mathbackground and mathsize attributes.
    • πŸ–Š 2022/05/09: Initial roadmap did not elaborate about right-to-left support. Although the dir attribute is properly mapped to the CSS direction property and that property taken into account for MathML layout, mirroring of stretchy operators is currently not supported.
  • βœ… Simplified semantics: just display the first child and hide annotations.

🚧 Basic Layout

  • βœ… Fraction (<mfrac>), with its linethickness attribute.
  • βœ… Postscripts: <msub>, <msup>, <msubsup>
  • βœ… Under and over scripts: <munder>, <mover>, <munderover>
  • βœ… Multiple pre and post scripts: <mmultiscripts>
  • 🚧 Basic HTML-like implementation of mtable.
  • βœ… Advanced Spacing: mpadded with simplified interpretation of width, depth, height, lspace and voffset.

βœ… Operator Dictionary

  • βœ… form (for selecting an entry in the dictionary)
  • βœ… largeop and movablelimits (to perform spacing in under and over scripts)
  • βœ… lspace and rspace (to perform spacing in <mrow>-like elements).

βœ… Stretchy operators

  • βœ… Shaping large and stretchy operators using the MathVariants table.
  • βœ… Drawing of largeop operators in under and over scripts
  • βœ… Stretch logic in <mrow>-like elements and under and over scripts.
    • πŸ–Š 2021/08/04 Initial roadmap was to implement what is described in MathML Core but see below for current limitations.
  • βœ… Using stretchy and symmetric attributes.
  • βœ… Simple embellished operators
  • βœ… Roots (msqrt, mroot)

βœ… Advanced Style

  • βœ… mathvariant
    • πŸ–Š 2020/09/10: Initial goal was to support the mathvariant values from MathML 3. However we were only able to get one text-transform value accepted by the CSSWG. This provides automatic italic of variables ; authors are encouraged to directly use the relevant Unicode characters for other math variants.
  • βœ… displaystyle
  • βœ… scriptlevel

βœ… Accessibility

πŸ–Š 2019/10/15: Initial roadmap was focusing on MathML rendering but after sending the intent-to-implement, we were asked to coordinate with the accessibility team. The goal is to get parity with Gecko and WebKit on two platforms:

  • βœ… Same macOS / NSAccessibility roles, subroles and attributes as Gecko and WebKit.
  • βœ… Same Linux / ATK roles and markup information as Gecko.

πŸ–Š β€œwidth” of stretchy operators (blocked on Chromium’s refactoring)

In MathML Core, the min-content β€œwidth” and max-content β€œwidth” of a stretchy operator are the same : either the maximum β€œwidth” of all its sizes (vertical operators) or the β€œwidth” of its base size (horizontal operators).

This is obviously not the same as the actual β€œwidth” calculated during layout e.g. small, medium and big (vertical) fences can take different widths while a stretched (horizontal) accent is normally much wider than its base size.

Currently, Chromium’s layout implementation must use the min/max-content β€œwidth” as the actual β€œwidth” of bounding boxes. For MathML, this means that:

  • A vertical stretchy operator may be more narrow than its bounding box.
  • A horizontal stretchy operator may overflow its bounding box.

Note that Igalia’s downstream branch did not have this problem since it was not respecting Chromium’s limitation. Also, the issue is slightly mitigated upstream by splitting the extra space or overflow evenly on both sides.

Google’s rendering core has a plan to rewrite how the layout steps work but this is a big effort. Until that is resolved, one cannot properly implement stretchy operators as described in MathML Core and these operators will continue to cause serious rendering bugs.

βœ… Other tasks (not in the initial roadmap)

πŸ–Š 2022/05/09: This list used to contain more items but has been updated to only include the ones that are expected to be in the initial release.

The following features have been discussed with Chromium reviewers or Math/CSS WG members during the implementation phase but they were not part of the initial roadmap:

  • βœ… Clear and small specification targeted towards browser implementers
  • βœ… Web Platform tests (with order of magnitude of thousands tests)
  • βœ… Relaunching a Standardization Group for MathML
  • βœ… Basic MathML DOM/IDL
  • βœ… display: math
  • βœ… text-transform: auto
  • βœ… CSS math-style property
  • βœ… CSS math-shift property
  • βœ… CSS math-depth property
  • βœ… font-family: math value
  • βœ… UA stylesheet adjustments
  • βœ… Basic handling of invalid markup
  • βœ… Integration with features forcing legacy layout (SVG, editing, fragmentation)
  • βœ… minsize and maxsize attributes for vertical operator stretching
  • βœ… ink metrics for MathML token elements

Besides these tasks, Igalia continues to keep an eye on security bugs, interoperability issues as well as compatibility with CSS.