During its layout, MathML renderers use the int value provided by firstLineBaseline to determine the ascent of boxes. For better accuracy, it should use a LayoutUnit value. We can actually do that by introducing a m_ascent member which should help to share code between all the MathML renderer.
Created attachment 274897 [details]
Created attachment 274907 [details]
Most of the code use LayoutUnit when calculating the firstLineBaseline but I guess it is still possible to improve that a bit. The WIP patch is probably obsolete but at least it provides an idea.
I'm not exactly sure why firstLineBaseline() must return an (Optional) int for MathML (besides the fact that MathML renderer classes used to derive from flexboxes). I think we want to use LayoutUnit as much as possible.
I'm making this depends on bug 161136 and bug 161127 which allow to implement firstLineBaseline() without having to store LayoutUnit members and keep them updated. In general, it seems that performing a simple computation is always better than having to use a (possible not up-to-date class member).
I'm cc'int Jacques Distler as he reported an issue with the alignment of attachment 286836 [details] that I suspect is due to this bug (but I was not able to reproduce it).