[Webkit-unassigned] [Bug 170272] MathML: Extra left space for arrows inside <mo>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Apr 1 18:47:28 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=170272

--- Comment #4 from Minsheng Liu <lambda at liu.ms> ---
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:

> 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);
>
>     m_mathOperator.paint(style(), info, operatorTopLeft);
> }

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

> auto contentWidth = width() - leadingSpace - trailingSpace();
> operatorTopLeft.move(-(m_mathOperator.width() - contentWidth) / 2, 0);

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170402/55353382/attachment.html>


More information about the webkit-unassigned mailing list