Bug 155879 - Use LayoutUnit values for MathML ascent
Summary: Use LayoutUnit values for MathML ascent
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: MathML (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on: 161127 161136 180151
Blocks: 132009
  Show dependency treegraph
Reported: 2016-03-25 03:48 PDT by Frédéric Wang (:fredw)
Modified: 2017-11-29 13:10 PST (History)
2 users (show)

See Also:

WIP Patch (32.10 KB, patch)
2016-03-25 03:49 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff
WIP Patch (179.90 KB, patch)
2016-03-25 08:11 PDT, Frédéric Wang (:fredw)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang (:fredw) 2016-03-25 03:48:29 PDT
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.
Comment 1 Frédéric Wang (:fredw) 2016-03-25 03:49:38 PDT
Created attachment 274897 [details]
WIP Patch
Comment 2 Frédéric Wang (:fredw) 2016-03-25 08:11:11 PDT
Created attachment 274907 [details]
WIP Patch
Comment 3 Frédéric Wang (:fredw) 2016-07-11 22:12:14 PDT
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.
Comment 4 Frédéric Wang (:fredw) 2016-08-24 07:00:59 PDT
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).