[webkit-dev] Implementing MathML stylistic attributes in WebKit

Frédéric Wang fwang at igalia.com
Mon Sep 2 07:11:21 PDT 2019


Currently MathML attributes mathvariant, displaystyle and scriptlevel
[1] [2] are implemented in WebKit using custom "style resolution" and
"one-glyph rendering" inside the MathML layout code [3] [4] [5]. These
features involve text rendering and interaction with CSS font-size, so
it is difficult to implement them properly and completely that way.
There are known bugs and missing features right now (e.g. mathvariant
transform only applies to one-character strings, automatic
displaystyle/scriptlevel does not work with fractions, etc)

Several years ago, Gecko used to do something similar but that was
causing a lot of problems (dynamic update, assertion failures...). At
the end, this is now implemented in Gecko more reliably by mapping the
attributes to internal CSS properties ; [6] is based on that. When I
tried to do something like this in WebKit three years ago, I was only
able to rely on proprietary -webkit-* extensions exposed to users [7].

So my questions are:

(1) What is WebKit's mechanism to implement such stylistic attributes?

(2) Is it possible to implement internal (i.e. not web-exposed to users)
CSS properties/values in WebKit?

(3) Is it ok to add more -webkit-* properties/values or should these
properties be standardized at the CSS WG instead?

I understand answers to these general questions from other browser
project is either use internal properties or standardize them.



PS: For a concrete example, see [8]. Automatic mathvariant is used for
italic variables while font-size in fractions is calculated according to
displaystyle / scriptlevel rules. The latter is incorrect (check the
attached screenshot) while selection highlight is broken for the former.

[1] https://mathml-refresh.github.io/mathml-core/#the-mathvariant-attribute
[7] https://bugs.webkit.org/show_bug.cgi?id=133845#c5
[8] https://bug-201242-attachments.webkit.org/attachment.cgi?id=377730

Frédéric Wang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20190902/e01fa4a6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gamma.jpg
Type: image/jpeg
Size: 44192 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20190902/e01fa4a6/attachment.jpg>

More information about the webkit-dev mailing list