<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 &lt;mo&gt;"
   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 &lt;mo&gt;"
   href="https://bugs.webkit.org/show_bug.cgi?id=170272">bug 170272</a>
              from <span class="vcard"><a class="email" href="mailto:lambda&#64;liu.ms" title="Minsheng Liu &lt;lambda&#64;liu.ms&gt;"> <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">&gt; void RenderMathMLOperator::paint(PaintInfo&amp; info, const LayoutPoint&amp; paintOffset)
&gt; {
&gt;     RenderMathMLToken::paint(info, paintOffset);
&gt;     if (!useMathOperator())
&gt;         return;
&gt; 
&gt;     LayoutPoint operatorTopLeft = paintOffset + location();
&gt;     operatorTopLeft.move(style().isLeftToRightDirection() ? leadingSpace() : trailingSpace(), 0);
&gt; 
&gt;     // Center horizontal operators.
&gt;     if (!isVertical())
&gt;         operatorTopLeft.move(-(m_mathOperator.width() - width()) / 2, 0);</span >
&gt;
<span class="quote">&gt;     m_mathOperator.paint(style(), info, operatorTopLeft);
&gt; }</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">&gt; auto contentWidth = width() - leadingSpace - trailingSpace();
&gt; 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>