Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b116eac12b99e00c6f202d8dc0d6f330285dee4
      
https://github.com/WebKit/WebKit/commit/1b116eac12b99e00c6f202d8dc0d6f330285dee4
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLRoot.h

  Log Message:
  -----------
  Empty <msqrt> is misaligned vertically relative to 
<msqrt><mrow></mrow></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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to