Hi Morten,

Thanks for raising this issue, I forgot to mention it. We experimented this in the past and IIRC we found issues with:

- Printing: indeed printing pages with math is likely to happen!
- Multicol: Wikipedia uses that for the "References" section at the bottom of articles and some pages actually do use math inside! - SVG: definitely needed for math in graphics. This is no longer an issue now that foreignObject was implemented in LayoutNG. - Editing: I'm not sure what's the status of EditingNG but I believe we wanted to disable editability on MathML anyway due to complexity for editing math, which will require some tree fixup. This is better handled by other tools.

I don't remember what was the recent status, but we definitely need to check again. I believe we have crash tests in WPT and another to check correct layout for math-in-svg.

On 23/06/2022 13:06, Morten Stenshorne wrote:
Exciting times!

Since the layout implementation of MathML is pure NG (i.e. it has no
legacy engine counterpart), you should be aware that this is somewhat
uncharted territory. We *do* have mechanisms that kick in when we need
to fall back to legacy layout (e.g. when printing, or when there are
tables inside multicol), and have NG-only content inside (such as
MathML), but no pure NG features have shipped yet, so we don't really
know how well this works on the world wild web.

That said, we're also about to ship container queries, which has the
same problem - so you're not alone. I was hoping that we'd be rid of the
legacy engine completely before we started shipping pure NG features,
because of this risk. I'm not saying that we definitely need to wait for
the legacy engine to be completely gone, but you need to be aware of the
risk, at least. Maybe clusterfuzz will find something interesting once
this feature is switched to "stable". :)

By the way, I just tested, and MathML inside legacy layout doesn't seem
to work. I filed
https://bugs.chromium.org/p/chromium/issues/detail?id=1338882

Frédéric Wang <[email protected]> writes:

Contact emails

[email protected], [email protected], [email protected]

Explainer

https://github.com/mathml-refresh/mathml-core/blob/master/docs/explainer.md
https://people.igalia.com/fwang/explainer-font-family-math

Specification

https://mathml-refresh.github.io/mathml-core

Design docs

https://drafts.csswg.org/css-fonts-4/#valdef-font-family-math
https://w3c.github.io/mathml-aam
https://docs.google.com/document/d/1biGEaWN8ThNTDtAbT1M5GIf6N5uQLWdxh2QhrG9uN5c
https://docs.google.com/document/d/1bvY_Npe2zLW_705KXdmecsH6P9I9wBMpHRsZ9CxWNOI/edit#heading=h.u9hwm9tp8nuy

Summary

Adds native DOM/IDL, accessibility support and CSS-compatible OpenType-based 
layout of mathematical formulas. The reference
specifications are MathML Core (which describes in extensive details a 
fundamental subset of the MathML 3 recommendation), MathML AAM
(which describes mapping to platform accessibility APIs). This includes the "math" 
font-family as well as features included in section "CSS
Extensions for Math Layout".

Blink component

Blink

Search tags

mathml

TAG review

https://github.com/w3ctag/design-reviews/issues/438 
https://github.com/w3ctag/design-reviews/issues/313#issuecomment-460523527

TAG review status

Issues addressed

Risks

Interoperability and Compatibility

- This is not implementing the complete list of MathML3, OpenType MATH or 
accessibility features that one can find in other browsers.

- New enhancements (e.g. clarification regarding CSS interoperability) may not 
be implemented in other browsers yet.

- MathML Core and MathML AAM are still working drafts.

Gecko: Shipped/Shipping

WebKit: Shipped/Shipping

Web developers: Positive (https://twitter.com/search?q=mathml%20chrome&f=live) 
Users have recently been excited about it,
experimented exiting implementation under a flag and are eager to see it 
shipped soon. It is currently the 5th most starred Blink issue, see
https://bugs.chromium.org/p/chromium/issues/list?can=2&q=component:Blink&sort=-stars&colspec=ID%20Stars%20Pri%20Status%20Component%20Opened%20Summary


Other signals:

Ergonomics

In the past, MathML trees were not treated specially at all and this was fast ! 
Now, more work is needed for pages that do math rendering
e.g. accessing data from the MATH table, handling operator dictionary, using 
ink text bounds, performing low-level shaping of stretchy
operators, loading and applying CSS UA sheet, or exposing an accessibility 
tree. However, the only performance report we received so far
was issue #1073760, which was discarded after further analysis. In any case, 
performance is definitely better than existing non-native
technologies. Additionally, pages will likely need loading WOFF fonts on 
operating systems that don't ship math fonts. Work is in progress
here, see https://frederic-wang.fr/update-on-open-type-math-fonts.html for 
recent status.

Activation

- Editing MathML source is difficult but special authoring tools & converters 
do exist.

- Implementation may not be as complete as expected by users but the spec tries 
to allow extensibility and the Math WG provides polyfills
at https://github.com/mathml-refresh/mathml-polyfills

- Users may require WOFF fonts to properly render formulas (see above).

Security

There is a risk due to the new attack surface:

- Relatively large amount of new code.

- Newly exposed APIs.

- Interacting with several parts of the web platform.

However, risks related to violation of layout algorithm are reduced now that 
the specification clarifies how to perform it in a CSS-compatible
way. We've fixed 17 issues reported during 2.5 years of development and there 
are currently 0 open security issues (last report was in
March).

Finally, similar security & privacy considerations as existing layout 
specifications apply, see the relevant sections from the MathML Core
spec: https://w3c.github.io/mathml-core/#security-considerations 
https://w3c.github.io/mathml-core/#privacy-considerations

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it 
has potentially high risk for Android WebView-based
applications?

No.

Debuggability

- Nothing particular expected besides what is already provided for SVG and HTML.

- Existing devtools API was extended to handle "font-family: math", see
https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-setFontFamilies

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, 
Chrome OS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

Flag name

MathMLCore

Requires code in //chrome?

True (this is only to implement support for “font-family: math”, which has a 
user preference menu for math font, see
https://docs.google.com/document/d/1bvY_Npe2zLW_705KXdmecsH6P9I9wBMpHRsZ9CxWNOI/edit#heading=h.u9hwm9tp8nuy).

Tracking bug

http://crbug.com/6606

Sample links

https://people.igalia.com/fwang/2022-06-igalia-week-shipping-mathml-in-chromium/#/12
https://fred-wang.github.io/MathFonts

Estimated milestones

  DevTrial on desktop  103

  DevTrial on Android  103

Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop 
issues. Please list open issues (e.g. links to known github
issues in the project for the feature specification) whose resolution may 
introduce web compat/interop risk (e.g., changing to naming or
structure of the API in a non-backward-compatible way).

https://github.com/w3c/csswg-drafts/issues/5866
https://github.com/w3c/mathml-core/issues/74
https://github.com/w3c/mathml-core/issues/75
https://github.com/w3c/mathml-core/issues/76
https://github.com/w3c/mathml-core/issues/77

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5240822173794304

Links to previous Intent discussions

Intent to prototype: 
https://groups.google.com/a/chromium.org/g/blink-dev/c/OOZIrtSPLeM

This intent message was generated by Chrome Platform Status.
--
Frédéric Wang


--
Frédéric Wang

--
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/37ca5f43-60a8-54a6-e2e6-f781fe8c71bd%40igalia.com.

Reply via email to