<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[165702] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/165702">165702</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2014-03-16 10:33:48 -0700 (Sun, 16 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[regression] foreign content not displayed in MathML
&lt;https://webkit.org/b/124128&gt;

Reviewed by Chris Fleizach.

Source/WebCore:

This restores foreign content in &lt;mtext&gt;, &lt;mn&gt; and &lt;mi&gt; elements, but only when it is &quot;phrasing content&quot; as defined per the HTML5 specification. Other token elements are not handled here. This change makes mspace-units.html work again on Linux.

Tests: mathml/presentation/foreign-mi-dynamic.html
       mathml/presentation/foreign-mi.html
       mathml/presentation/foreign-mn.html
       mathml/presentation/foreign-mtext-rejected.html
       mathml/presentation/foreign-mtext.html

* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::createElementRenderer): create a RenderMathMLToken for mn, ms and mtext.
(WebCore::isPhrasingContent): helper function to check phrasing content, as defined by the HTML spec.
(WebCore::MathMLTextElement::childShouldCreateRenderer): &lt;mi&gt;, &lt;mn&gt;, &lt;mtext&gt; and, &lt;ms&gt; now accepts phrasing content.
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::RenderMathMLToken):
(WebCore::RenderMathMLToken::updateTokenContent): initialize the m_containsElement boolean when updating the token content.
(WebCore::RenderMathMLToken::updateStyle): move &lt;mi&gt; specific handling in its own section and only apply the single-char rule when it does not contain elements.
* rendering/mathml/RenderMathMLToken.h: add an m_containsElement boolean to handle token element specifically.

LayoutTests:

* mathml/presentation/foreign-mi-dynamic-expected.html: Added.
* mathml/presentation/foreign-mi-dynamic.html: Added.
* mathml/presentation/foreign-mi-expected-mismatch.html: Added.
* mathml/presentation/foreign-mi.html: Added.
* mathml/presentation/foreign-mn-expected-mismatch.html: Added.
* mathml/presentation/foreign-mn.html: Added.
* mathml/presentation/foreign-mtext-expected-mismatch.html: Added.
* mathml/presentation/foreign-mtext-rejected-expected.html: Added.
* mathml/presentation/foreign-mtext-rejected.html: Added.
* mathml/presentation/foreign-mtext.html: Added.
* platform/efl/TestExpectations: reenable the test.
* platform/gtk/TestExpectations: ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLTextElementcpp">trunk/Source/WebCore/mathml/MathMLTextElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLTokencpp">trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingmathmlRenderMathMLTokenh">trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmidynamicexpectedhtml">trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmidynamichtml">trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmiexpectedmismatchhtml">trunk/LayoutTests/mathml/presentation/foreign-mi-expected-mismatch.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmihtml">trunk/LayoutTests/mathml/presentation/foreign-mi.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmnexpectedmismatchhtml">trunk/LayoutTests/mathml/presentation/foreign-mn-expected-mismatch.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmnhtml">trunk/LayoutTests/mathml/presentation/foreign-mn.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmtextexpectedmismatchhtml">trunk/LayoutTests/mathml/presentation/foreign-mtext-expected-mismatch.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmtextrejectedexpectedhtml">trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmtextrejectedhtml">trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationforeignmtexthtml">trunk/LayoutTests/mathml/presentation/foreign-mtext.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/LayoutTests/ChangeLog        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-03-16  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        [regression] foreign content not displayed in MathML
+        &lt;https://webkit.org/b/124128&gt;
+
+        Reviewed by Chris Fleizach.
+
+        * mathml/presentation/foreign-mi-dynamic-expected.html: Added.
+        * mathml/presentation/foreign-mi-dynamic.html: Added.
+        * mathml/presentation/foreign-mi-expected-mismatch.html: Added.
+        * mathml/presentation/foreign-mi.html: Added.
+        * mathml/presentation/foreign-mn-expected-mismatch.html: Added.
+        * mathml/presentation/foreign-mn.html: Added.
+        * mathml/presentation/foreign-mtext-expected-mismatch.html: Added.
+        * mathml/presentation/foreign-mtext-rejected-expected.html: Added.
+        * mathml/presentation/foreign-mtext-rejected.html: Added.
+        * mathml/presentation/foreign-mtext.html: Added.
+        * platform/efl/TestExpectations: reenable the test.
+        * platform/gtk/TestExpectations: ditto.
+
</ins><span class="cx"> 2014-03-14  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reinstate intialiser syntax in for-in loops
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmidynamicexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic-expected.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic-expected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic-expected.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mi&lt;/title&gt;
+  &lt;/head&gt;
+
+  &lt;body&gt;
+
+    &lt;math&gt;&lt;mi&gt;x&lt;span&gt;&lt;/span&gt;&lt;/mi&gt;&lt;/math&gt;
+
+    &lt;math&gt;&lt;mi&gt;sin&lt;span&gt;&lt;/span&gt;&lt;/mi&gt;&lt;/math&gt;
+
+    &lt;math&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/math&gt;
+
+    &lt;math&gt;&lt;mi&gt;sin&lt;/mi&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmidynamichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mi-dynamic.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mi&lt;/title&gt;
+    &lt;script type=&quot;text/javascript&quot;&gt;
+      function test()
+      {
+        var span1 = document.createElement(&quot;span&quot;);
+        document.getElementById(&quot;mi1&quot;).appendChild(span1);
+
+        var span2 = document.createElement(&quot;span&quot;);
+        document.getElementById(&quot;mi2&quot;).appendChild(span2);
+        
+        span1 = document.getElementById(&quot;span1&quot;);
+        span1.parentNode.removeChild(span1);
+
+        span2 = document.getElementById(&quot;span2&quot;);
+        span2.parentNode.removeChild(span2);
+      }
+      
+    &lt;/script&gt;
+  &lt;/head&gt;
+
+  &lt;body onload=&quot;test()&quot;&gt;
+
+    &lt;!-- This should render the same as the static reference. --&gt;
+
+    &lt;math&gt;&lt;mi id=&quot;mi1&quot;&gt;x&lt;/mi&gt;&lt;/math&gt;
+
+    &lt;math&gt;&lt;mi id=&quot;mi2&quot;&gt;sin&lt;/mi&gt;&lt;/math&gt;
+
+    &lt;math&gt;&lt;mi&gt;x&lt;span id=&quot;span1&quot;&gt;&lt;/span&gt;&lt;/mi&gt;&lt;/math&gt;
+
+    &lt;math&gt;&lt;mi&gt;sin&lt;span id=&quot;span2&quot;&gt;&lt;/span&gt;&lt;/mi&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmiexpectedmismatchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mi-expected-mismatch.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mi-expected-mismatch.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mi-expected-mismatch.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mi&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;math&gt;&lt;mi&gt;&lt;/mi&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmihtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mi.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mi.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mi.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mi&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;!-- The HTML-in-MathML span should be visible. --&gt;
+
+    &lt;math&gt;&lt;mi&gt;&lt;span&gt;HTML-in-MathML&lt;/span&gt;&lt;/mi&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmnexpectedmismatchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mn-expected-mismatch.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mn-expected-mismatch.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mn-expected-mismatch.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mn&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;math&gt;&lt;mn&gt;&lt;/mn&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmnhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mn.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mn.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mn.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mn&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;!-- The HTML-in-MathML span should be visible. --&gt;
+
+    &lt;math&gt;&lt;mn&gt;&lt;span&gt;HTML-in-MathML&lt;/span&gt;&lt;/mn&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmtextexpectedmismatchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mtext-expected-mismatch.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mtext-expected-mismatch.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mtext-expected-mismatch.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mtext&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;math&gt;&lt;mtext&gt;&lt;/mtext&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmtextrejectedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected-expected.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected-expected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected-expected.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mtext&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    _&lt;math&gt;&lt;mtext&gt;&lt;/mtext&gt;&lt;/math&gt;_
+
+    _&lt;math&gt;&lt;mtext&gt;&lt;/mtext&gt;&lt;/math&gt;_
+
+    _&lt;math&gt;&lt;mtext&gt;&lt;/mtext&gt;&lt;/math&gt;_
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmtextrejectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mtext-rejected.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mtext&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;!-- These HTML-in-MathML elements are not phrasing content and should be rejected. --&gt;
+
+    _&lt;math&gt;&lt;mtext&gt;&lt;p&gt;HTML-in-MathML&lt;/p&gt;&lt;/mtext&gt;&lt;/math&gt;_
+
+    _&lt;math&gt;&lt;mtext&gt;&lt;div&gt;HTML-in-MathML&lt;/div&gt;&lt;/mtext&gt;&lt;/math&gt;_
+
+    _&lt;math&gt;&lt;mtext&gt;&lt;blockquote&gt;HTML-in-MathML&lt;/blockquote&gt;&lt;/mtext&gt;&lt;/math&gt;_
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationforeignmtexthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/foreign-mtext.html (0 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/foreign-mtext.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/foreign-mtext.html        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;Foreign content in mtext&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;!-- The HTML-in-MathML span should be visible. --&gt;
+
+    &lt;math&gt;&lt;mtext&gt;&lt;span&gt;HTML-in-MathML&lt;/span&gt;&lt;/mtext&gt;&lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -1705,8 +1705,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/124658 fast/text/break-word-pre-wrap.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><del>-webkit.org/b/124662 mathml/presentation/mspace-units.html [ ImageOnlyFailure ]
-
</del><span class="cx"> webkit.org/b/124663 media/track/track-legacyapi-with-automatic-mode.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/124890 platform/efl/accessibility/media-emits-object-replacement.html [ Failure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -1313,8 +1313,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/124360 media/video-canvas-drawing-output.html [ Failure ]
</span><span class="cx"> 
</span><del>-webkit.org/b/124503 mathml/presentation/mspace-units.html [ ImageOnlyFailure ]
-
</del><span class="cx"> webkit.org/b/124504 fast/text/break-word-pre-wrap.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/124507 fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink.html [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/Source/WebCore/ChangeLog        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-03-16  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        [regression] foreign content not displayed in MathML
+        &lt;https://webkit.org/b/124128&gt;
+
+        Reviewed by Chris Fleizach.
+
+        This restores foreign content in &lt;mtext&gt;, &lt;mn&gt; and &lt;mi&gt; elements, but only when it is &quot;phrasing content&quot; as defined per the HTML5 specification. Other token elements are not handled here. This change makes mspace-units.html work again on Linux.
+
+        Tests: mathml/presentation/foreign-mi-dynamic.html
+               mathml/presentation/foreign-mi.html
+               mathml/presentation/foreign-mn.html
+               mathml/presentation/foreign-mtext-rejected.html
+               mathml/presentation/foreign-mtext.html
+
+        * mathml/MathMLTextElement.cpp:
+        (WebCore::MathMLTextElement::createElementRenderer): create a RenderMathMLToken for mn, ms and mtext.
+        (WebCore::isPhrasingContent): helper function to check phrasing content, as defined by the HTML spec.
+        (WebCore::MathMLTextElement::childShouldCreateRenderer): &lt;mi&gt;, &lt;mn&gt;, &lt;mtext&gt; and, &lt;ms&gt; now accepts phrasing content.
+        * rendering/mathml/RenderMathMLToken.cpp:
+        (WebCore::RenderMathMLToken::RenderMathMLToken):
+        (WebCore::RenderMathMLToken::updateTokenContent): initialize the m_containsElement boolean when updating the token content.
+        (WebCore::RenderMathMLToken::updateStyle): move &lt;mi&gt; specific handling in its own section and only apply the single-char rule when it does not contain elements.
+        * rendering/mathml/RenderMathMLToken.h: add an m_containsElement boolean to handle token element specifically.
+
</ins><span class="cx"> 2014-03-16  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         PlatformTimeRanges::nearest() truncates closestDelta values from double to float
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLTextElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -30,10 +30,14 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MathMLTextElement.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;HTMLElement.h&quot;
+#include &quot;HTMLNames.h&quot;
</ins><span class="cx"> #include &quot;MathMLNames.h&quot;
</span><span class="cx"> #include &quot;RenderMathMLOperator.h&quot;
</span><span class="cx"> #include &quot;RenderMathMLSpace.h&quot;
</span><span class="cx"> #include &quot;RenderMathMLToken.h&quot;
</span><ins>+#include &quot;SVGElement.h&quot;
+#include &quot;SVGNames.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx">     
</span><span class="lines">@@ -68,17 +72,100 @@
</span><span class="cx"> {
</span><span class="cx">     if (hasTagName(MathMLNames::moTag))
</span><span class="cx">         return createRenderer&lt;RenderMathMLOperator&gt;(*this, std::move(style));
</span><del>-    if (hasTagName(MathMLNames::miTag))
-        return createRenderer&lt;RenderMathMLToken&gt;(*this, std::move(style));
</del><span class="cx">     if (hasTagName(MathMLNames::mspaceTag))
</span><span class="cx">         return createRenderer&lt;RenderMathMLSpace&gt;(*this, std::move(style));
</span><span class="cx"> 
</span><del>-    return MathMLElement::createElementRenderer(std::move(style));
</del><ins>+    ASSERT(hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag));
+
+    return createRenderer&lt;RenderMathMLToken&gt;(*this, std::move(style));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool isPhrasingContent(const Node&amp; node)
+{
+    // Phrasing content is described in the HTML 5 specification:
+    // http://www.w3.org/TR/html5/dom.html#phrasing-content.
+
+    if (!node.isElementNode())
+        return node.isTextNode();
+
+    auto&amp; element = toElement(node);
+
+    if (element.isMathMLElement()) {
+        auto&amp; mathmlElement = toMathMLElement(element);
+        return mathmlElement.hasTagName(MathMLNames::mathTag);
+    }
+
+    if (element.isSVGElement()) {
+        auto&amp; svgElement = toSVGElement(element);
+        return svgElement.hasTagName(SVGNames::svgTag);
+    }
+
+    if (element.isHTMLElement()) {
+        // FIXME: add the &lt;data&gt; and &lt;time&gt; tags when they are implemented.
+        auto&amp; htmlElement = toHTMLElement(element);
+        return htmlElement.hasTagName(HTMLNames::aTag)
+            || htmlElement.hasTagName(HTMLNames::abbrTag)
+            || htmlElement.hasTagName(HTMLNames::areaTag)
+            || htmlElement.hasTagName(HTMLNames::audioTag)
+            || htmlElement.hasTagName(HTMLNames::bTag)
+            || htmlElement.hasTagName(HTMLNames::bdiTag)
+            || htmlElement.hasTagName(HTMLNames::bdoTag)
+            || htmlElement.hasTagName(HTMLNames::brTag)
+            || htmlElement.hasTagName(HTMLNames::buttonTag)
+            || htmlElement.hasTagName(HTMLNames::canvasTag)
+            || htmlElement.hasTagName(HTMLNames::citeTag)
+            || htmlElement.hasTagName(HTMLNames::codeTag)
+            || htmlElement.hasTagName(HTMLNames::datalistTag)
+            || htmlElement.hasTagName(HTMLNames::delTag)
+            || htmlElement.hasTagName(HTMLNames::dfnTag)
+            || htmlElement.hasTagName(HTMLNames::emTag)
+            || htmlElement.hasTagName(HTMLNames::embedTag)
+            || htmlElement.hasTagName(HTMLNames::iTag)
+            || htmlElement.hasTagName(HTMLNames::iframeTag)
+            || htmlElement.hasTagName(HTMLNames::imgTag)
+            || htmlElement.hasTagName(HTMLNames::inputTag)
+            || htmlElement.hasTagName(HTMLNames::insTag)
+            || htmlElement.hasTagName(HTMLNames::kbdTag)
+            || htmlElement.hasTagName(HTMLNames::keygenTag)
+            || htmlElement.hasTagName(HTMLNames::labelTag)
+            || htmlElement.hasTagName(HTMLNames::mapTag)
+            || htmlElement.hasTagName(HTMLNames::markTag)
+            || htmlElement.hasTagName(HTMLNames::meterTag)
+            || htmlElement.hasTagName(HTMLNames::noscriptTag)
+            || htmlElement.hasTagName(HTMLNames::objectTag)
+            || htmlElement.hasTagName(HTMLNames::outputTag)
+            || htmlElement.hasTagName(HTMLNames::progressTag)
+            || htmlElement.hasTagName(HTMLNames::qTag)
+            || htmlElement.hasTagName(HTMLNames::rubyTag)
+            || htmlElement.hasTagName(HTMLNames::sTag)
+            || htmlElement.hasTagName(HTMLNames::sampTag)
+            || htmlElement.hasTagName(HTMLNames::scriptTag)
+            || htmlElement.hasTagName(HTMLNames::selectTag)
+            || htmlElement.hasTagName(HTMLNames::smallTag)
+            || htmlElement.hasTagName(HTMLNames::spanTag)
+            || htmlElement.hasTagName(HTMLNames::strongTag)
+            || htmlElement.hasTagName(HTMLNames::subTag)
+            || htmlElement.hasTagName(HTMLNames::supTag)
+            || htmlElement.hasTagName(HTMLNames::templateTag)
+            || htmlElement.hasTagName(HTMLNames::textareaTag)
+            || htmlElement.hasTagName(HTMLNames::uTag)
+            || htmlElement.hasTagName(HTMLNames::varTag)
+            || htmlElement.hasTagName(HTMLNames::videoTag)
+            || htmlElement.hasTagName(HTMLNames::wbrTag);
+    }
+
+    return false;
+}
+
</ins><span class="cx"> bool MathMLTextElement::childShouldCreateRenderer(const Node&amp; child) const
</span><span class="cx"> {
</span><del>-    return !hasTagName(mspaceTag) &amp;&amp; child.isTextNode();
</del><ins>+    // The HTML specification defines &lt;mi&gt;, &lt;mo&gt;, &lt;mn&gt;, &lt;ms&gt; and &lt;mtext&gt; as insertion points.
+
+    // FIXME: phrasing content should be accepted in &lt;mo&gt; elements too (https://bugs.webkit.org/show_bug.cgi?id=130245).
+    if (hasTagName(moTag))
+        return child.isTextNode();
+
+    return !hasTagName(MathMLNames::mspaceTag) &amp;&amp; isPhrasingContent(child);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLTokencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> #if ENABLE(MATHML)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;MathMLNames.h&quot;
</span><ins>+#include &quot;RenderElement.h&quot;
+#include &quot;RenderIterator.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -36,11 +38,13 @@
</span><span class="cx"> 
</span><span class="cx"> RenderMathMLToken::RenderMathMLToken(Element&amp; element, PassRef&lt;RenderStyle&gt; style)
</span><span class="cx">     : RenderMathMLBlock(element, std::move(style))
</span><ins>+    , m_containsElement(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderMathMLToken::RenderMathMLToken(Document&amp; document, PassRef&lt;RenderStyle&gt; style)
</span><span class="cx">     : RenderMathMLBlock(document, std::move(style))
</span><ins>+    , m_containsElement(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -60,8 +64,16 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderMathMLToken::updateTokenContent()
</span><span class="cx"> {
</span><del>-    if (!isEmpty())
</del><ins>+    m_containsElement = false;
+    if (!isEmpty()) {
+        // The renderers corresponding to the children of the token element are wrapped inside an anonymous RenderMathMLBlock.
+        // When one of these renderers is a RenderElement, we handle the RenderMathMLToken differently.
+        // For some reason, an additional anonymous RenderBlock is created as a child of the RenderMathMLToken and the renderers are actually inserted into that RenderBlock so we need to dig down one additional level here.
+        const auto&amp; wrapper = toRenderElement(firstChild());
+        if (const auto&amp; block = toRenderElement(wrapper-&gt;firstChild()))
+            m_containsElement = childrenOfType&lt;RenderElement&gt;(*block).first();
</ins><span class="cx">         updateStyle();
</span><ins>+    }
</ins><span class="cx">     setNeedsLayoutAndPrefWidthsRecalc();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -69,16 +81,20 @@
</span><span class="cx"> {
</span><span class="cx">     const auto&amp; tokenElement = element();
</span><span class="cx"> 
</span><del>-    // This tries to emulate the default mathvariant value on &lt;mi&gt; using the CSS font-style property.
-    // FIXME: This should be revised when mathvariant is implemented (http://wkbug/85735) and when fonts with Mathematical Alphanumeric Symbols characters are more popular.
</del><span class="cx">     const auto&amp; wrapper = toRenderElement(firstChild());
</span><span class="cx">     auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&amp;style(), FLEX);
</span><del>-    FontDescription fontDescription(newStyle.get().fontDescription());
-    FontSelector* fontSelector = newStyle.get().font().fontSelector();
-    if (element().textContent().stripWhiteSpace().simplifyWhiteSpace().length() == 1 &amp;&amp; !tokenElement.hasAttribute(mathvariantAttr))
-        fontDescription.setItalic(true);
-    if (newStyle.get().setFontDescription(fontDescription))
-        newStyle.get().font().update(fontSelector);
</del><ins>+
+    if (tokenElement.hasTagName(MathMLNames::miTag)) {
+        // This tries to emulate the default mathvariant value on &lt;mi&gt; using the CSS font-style property.
+        // FIXME: This should be revised when mathvariant is implemented (http://wkbug/85735) and when fonts with Mathematical Alphanumeric Symbols characters are more popular.
+        FontDescription fontDescription(newStyle.get().fontDescription());
+        FontSelector* fontSelector = newStyle.get().font().fontSelector();
+        if (!m_containsElement &amp;&amp; element().textContent().stripWhiteSpace().simplifyWhiteSpace().length() == 1 &amp;&amp; !tokenElement.hasAttribute(mathvariantAttr))
+            fontDescription.setItalic(true);
+        if (newStyle.get().setFontDescription(fontDescription))
+            newStyle.get().font().update(fontSelector);
+    }
+
</ins><span class="cx">     wrapper-&gt;setStyle(std::move(newStyle));
</span><span class="cx">     wrapper-&gt;setNeedsLayoutAndPrefWidthsRecalc();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLTokenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h (165701 => 165702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h        2014-03-16 17:05:15 UTC (rev 165701)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h        2014-03-16 17:33:48 UTC (rev 165702)
</span><span class="lines">@@ -54,6 +54,9 @@
</span><span class="cx">     virtual const char* renderName() const override { return isAnonymous() ? &quot;RenderMathMLToken (anonymous)&quot; : &quot;RenderMathMLToken&quot;; }
</span><span class="cx">     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx">     virtual void updateStyle();
</span><ins>+
+    // This boolean indicates whether the token element contains some RenderElement descendants, other than the anonymous renderers created for layout purpose.
+    bool m_containsElement;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> RENDER_OBJECT_TYPE_CASTS(RenderMathMLToken, isRenderMathMLToken())
</span></span></pre>
</div>
</div>

</body>
</html>