Empty <msqrt> is misaligned vertically relative to <msqrt><mrow></mrow></msqrt>#64606
Conversation
|
EWS run on previous version of this PR (hash bd117e0) Details |
bd117e0 to
3d3db47
Compare
|
EWS run on previous version of this PR (hash 3d3db47) Details |
| MathOperator m_radicalOperator; | ||
| LayoutUnit m_radicalOperatorTop; | ||
| LayoutUnit m_baseWidth; | ||
| LayoutUnit m_ascent; |
There was a problem hiding this comment.
It's a pity we have to introduce a new member just for the sake of handling the empty msqrt... The alternative would be to use an anonymous mrow, which I guess is worse memory-wise
Incidentally, it's possible we can compute these LayoutUnit members needed as needed (sharing code with layout) if that's not too computationally costly, so that we avoid the storage and invalidation issue. I believe that's what Chromium do. Anyway, probably not worth considering for this issue.
There was a problem hiding this comment.
@fred-wang - I did changes here, so it would be good, if you can have another look. Thanks!
3d3db47 to
980f4e4
Compare
|
EWS run on current version of this PR (hash 980f4e4) Details |
…w></msqrt> https://bugs.webkit.org/show_bug.cgi?id=302662 rdar://165365714 Reviewed by Frédéric Wang Nélar. Per MathML Core, an empty <msqrt> must render as if it had a single empty <mrow> child (https://w3c.github.io/mathml-core/#radicals-msqrt-mroot). While layout produces the same box, the baseline reported by the renderer does not: RenderMathMLRow::firstLineBaseline() returns nullopt when there are no in-flow children, so the inline-block fallback uses the box's bottom edge. The reference case with an explicit empty <mrow> child instead reports a baseline at radicalAscent, which is where the implicit mrow sits above the radical's rule line. The two forms therefore sit at different vertical positions on the line (offset by radicalDescent, which is non-zero whenever the stretched radical operator is taller than verticalGap + ruleThickness). Override firstLineBaseline() in RenderMathMLRoot to synthesize the baseline of the implicit empty mrow when the root is a SquareRoot with no in-flow child. With no base content, baseAscent is zero, so the synthesized ascent collapses to verticalGap + ruleThickness + extraAscender (plus border and padding before). Compute this on demand from verticalParameters() rather than caching it in a member, and make verticalParameters() const so it can be called from firstLineBaseline(). RootType::RootWithIndex with a missing child is !isValid() and already falls through to plain row layout, where the default baseline is correct, so it does not need special handling. * LayoutTests/TestExpectations: Progression * Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::verticalParameters const): (WebCore::RenderMathMLRoot::firstLineBaseline const): * Source/WebCore/rendering/mathml/RenderMathMLRoot.h: Canonical link: https://commits.webkit.org/313000@main
980f4e4 to
1b116ea
Compare
|
Committed 313000@main (1b116ea): https://commits.webkit.org/313000@main Reviewed commits have been landed. Closing PR #64606 and removing active labels. |
🧪 webkitpy
1b116ea
980f4e4
🧪 wpe-wk2🧪 win-tests🧪 ios-wk2-wpt🧪 api-mac-debug🧪 mac-AS-debug-wk2