<html>
<head>
<base href="https://bugs.webkit.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - MathML: Extra left space for arrows inside <mo>"
href="https://bugs.webkit.org/show_bug.cgi?id=170272#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - MathML: Extra left space for arrows inside <mo>"
href="https://bugs.webkit.org/show_bug.cgi?id=170272">bug 170272</a>
from <span class="vcard"><a class="email" href="mailto:lambda@liu.ms" title="Minsheng Liu <lambda@liu.ms>"> <span class="fn">Minsheng Liu</span></a>
</span></b>
<pre>I believe I have found the issue, but since I am not familiar with the code, I am not sure what is the right way to fix it. In RenderMathMLOpeartor.cpp, line 290 - 311:
<span class="quote">> void RenderMathMLOperator::paint(PaintInfo& info, const LayoutPoint& paintOffset)
> {
> RenderMathMLToken::paint(info, paintOffset);
> if (!useMathOperator())
> return;
>
> LayoutPoint operatorTopLeft = paintOffset + location();
> operatorTopLeft.move(style().isLeftToRightDirection() ? leadingSpace() : trailingSpace(), 0);
>
> // Center horizontal operators.
> if (!isVertical())
> operatorTopLeft.move(-(m_mathOperator.width() - width()) / 2, 0);</span >
>
<span class="quote">> m_mathOperator.paint(style(), info, operatorTopLeft);
> }</span >
For the un-stretchy operator, useMathOperator() returns false and the code ends at the fifth line. The paintOffset is { x = 512, y = 512 } (which depends on the specific HTML I am using). Later in RenderBlock::paint(), it will be adjusted to { x = 796, y = 512 }, where 796 - 512 = 284 is the leading space, I believe (there is some space around the operator).
However, for the stretchy operator, the code continues. location() returns nothing. leadingSpace() gives 284. m_mathOperator.width() gives 790, width() gives 1538. Note that (1538 - 790) / 2 = 284. In other words, by adding the leadingSpace() the operator is already centered. Centering horizontal operators again actually moves the operator towards right by 284. I believe the “center horizontal operators” part is unnecessary, or should be grounded by something like
<span class="quote">> auto contentWidth = width() - leadingSpace - trailingSpace();
> operatorTopLeft.move(-(m_mathOperator.width() - contentWidth) / 2, 0);</span >
I am not sure, however, this gives the correct semantics, as I am truly unfamiliar with the code.
Moreover, it seems that the vertical positioning for stretchy operator is also wrong. I will keep inspecting the code.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>