Bringing MathML to Chromium

MathML in Chromium

Project Scope

While working on MathML support in WebKit in 2016, Igalia has regularly been in touch with Google engineers involved in Chromium layout developments. Following the technical discussions, there is now a general agreement on the way to proceed the implementation. The general technical agreement is based on two important premises.

1) MathML Implementation Note

The proposed implementation focuseson the MathML rendering described in this implementation note which extends MathML with some rules from the MATH table of the Open Font Format and from the TeXBook’s Appendix G. and which focuses on good integration in HTML5 technologies and in web engines.

As a consequence, it becomes much easier to write conformance tests that can be automatically executed in web engines. Tests for that implementation note have already been integrated into the official W3C’s web-platform-tests in order to ensure consistent rendering in Gecko, WebKit or any other web engines compatible with that test framework. This approach has been already successful for Gecko and WebKit developments.

2) Direct implementation in Blink

The implemenation will be done directly in Blink. We will rely on the existing C++ implementation of Houdini as well as other non-exposed features (e.g. HarfBuzz OpenType MATH support). Houdini is a set of specifications providing APIs to allow web authors to implement their own custom layout and rendering.

Additionally, we identified and discussed with Google the following basic features required to build a proper MathML implementation:

Creating MathML element classes

Custom layout of MathML boxes using LayoutNG

Parsing of attributes

Reading the MathML Operator Dictionary

Painting of graphical elements

Shaping large and stretchy operators

Support mathvariant transforms of text

Project Roadmap

Here is a proposed roadmap with estimated full-time resource. On the one hand, testing and review might require additional work or waiting period. On the other hand, some tasks may be performed in parallel. Initial plan may be adjusted as we make progress or depending of the funds raised.

1) Basic Setup

We will create basic classes for the following MathML elements as well as simple layout using LayoutNG. Right-to-left and vertical layout should be taken into account from the beginning.

Simplified semantics: just display the first child and hide annotations.

2) Basic Layout

We will create partial implementation of some layout elements. Some, but not all OpenType MATH constants will be used. During this step, displaystyle is assumed to be true while scriptlevel is not incremented.