From markup to layout
A MathML mfrac represents a fraction with numerator and denominator children. Implementing it in an engine means more than placing two boxes vertically. Font metrics, mathematical constants, vertical shifts, gaps and the fraction bar must cooperate so that rendered mathematics is legible and predictable.
Geometry and font metrics
The initial problem can be described as constrained layout. First measure the numerator and denominator. Then determine the inline size and vertical placements using available mathematical font parameters or appropriate fallback behavior. Finally compute the overall ascent and descent. A valid implementation must account for the case where the fraction bar is absent or has a non-default thickness.
Fraction bar painting
The fraction rule is a painted primitive, not a textual glyph. Its position and thickness belong to the fraction's layout result. Keeping painting derived from measured geometry avoids accidental drift between what the layout engine reserves and what the paint stage renders.
Fragments and integration
In the Servo layout work discussed here, MathFragment is used to represent the mathematical result within the broader fragment machinery, including BoxFragment wrapping. The interesting design question is where specialized MathML geometry ends and ordinary fragment traversal begins. That boundary affects painting, sizing, hit testing and future accessibility integration.
A small test case
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfrac>
<mi>a</mi>
<mi>b</mi>
</mfrac>
</math>A useful test matrix includes differing numerator and denominator widths, nested fractions, zero rule thickness, and multiple fonts. Screenshot comparisons alone are not enough when structural layout and crash regressions are also possible.
Testing and next steps
The project notes discuss enabling relevant WPT coverage and running MathML tests under Servo. Follow-up validation should separate spec conformance, reference rendering, regressions and platform-specific font behavior. The exact outcome of each test should be recorded against the commit and environment that produced it.
What remains uncertain
This is an engineering draft based on discussions, not a claim that every mfrac edge case is implemented or upstreamed. Code-level constants, benchmarks and test counts will be inserted only after verifying the actual changes and their results.