<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>125597</bug_id>
          
          <creation_ts>2013-12-11 12:03:29 -0800</creation_ts>
          <short_desc>mo text does not appear in dumpAsText output</short_desc>
          <delta_ts>2016-06-24 23:59:55 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>MathML</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>124838</dependson>
    
    <dependson>155018</dependson>
          <blocked>139436</blocked>
    
    <blocked>130245</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Frédéric Wang Nélar">fred.wang</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alex</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cfleizach</cc>
    
    <cc>darin</cc>
    
    <cc>mrobinson</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>958851</commentid>
    <comment_count>0</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2013-12-11 12:03:29 -0800</bug_when>
    <thetext>Try to call DumpRenderTree on the attached testcase. You&apos;ll get the &quot;mtext&quot; text but not the &quot;mo&quot; text.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>958864</commentid>
    <comment_count>1</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2013-12-11 12:48:12 -0800</bug_when>
    <thetext>I&apos;m moving this to Tools/Tests as I think that&apos;s something that could be fixed in rendering/RenderTreeAsText.cpp or similar. Any suggestion for how to do that would be welcome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>958865</commentid>
    <comment_count>2</comment_count>
      <attachid>218996</attachid>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2013-12-11 12:50:27 -0800</bug_when>
    <thetext>Created attachment 218996
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>959462</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2013-12-12 21:11:04 -0800</bug_when>
    <thetext>RenderTreeAsText.cpp is only used when you do *not* call dumpAsText.

The testRunner.dumpAsText feature is implemented with the DOM innerText function, so there is not necessarily a way to fix this without changing the behavior of the DOM. The innerText function, in turn, is based on the text iterator in TextIterator.cpp, which is the same code used for things like converting a selection to plain text on the clipboard when you select and copy something, or searching for text with the browser’s find command.

So this is likely a bug in the MathML implementation and not a tools issue, assuming that we want text from inside an &lt;mo&gt; to be copyable and searchable, etc.

The text iterator primarily iterates the DOM and not the render tree. It does not have any code to dig inside of the kind of render tree that RenderMathMLOperator::updateFromElement builds. We could add code for that, or we could simply add special case code to TextIterator::handleNonTextNode to handle RenderMathMLOperator specially.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>959524</commentid>
    <comment_count>4</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2013-12-13 02:09:49 -0800</bug_when>
    <thetext>Thank you Darin. Indeed, the patch for bug 124838 seems to break text selection of token elements. So I&apos;ll have to check what text iterator is doing and how it could handle MathML text better.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>959559</commentid>
    <comment_count>5</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2013-12-13 08:45:27 -0800</bug_when>
    <thetext>Changing the direction of the dependency since I&apos;ll probably fix the issue while doing the refactoring code of MathML token elements. Some test references are currently incorrect with the &lt;mo&gt; text not appearing in the expected output.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>959568</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2013-12-13 09:30:12 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; Indeed, the patch for bug 124838 seems to break text selection of token elements.

That is an even-more-fundamental issue with the same underlying cause: A render tree that is not linked to a DOM tree in the usual way. Text selection is done by other editing code and is not handled by the text iterator, so text iterator changes will not fix that.

We may need to use a shadow DOM approach as elements like the slider do rather than just creating a set of renderers. Not really my area of expertise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>959570</commentid>
    <comment_count>7</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2013-12-13 09:41:16 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #4)
&gt; &gt; Indeed, the patch for bug 124838 seems to break text selection of token elements.
&gt; 
&gt; That is an even-more-fundamental issue with the same underlying cause: A render tree that is not linked to a DOM tree in the usual way. Text selection is done by other editing code and is not handled by the text iterator, so text iterator changes will not fix that.
&gt; 
&gt; We may need to use a shadow DOM approach as elements like the slider do rather than just creating a set of renderers. Not really my area of expertise.

Yes, I&apos;ve been able to get something for the text output but not the selection. If that&apos;s too complicated, I&apos;ll first try to do the refactoring that is necessary for 99620 on the mo element only and come back to this later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1162383</commentid>
    <comment_count>8</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2016-02-05 06:09:19 -0800</bug_when>
    <thetext>On Alex&apos;s MathMLLayout branch, DumpRenderTree on the testcase now generates the expected &quot;mo&quot; test. Actually, the MathML layout code no longer uses any anonymous nodes for RenderMathMLOperator / RenderMathMLToken, instead we just different measuring / painting functions when necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1205322</commentid>
    <comment_count>9</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2016-06-24 23:59:55 -0700</bug_when>
    <thetext>Fixed after r202420</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>218996</attachid>
            <date>2013-12-11 12:50:27 -0800</date>
            <delta_ts>2013-12-11 12:50:27 -0800</delta_ts>
            <desc>testcase</desc>
            <filename>mo-DumpAsText.html</filename>
            <type>text/html</type>
            <size>185</size>
            <attacher name="Frédéric Wang Nélar">fred.wang</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8c2NyaXB0PgogICAgaWYgKHdpbmRvdy50ZXN0UnVubmVyKQogICAgICAg
IHRlc3RSdW5uZXIuZHVtcEFzVGV4dCgpOwo8L3NjcmlwdD4KPC9oZWFkPgo8Ym9keT4KICA8bWF0
aD4KICAgIDxtdGV4dD5tdGV4dDwvbXRleHQ+IAogICAgPG1vPm1vPC9tbz4KICA8L21hdGg+Cjwv
Ym9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>