<!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>[163553] 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/163553">163553</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-06 12:00:20 -0800 (Thu, 06 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Do not draw multi-characters <mi> in italic.
https://bugs.webkit.org/show_bug.cgi?id=44208
Patch by Frédéric Wang <fred.wang@free.fr> on 2014-02-06
Reviewed by Chris Fleizach.
Source/WebCore:
This test prevents multi-char <mi> to be drawn in italic and prepare
further improvements to MathML token and mfenced elements (bugs 124838
and bug 99620).
Test: mathml/presentation/tokenElements-dynamic.html
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* css/mathml.css:
(mi, mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose):
* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::didAttachRenderers):
(WebCore::MathMLTextElement::childrenChanged):
(WebCore::MathMLTextElement::createElementRenderer):
* rendering/RenderObject.h:
(WebCore::RenderObject::isRenderMathMLToken):
* rendering/mathml/RenderMathMLToken.cpp: Added.
(WebCore::RenderMathMLToken::RenderMathMLToken):
(WebCore::RenderMathMLToken::addChild):
(WebCore::RenderMathMLToken::createWrapperIfNeeded):
(WebCore::RenderMathMLToken::updateTokenContent):
(WebCore::RenderMathMLToken::updateStyle):
(WebCore::RenderMathMLToken::styleDidChange):
(WebCore::RenderMathMLToken::updateFromElement):
* rendering/mathml/RenderMathMLToken.h: Added.
(WebCore::RenderMathMLToken::element):
(WebCore::RenderMathMLToken>):
LayoutTests:
Add tests for single-char/multi-char <mi> elements, the mathvariant
attribute and MathML token elements dynamically modified.
* mathml/presentation/attributes-mathvariant-expected.html:
* mathml/presentation/attributes-mathvariant.html:
* mathml/presentation/tokenElements-dynamic-expected.html: Added.
* mathml/presentation/tokenElements-dynamic.html: Added.
* mathml/presentation/tokenElements-mathvariant-expected.html:
* mathml/presentation/tokenElements-mathvariant.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationattributesmathvariantexpectedhtml">trunk/LayoutTests/mathml/presentation/attributes-mathvariant-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationattributesmathvarianthtml">trunk/LayoutTests/mathml/presentation/attributes-mathvariant.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationtokenElementsmathvariantexpectedhtml">trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationtokenElementsmathvarianthtml">trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant.html</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecssmathmlcss">trunk/Source/WebCore/css/mathml.css</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLTextElementcpp">trunk/Source/WebCore/mathml/MathMLTextElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjecth">trunk/Source/WebCore/rendering/RenderObject.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlpresentationtokenElementsdynamicexpectedhtml">trunk/LayoutTests/mathml/presentation/tokenElements-dynamic-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationtokenElementsdynamichtml">trunk/LayoutTests/mathml/presentation/tokenElements-dynamic.html</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>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/LayoutTests/ChangeLog        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-02-06 Frédéric Wang <fred.wang@free.fr>
+
+ Do not draw multi-characters <mi> in italic.
+ https://bugs.webkit.org/show_bug.cgi?id=44208
+
+ Reviewed by Chris Fleizach.
+
+ Add tests for single-char/multi-char <mi> elements, the mathvariant
+ attribute and MathML token elements dynamically modified.
+
+ * mathml/presentation/attributes-mathvariant-expected.html:
+ * mathml/presentation/attributes-mathvariant.html:
+ * mathml/presentation/tokenElements-dynamic-expected.html: Added.
+ * mathml/presentation/tokenElements-dynamic.html: Added.
+ * mathml/presentation/tokenElements-mathvariant-expected.html:
+ * mathml/presentation/tokenElements-mathvariant.html:
+
</ins><span class="cx"> 2014-02-06 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix a copy/paste mistake in TestExpectations.
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationattributesmathvariantexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/mathml/presentation/attributes-mathvariant-expected.html (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/attributes-mathvariant-expected.html        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/LayoutTests/mathml/presentation/attributes-mathvariant-expected.html        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -15,12 +15,21 @@
</span><span class="cx"> implementation relies on CSS style instead. See also bug 108778.
</span><span class="cx"> -->
</span><span class="cx"> <div>
</span><ins>+ <!-- FIXME: we add new lines to workaround a width/spacing bug. -->
</ins><span class="cx"> <math>
</span><del>- <mi style="font-style: normal;">A</mi>
- <mi style="font-style: italic;">A</mi>
</del><ins>+ <mtext style="font-style: normal;">A</mtext>
+ </math><br/>
+ <math>
</ins><span class="cx"> <mtext style="font-style: italic;">A</mtext>
</span><del>- <mi style="font-style: normal; font-weight: bold;">A</mi>
- <mi style="font-weight: bold; font-style: italic;">A</mi>
</del><ins>+ </math><br/>
+ <math>
+ <mtext style="font-style: italic;">A</mtext>
+ </math><br/>
+ <math>
+ <mtext style="font-weight: bold;">A</mtext>
+ </math><br/>
+ <math>
+ <mtext style="font-weight: bold; font-style: italic;">A</mtext>
</ins><span class="cx"> </math>
</span><span class="cx"> </div>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationattributesmathvarianthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/mathml/presentation/attributes-mathvariant.html (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/attributes-mathvariant.html        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/LayoutTests/mathml/presentation/attributes-mathvariant.html        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -11,9 +11,17 @@
</span><span class="cx"> <div>
</span><span class="cx"> <math>
</span><span class="cx"> <mi mathvariant="normal">A</mi>
</span><ins>+ </math><br/>
+ <math>
</ins><span class="cx"> <mi>A</mi>
</span><ins>+ </math><br/>
+ <math>
</ins><span class="cx"> <mtext mathvariant="italic">A</mtext>
</span><ins>+ </math><br/>
+ <math>
</ins><span class="cx"> <mi mathvariant="bold">A</mi>
</span><ins>+ </math><br/>
+ <math>
</ins><span class="cx"> <mi mathvariant="bold-italic">A</mi>
</span><span class="cx"> </math>
</span><span class="cx"> </div>
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationtokenElementsdynamicexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/tokenElements-dynamic-expected.html (0 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/tokenElements-dynamic-expected.html         (rev 0)
+++ trunk/LayoutTests/mathml/presentation/tokenElements-dynamic-expected.html        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <title>Token elements - dynamic changes</title>
+ <meta charset="utf-8"/>
+ <style type="text/css">
+ #styled > mo { color: red; }
+ #styled > mi { color: green; }
+ #styled > mi ~ * { color: blue; }
+ </style>
+ </head>
+ <body>
+
+ <!-- Test 1 -->
+ <p style="display: none;">
+ <math><mi>sin</mi><mi>x</mi></math>
+ <math><mi>cos</mi><mi>y</mi></math>
+ <math><mi>tan</mi><mi>z</mi></math>
+ </p>
+
+ <!-- Test 2 -->
+ <p>
+ <math><mn>1</mn><mo>+</mo><mn>2</mn><mo>−</mo><mn>3</mn></math>
+ <math><mo>(</mo><msqrt><mfrac><mn>4</mn><mn>5</mn></mfrac></msqrt><mo>]</mo></math>
+ <math><mo>+</mo><mo>{</mo><mfrac><mfrac><mn>6</mn><mn>7</mn></mfrac><mfrac><mn>8</mn><mn>9</mn></mfrac></mfrac></math>
+ </p>
+
+ <!-- Test 3 -->
+ <p>
+ <math><mi mathvariant="bold">x</mi></math>
+ <math><mi mathvariant="italic">sin</mi></math>
+ <math><mi>x</mi></math>
+ <math><mi>sin</mi></math>
+ </p>
+
+ <!-- Test 4 -->
+ <p>
+ <math><mo stretchy="false">{</mo><mfrac><mfrac><mn>6</mn><mn>7</mn></mfrac><mfrac><mn>8</mn><mn>9</mn></mfrac></mfrac></math>
+ <math><mo>{</mo><mfrac><mfrac><mn>6</mn><mn>7</mn></mfrac><mfrac><mn>8</mn><mn>9</mn></mfrac></mfrac></math>
+ </p>
+
+ <!-- Test 5 -->
+ <p>
+ <math id="styled"><mo>-</mo><mi>sin</mi><mi>x</mi></math>
+ </p>
+
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationtokenElementsdynamichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/tokenElements-dynamic.html (0 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/tokenElements-dynamic.html         (rev 0)
+++ trunk/LayoutTests/mathml/presentation/tokenElements-dynamic.html        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <title>Token elements - dynamic changes</title>
+ <meta charset="utf-8"/>
+ <style type="text/css">
+ #styled > mo { color: red; }
+ #styled > mi { color: green; }
+ #styled > mi ~ * { color: blue; }
+ </style>
+ <script type="text/javascript">
+ function newText(t)
+ {
+ return document.createTextNode(t);
+ }
+
+ function test()
+ {
+ var mi = document.getElementsByTagName("mi");
+ var mo = document.getElementsByTagName("mo");
+
+ // Test 1
+ mi[0].textContent = "sin";
+ mi[1].textContent = "x";
+ mi[2].appendChild(newText("cos"));
+ mi[3].appendChild(newText("y"));
+ mi[4].textContent = "a";
+ mi[4].insertBefore(newText("t"), mi[4].firstChild);
+ mi[4].appendChild(newText("n"));
+ mi[5].appendChild(newText("oo"));
+ mi[5].insertBefore(newText("z"), mi[5].firstChild);
+ mi[5].removeChild(mi[5].lastChild);
+
+ // Test 2
+ mo[0].textContent = "+";
+ mo[1].appendChild(newText("-"));
+ mo[2].textContent = "(";
+ mo[3].appendChild(newText("]"));
+ mo[4].appendChild(newText("-"));
+ mo[4].insertBefore(newText("+"), mo[4].firstChild);
+ mo[4].removeChild(mo[4].lastChild);
+ mo[5].appendChild(newText("|"));
+ mo[5].appendChild(newText("{"));
+ mo[5].removeChild(mo[5].firstChild);
+
+ // Test 3
+ mi[6].setAttribute("mathvariant", "bold");
+ mi[7].setAttribute("mathvariant", "italic");
+ mi[8].removeAttribute("mathvariant");
+ mi[9].removeAttribute("mathvariant");
+
+ // Test 4
+ mo[6].setAttribute("stretchy", "false");
+ mo[7].removeAttribute("stretchy");
+
+ // Test 5
+ document.getElementById("unstyled").setAttribute("id", "styled");
+ }
+ </script>
+ </head>
+ <body onload="test()">
+
+ <!-- These tests perform dynamic changes on mi and mo token elements. They should render the same as the static reference. -->
+
+ <!-- Test 1 -->
+ <!-- FIXME: single-char <mi> should be italic. -->
+ <p style="display: none;">
+ <math><mi></mi><mi></mi></math>
+ <math><mi></mi><mi></mi></math>
+ <math><mi></mi><mi></mi></math>
+ </p>
+
+ <!-- Test 2 -->
+ <p>
+ <math><mn>1</mn><mo></mo><mn>2</mn><mo></mo><mn>3</mn></math>
+ <math><mo></mo><msqrt><mfrac><mn>4</mn><mn>5</mn></mfrac></msqrt><mo></mo></math>
+ <math><mo></mo><mo></mo><mfrac><mfrac><mn>6</mn><mn>7</mn></mfrac><mfrac><mn>8</mn><mn>9</mn></mfrac></mfrac></math>
+ </p>
+
+ <!-- Test 3 -->
+ <p>
+ <math><mi>x</mi></math>
+ <math><mi>sin</mi></math>
+ <math><mi mathvariant="bold">x</mi></math>
+ <math><mi mathvariant="italic">sin</mi></math>
+ </p>
+
+ <!-- Test 4 -->
+ <p>
+ <math><mo>{</mo><mfrac><mfrac><mn>6</mn><mn>7</mn></mfrac><mfrac><mn>8</mn><mn>9</mn></mfrac></mfrac></math>
+ <math><mo stretchy="false">{</mo><mfrac><mfrac><mn>6</mn><mn>7</mn></mfrac><mfrac><mn>8</mn><mn>9</mn></mfrac></mfrac></math>
+ </p>
+
+ <!-- Test 5 -->
+ <p>
+ <math id="unstyled"><mo>-</mo><mi>sin</mi><mi>x</mi></math>
+ </p>
+
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationtokenElementsmathvariantexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant-expected.html (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant-expected.html        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant-expected.html        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -11,11 +11,17 @@
</span><span class="cx"> <mo style="font-style: normal; font-weight: normal;">&#x2207;</mo>
</span><span class="cx"> <mtext style="font-style: normal; font-weight: normal;">text</mtext>
</span><span class="cx"> <ms style="font-style: normal; font-weight: normal;">&amp;</ms>
</span><ins>+ <mtext style="font-style: normal; font-weight: normal;">sin</mtext>
</ins><span class="cx"> </math>
</span><span class="cx"> </p>
</span><del>- <p>Following element should be in italic:
</del><ins>+ <p>Following elements should be in italic:
</ins><span class="cx"> <math>
</span><del>- <mi style="font-style: italic;">x</mi>
</del><ins>+ <mtext style="font-style: italic; font-weight: normal;">x</mtext>
+ </math><br/>
+ <math>
+ <!-- FIXME: the whitespace should be removed in the reference when
+ bug 125628 is fixed. -->
+ <mtext style="font-style: italic; font-weight: normal;">&#x20;&#x9;&#xD;&#xA;x&#x20;&#x9;&#xD;&#xA;</mtext>
</ins><span class="cx"> </math>
</span><span class="cx"> </p>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationtokenElementsmathvarianthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant.html (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant.html        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant.html        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -11,11 +11,16 @@
</span><span class="cx"> <mo>&#x2207;</mo>
</span><span class="cx"> <mtext>text</mtext>
</span><span class="cx"> <ms>&amp;</ms>
</span><ins>+ <mi>sin</mi>
</ins><span class="cx"> </math>
</span><span class="cx"> </p>
</span><del>- <p>Following element should be in italic:
</del><ins>+ <p>Following elements should be in italic:
+ <!-- FIXME: we add a new line to workaround a width/spacing bug. -->
</ins><span class="cx"> <math>
</span><span class="cx"> <mi>x</mi>
</span><ins>+ </math><br/>
+ <math>
+ <mi>&#x20;&#x9;&#xD;&#xA;x&#x20;&#x9;&#xD;&#xA;</mi>
</ins><span class="cx"> </math>
</span><span class="cx"> </p>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -2220,6 +2220,7 @@
</span><span class="cx"> rendering/mathml/RenderMathMLScripts.cpp
</span><span class="cx"> rendering/mathml/RenderMathMLSpace.cpp
</span><span class="cx"> rendering/mathml/RenderMathMLSquareRoot.cpp
</span><ins>+ rendering/mathml/RenderMathMLToken.cpp
</ins><span class="cx"> rendering/mathml/RenderMathMLUnderOver.cpp
</span><span class="cx">
</span><span class="cx"> rendering/shapes/BoxShape.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/ChangeLog        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-02-06 Frédéric Wang <fred.wang@free.fr>
+
+ Do not draw multi-characters <mi> in italic.
+ https://bugs.webkit.org/show_bug.cgi?id=44208
+
+ Reviewed by Chris Fleizach.
+
+ This test prevents multi-char <mi> to be drawn in italic and prepare
+ further improvements to MathML token and mfenced elements (bugs 124838
+ and bug 99620).
+
+ Test: mathml/presentation/tokenElements-dynamic.html
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/mathml.css:
+ (mi, mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose):
+ * mathml/MathMLTextElement.cpp:
+ (WebCore::MathMLTextElement::didAttachRenderers):
+ (WebCore::MathMLTextElement::childrenChanged):
+ (WebCore::MathMLTextElement::createElementRenderer):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isRenderMathMLToken):
+ * rendering/mathml/RenderMathMLToken.cpp: Added.
+ (WebCore::RenderMathMLToken::RenderMathMLToken):
+ (WebCore::RenderMathMLToken::addChild):
+ (WebCore::RenderMathMLToken::createWrapperIfNeeded):
+ (WebCore::RenderMathMLToken::updateTokenContent):
+ (WebCore::RenderMathMLToken::updateStyle):
+ (WebCore::RenderMathMLToken::styleDidChange):
+ (WebCore::RenderMathMLToken::updateFromElement):
+ * rendering/mathml/RenderMathMLToken.h: Added.
+ (WebCore::RenderMathMLToken::element):
+ (WebCore::RenderMathMLToken>):
+
</ins><span class="cx"> 2014-02-06 Zoltan Horvath <zoltan@webkit.org>
</span><span class="cx">
</span><span class="cx"> [CSS Shapes] Simplify BasicShapeInset creation
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -4531,6 +4531,8 @@
</span><span class="cx">         Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h \
</span><span class="cx">         Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp \
</span><span class="cx">         Source/WebCore/rendering/mathml/RenderMathMLScripts.h \
</span><ins>+        Source/WebCore/rendering/mathml/RenderMathMLToken.cpp \
+        Source/WebCore/rendering/mathml/RenderMathMLToken.h \
</ins><span class="cx">         Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp \
</span><span class="cx">         Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h \
</span><span class="cx">         Source/WebCore/rendering/shapes/BoxShape.cpp \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -11213,6 +11213,7 @@
</span><span class="cx"> <ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\mathml\RenderMathMLScripts.cpp" />
</span><ins>+ <ClCompile Include="..\rendering\mathml\RenderMathMLToken.cpp" />
</ins><span class="cx"> <ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\style\BasicShapes.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\style\ContentData.cpp">
</span><span class="lines">@@ -19904,6 +19905,7 @@
</span><span class="cx"> <ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h" />
</span><span class="cx"> <ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h" />
</span><span class="cx"> <ClInclude Include="..\rendering\mathml\RenderMathMLScripts.h" />
</span><ins>+ <ClInclude Include="..\rendering\mathml\RenderMathMLToken.h" />
</ins><span class="cx"> <ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h" />
</span><span class="cx"> <ClInclude Include="..\rendering\style\BasicShapes.h" />
</span><span class="cx"> <ClInclude Include="..\rendering\style\BorderData.h" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -2745,6 +2745,9 @@
</span><span class="cx"> <ClCompile Include="..\rendering\mathml\RenderMathMLScripts.cpp">
</span><span class="cx"> <Filter>rendering\mathml</Filter>
</span><span class="cx"> </ClCompile>
</span><ins>+ <ClCompile Include="..\rendering\mathml\RenderMathMLToken.cpp">
+ <Filter>rendering\mathml</Filter>
+ </ClCompile>
</ins><span class="cx"> <ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp">
</span><span class="cx"> <Filter>rendering\mathml</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -9590,6 +9593,9 @@
</span><span class="cx"> <ClInclude Include="..\rendering\mathml\RenderMathMLScripts.h">
</span><span class="cx"> <Filter>rendering\mathml</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\rendering\mathml\RenderMathMLToken.h">
+ <Filter>rendering\mathml</Filter>
+ </ClInclude>
</ins><span class="cx"> <ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h">
</span><span class="cx"> <Filter>rendering\mathml</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -1456,6 +1456,8 @@
</span><span class="cx">                 439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */; };
</span><span class="cx">                 439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */; };
</span><span class="cx">                 439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */; };
</span><ins>+                439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */; };
+                439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */; };
</ins><span class="cx">                 439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
</span><span class="cx">                 439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
</span><span class="cx">                 439D334313A6911C00C20F4F /* SVGAnimatedType.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334013A6911C00C20F4F /* SVGAnimatedType.h */; };
</span><span class="lines">@@ -8321,6 +8323,8 @@
</span><span class="cx">                 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSquareRoot.h; path = mathml/RenderMathMLSquareRoot.h; sourceTree = "<group>"; };
</span><span class="cx">                 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLScripts.cpp; path = mathml/RenderMathMLScripts.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLScripts.h; path = mathml/RenderMathMLScripts.h; sourceTree = "<group>"; };
</span><ins>+                439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLToken.cpp; path = mathml/RenderMathMLToken.cpp; sourceTree = "<group>"; };
+                439046D812DA25E800AF80A9 /* RenderMathMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLToken.h; path = mathml/RenderMathMLToken.h; sourceTree = "<group>"; };
</ins><span class="cx">                 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = "<group>"; };
</span><span class="cx">                 439D334013A6911C00C20F4F /* SVGAnimatedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedType.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -15257,6 +15261,8 @@
</span><span class="cx">                                 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */,
</span><span class="cx">                                 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */,
</span><span class="cx">                                 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */,
</span><ins>+                                439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */,
+                                439046D812DA25E800AF80A9 /* RenderMathMLToken.h */,
</ins><span class="cx">                                 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */,
</span><span class="cx">                                 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -24978,6 +24984,7 @@
</span><span class="cx">                                 439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */,
</span><span class="cx">                                 0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */,
</span><span class="cx">                                 439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */,
</span><ins>+                                439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */,
</ins><span class="cx">                                 439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */,
</span><span class="cx">                                 E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */,
</span><span class="cx">                                 DEBCCDD216646E8200A452E1 /* RenderMediaControlElements.h in Headers */,
</span><span class="lines">@@ -28327,6 +28334,7 @@
</span><span class="cx">                                 5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */,
</span><span class="cx">                                 439046E512DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp in Sources */,
</span><span class="cx">                                 439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */,
</span><ins>+                                439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */,
</ins><span class="cx">                                 439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */,
</span><span class="cx">                                 E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */,
</span><span class="cx">                                 DE49B309165F2FE10010338D /* RenderMediaControlElements.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssmathmlcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/mathml.css (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/mathml.css        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/css/mathml.css        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> -webkit-margin-after: 1em;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose {
</del><ins>+mi, mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose {
</ins><span class="cx"> display: -webkit-inline-flex !important;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -96,7 +96,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> mi {
</span><del>- font-style: italic;
</del><span class="cx"> -webkit-padding-end: 0.1em;
</span><span class="cx"> }
</span><span class="cx"> msub > mi:first-child, msubsup > mi:first-child {
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLTextElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "MathMLNames.h"
</span><span class="cx"> #include "RenderMathMLOperator.h"
</span><span class="cx"> #include "RenderMathMLSpace.h"
</span><ins>+#include "RenderMathMLToken.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -52,21 +53,31 @@
</span><span class="cx"> void MathMLTextElement::didAttachRenderers()
</span><span class="cx"> {
</span><span class="cx"> MathMLElement::didAttachRenderers();
</span><del>- if (renderer())
- renderer()->updateFromElement();
</del><ins>+ if (renderer()) {
+ if (renderer()->isRenderMathMLToken())
+ toRenderMathMLToken(renderer())->updateTokenContent();
+ else
+ renderer()->updateFromElement();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MathMLTextElement::childrenChanged(const ChildChange& change)
</span><span class="cx"> {
</span><span class="cx"> MathMLElement::childrenChanged(change);
</span><del>- if (renderer())
- renderer()->updateFromElement();
</del><ins>+ if (renderer()) {
+ if (renderer()->isRenderMathMLToken())
+ toRenderMathMLToken(renderer())->updateTokenContent();
+ else
+ renderer()->updateFromElement();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(PassRef<RenderStyle> style)
</span><span class="cx"> {
</span><span class="cx"> if (hasLocalName(MathMLNames::moTag))
</span><span class="cx"> return createRenderer<RenderMathMLOperator>(*this, std::move(style));
</span><ins>+ if (hasLocalName(MathMLNames::miTag))
+ return createRenderer<RenderMathMLToken>(*this, std::move(style));
</ins><span class="cx"> if (hasLocalName(MathMLNames::mspaceTag))
</span><span class="cx"> return createRenderer<RenderMathMLSpace>(*this, std::move(style));
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.h (163552 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.h        2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/Source/WebCore/rendering/RenderObject.h        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -414,6 +414,7 @@
</span><span class="cx"> virtual bool isRenderMathMLSquareRoot() const { return false; }
</span><span class="cx"> virtual bool isRenderMathMLScripts() const { return false; }
</span><span class="cx"> virtual bool isRenderMathMLScriptsWrapper() const { return false; }
</span><ins>+ virtual bool isRenderMathMLToken() const { return false; }
</ins><span class="cx"> virtual bool isRenderMathMLUnderOver() const { return false; }
</span><span class="cx"> #endif // ENABLE(MATHML)
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLTokencpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp (0 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp         (rev 0)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+/*
+ * Copyright (C) 2014 Frédéric Wang (fred.wang@free.fr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RenderMathMLToken.h"
+
+#if ENABLE(MATHML)
+
+#include "MathMLNames.h"
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+RenderMathMLToken::RenderMathMLToken(Element& element, PassRef<RenderStyle> style)
+ : RenderMathMLBlock(element, std::move(style))
+{
+}
+
+RenderMathMLToken::RenderMathMLToken(Document& document, PassRef<RenderStyle> style)
+ : RenderMathMLBlock(document, std::move(style))
+{
+}
+
+void RenderMathMLToken::addChild(RenderObject* newChild, RenderObject* beforeChild)
+{
+ createWrapperIfNeeded();
+ toRenderElement(firstChild())->addChild(newChild, beforeChild);
+}
+
+void RenderMathMLToken::createWrapperIfNeeded()
+{
+ if (!firstChild()) {
+ RenderPtr<RenderMathMLBlock> wrapper = createAnonymousMathMLBlock();
+ // This container doesn't offer any useful information to accessibility.
+ wrapper->setIgnoreInAccessibilityTree(true);
+ RenderMathMLBlock::addChild(wrapper.leakPtr());
+ }
+}
+
+void RenderMathMLToken::updateTokenContent()
+{
+ if (!isEmpty())
+ updateStyle();
+ setNeedsLayoutAndPrefWidthsRecalc();
+}
+
+void RenderMathMLToken::updateStyle()
+{
+ const auto& tokenElement = element();
+
+ // This tries to emulate the default mathvariant value on <mi> 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.
+ const auto& wrapper = toRenderElement(firstChild());
+ auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
+ FontDescription fontDescription(newStyle.get().fontDescription());
+ FontSelector* fontSelector = newStyle.get().font().fontSelector();
+ if (element().textContent().stripWhiteSpace().simplifyWhiteSpace().length() == 1 && !tokenElement.hasAttribute(mathvariantAttr))
+ fontDescription.setItalic(true);
+ if (newStyle.get().setFontDescription(fontDescription))
+ newStyle.get().font().update(fontSelector);
+ wrapper->setStyle(std::move(newStyle));
+ wrapper->setNeedsLayoutAndPrefWidthsRecalc();
+}
+
+void RenderMathMLToken::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+ RenderMathMLBlock::styleDidChange(diff, oldStyle);
+ if (!isEmpty())
+ updateStyle();
+}
+
+void RenderMathMLToken::updateFromElement()
+{
+ RenderMathMLBlock::updateFromElement();
+ if (!isEmpty())
+ updateStyle();
+}
+
+}
+
+#endif // ENABLE(MATHML)
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingmathmlRenderMathMLTokenh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h (0 => 163553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h         (rev 0)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h        2014-02-06 20:00:20 UTC (rev 163553)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2014 Frédéric Wang (fred.wang@free.fr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RenderMathMLToken_h
+#define RenderMathMLToken_h
+
+#if ENABLE(MATHML)
+
+#include "MathMLTextElement.h"
+#include "RenderMathMLBlock.h"
+#include "RenderText.h"
+
+namespace WebCore {
+
+class RenderMathMLToken : public RenderMathMLBlock {
+public:
+ RenderMathMLToken(Element&, PassRef<RenderStyle>);
+ RenderMathMLToken(Document&, PassRef<RenderStyle>);
+
+ MathMLTextElement& element() { return static_cast<MathMLTextElement&>(nodeForNonAnonymous()); }
+
+ virtual bool isRenderMathMLToken() const override final { return true; }
+ virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const override { return true; };
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild) override;
+ virtual void updateTokenContent();
+
+protected:
+ void createWrapperIfNeeded();
+
+private:
+ virtual const char* renderName() const override { return isAnonymous() ? "RenderMathMLToken (anonymous)" : "RenderMathMLToken"; }
+ void updateFromElement() override;
+ virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
+ virtual void updateStyle();
+};
+
+template<> inline bool isRendererOfType<const RenderMathMLToken>(const RenderObject& renderer) { return renderer.isRenderMathMLToken(); }
+RENDER_OBJECT_TYPE_CASTS(RenderMathMLToken, isRenderMathMLToken())
+
+}
+
+#endif // ENABLE(MATHML)
+#endif // RenderMathMLToken_h
</ins></span></pre>
</div>
</div>
</body>
</html>