Diff
Modified: trunk/LayoutTests/ChangeLog (163552 => 163553)
--- trunk/LayoutTests/ChangeLog 2014-02-06 19:34:33 UTC (rev 163552)
+++ trunk/LayoutTests/ChangeLog 2014-02-06 20:00:20 UTC (rev 163553)
@@ -1,3 +1,20 @@
+2014-02-06 Frédéric Wang <[email protected]>
+
+ 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:
+
2014-02-06 Alexey Proskuryakov <[email protected]>
Fix a copy/paste mistake in TestExpectations.
Modified: trunk/LayoutTests/mathml/presentation/attributes-mathvariant-expected.html (163552 => 163553)
--- 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)
@@ -15,12 +15,21 @@
implementation relies on CSS style instead. See also bug 108778.
-->
<div>
+ <!-- FIXME: we add new lines to workaround a width/spacing bug. -->
<math>
- <mi style="font-style: normal;">A</mi>
- <mi style="font-style: italic;">A</mi>
+ <mtext style="font-style: normal;">A</mtext>
+ </math><br/>
+ <math>
<mtext style="font-style: italic;">A</mtext>
- <mi style="font-style: normal; font-weight: bold;">A</mi>
- <mi style="font-weight: bold; font-style: italic;">A</mi>
+ </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>
</math>
</div>
Modified: trunk/LayoutTests/mathml/presentation/attributes-mathvariant.html (163552 => 163553)
--- 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)
@@ -11,9 +11,17 @@
<div>
<math>
<mi mathvariant="normal">A</mi>
+ </math><br/>
+ <math>
<mi>A</mi>
+ </math><br/>
+ <math>
<mtext mathvariant="italic">A</mtext>
+ </math><br/>
+ <math>
<mi mathvariant="bold">A</mi>
+ </math><br/>
+ <math>
<mi mathvariant="bold-italic">A</mi>
</math>
</div>
Added: trunk/LayoutTests/mathml/presentation/tokenElements-dynamic-expected.html (0 => 163553)
--- 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)
@@ -0,0 +1,48 @@
+<!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>
Added: trunk/LayoutTests/mathml/presentation/tokenElements-dynamic.html (0 => 163553)
--- 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)
@@ -0,0 +1,100 @@
+<!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>
Modified: trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant-expected.html (163552 => 163553)
--- 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)
@@ -11,11 +11,17 @@
<mo style="font-style: normal; font-weight: normal;">∇</mo>
<mtext style="font-style: normal; font-weight: normal;">text</mtext>
<ms style="font-style: normal; font-weight: normal;">&</ms>
+ <mtext style="font-style: normal; font-weight: normal;">sin</mtext>
</math>
</p>
- <p>Following element should be in italic:
+ <p>Following elements should be in italic:
<math>
- <mi style="font-style: italic;">x</mi>
+ <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;"> 	
x 	
</mtext>
</math>
</p>
</body>
Modified: trunk/LayoutTests/mathml/presentation/tokenElements-mathvariant.html (163552 => 163553)
--- 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)
@@ -11,11 +11,16 @@
<mo>∇</mo>
<mtext>text</mtext>
<ms>&</ms>
+ <mi>sin</mi>
</math>
</p>
- <p>Following element should be in italic:
+ <p>Following elements should be in italic:
+ <!-- FIXME: we add a new line to workaround a width/spacing bug. -->
<math>
<mi>x</mi>
+ </math><br/>
+ <math>
+ <mi> 	
x 	
</mi>
</math>
</p>
</body>
Modified: trunk/Source/WebCore/CMakeLists.txt (163552 => 163553)
--- 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)
@@ -2220,6 +2220,7 @@
rendering/mathml/RenderMathMLScripts.cpp
rendering/mathml/RenderMathMLSpace.cpp
rendering/mathml/RenderMathMLSquareRoot.cpp
+ rendering/mathml/RenderMathMLToken.cpp
rendering/mathml/RenderMathMLUnderOver.cpp
rendering/shapes/BoxShape.cpp
Modified: trunk/Source/WebCore/ChangeLog (163552 => 163553)
--- 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)
@@ -1,3 +1,41 @@
+2014-02-06 Frédéric Wang <[email protected]>
+
+ 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>):
+
2014-02-06 Zoltan Horvath <[email protected]>
[CSS Shapes] Simplify BasicShapeInset creation
Modified: trunk/Source/WebCore/GNUmakefile.list.am (163552 => 163553)
--- 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)
@@ -4531,6 +4531,8 @@
Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h \
Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp \
Source/WebCore/rendering/mathml/RenderMathMLScripts.h \
+ Source/WebCore/rendering/mathml/RenderMathMLToken.cpp \
+ Source/WebCore/rendering/mathml/RenderMathMLToken.h \
Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp \
Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h \
Source/WebCore/rendering/shapes/BoxShape.cpp \
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (163552 => 163553)
--- 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)
@@ -11213,6 +11213,7 @@
<ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp" />
<ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp" />
<ClCompile Include="..\rendering\mathml\RenderMathMLScripts.cpp" />
+ <ClCompile Include="..\rendering\mathml\RenderMathMLToken.cpp" />
<ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp" />
<ClCompile Include="..\rendering\style\BasicShapes.cpp" />
<ClCompile Include="..\rendering\style\ContentData.cpp">
@@ -19904,6 +19905,7 @@
<ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h" />
<ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h" />
<ClInclude Include="..\rendering\mathml\RenderMathMLScripts.h" />
+ <ClInclude Include="..\rendering\mathml\RenderMathMLToken.h" />
<ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h" />
<ClInclude Include="..\rendering\style\BasicShapes.h" />
<ClInclude Include="..\rendering\style\BorderData.h" />
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (163552 => 163553)
--- 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)
@@ -2745,6 +2745,9 @@
<ClCompile Include="..\rendering\mathml\RenderMathMLScripts.cpp">
<Filter>rendering\mathml</Filter>
</ClCompile>
+ <ClCompile Include="..\rendering\mathml\RenderMathMLToken.cpp">
+ <Filter>rendering\mathml</Filter>
+ </ClCompile>
<ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp">
<Filter>rendering\mathml</Filter>
</ClCompile>
@@ -9590,6 +9593,9 @@
<ClInclude Include="..\rendering\mathml\RenderMathMLScripts.h">
<Filter>rendering\mathml</Filter>
</ClInclude>
+ <ClInclude Include="..\rendering\mathml\RenderMathMLToken.h">
+ <Filter>rendering\mathml</Filter>
+ </ClInclude>
<ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h">
<Filter>rendering\mathml</Filter>
</ClInclude>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163552 => 163553)
--- 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)
@@ -1456,6 +1456,8 @@
439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */; };
439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */; };
439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */; };
+ 439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */; };
+ 439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */; };
439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
439D334313A6911C00C20F4F /* SVGAnimatedType.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334013A6911C00C20F4F /* SVGAnimatedType.h */; };
@@ -8321,6 +8323,8 @@
439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSquareRoot.h; path = mathml/RenderMathMLSquareRoot.h; sourceTree = "<group>"; };
439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLScripts.cpp; path = mathml/RenderMathMLScripts.cpp; sourceTree = "<group>"; };
439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLScripts.h; path = mathml/RenderMathMLScripts.h; sourceTree = "<group>"; };
+ 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>"; };
439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = "<group>"; };
439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = "<group>"; };
439D334013A6911C00C20F4F /* SVGAnimatedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedType.h; sourceTree = "<group>"; };
@@ -15257,6 +15261,8 @@
439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */,
439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */,
439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */,
+ 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */,
+ 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */,
439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */,
439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */,
);
@@ -24978,6 +24984,7 @@
439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */,
0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */,
439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */,
+ 439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */,
439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */,
E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */,
DEBCCDD216646E8200A452E1 /* RenderMediaControlElements.h in Headers */,
@@ -28327,6 +28334,7 @@
5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */,
439046E512DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp in Sources */,
439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */,
+ 439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */,
439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */,
E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */,
DE49B309165F2FE10010338D /* RenderMediaControlElements.cpp in Sources */,
Modified: trunk/Source/WebCore/css/mathml.css (163552 => 163553)
--- 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)
@@ -42,7 +42,7 @@
-webkit-margin-after: 1em;
}
-mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose {
+mi, mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot, merror, mphantom, mstyle, menclose {
display: -webkit-inline-flex !important;
}
@@ -96,7 +96,6 @@
}
mi {
- font-style: italic;
-webkit-padding-end: 0.1em;
}
msub > mi:first-child, msubsup > mi:first-child {
Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (163552 => 163553)
--- 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)
@@ -33,6 +33,7 @@
#include "MathMLNames.h"
#include "RenderMathMLOperator.h"
#include "RenderMathMLSpace.h"
+#include "RenderMathMLToken.h"
namespace WebCore {
@@ -52,21 +53,31 @@
void MathMLTextElement::didAttachRenderers()
{
MathMLElement::didAttachRenderers();
- if (renderer())
- renderer()->updateFromElement();
+ if (renderer()) {
+ if (renderer()->isRenderMathMLToken())
+ toRenderMathMLToken(renderer())->updateTokenContent();
+ else
+ renderer()->updateFromElement();
+ }
}
void MathMLTextElement::childrenChanged(const ChildChange& change)
{
MathMLElement::childrenChanged(change);
- if (renderer())
- renderer()->updateFromElement();
+ if (renderer()) {
+ if (renderer()->isRenderMathMLToken())
+ toRenderMathMLToken(renderer())->updateTokenContent();
+ else
+ renderer()->updateFromElement();
+ }
}
RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(PassRef<RenderStyle> style)
{
if (hasLocalName(MathMLNames::moTag))
return createRenderer<RenderMathMLOperator>(*this, std::move(style));
+ if (hasLocalName(MathMLNames::miTag))
+ return createRenderer<RenderMathMLToken>(*this, std::move(style));
if (hasLocalName(MathMLNames::mspaceTag))
return createRenderer<RenderMathMLSpace>(*this, std::move(style));
Modified: trunk/Source/WebCore/rendering/RenderObject.h (163552 => 163553)
--- 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)
@@ -414,6 +414,7 @@
virtual bool isRenderMathMLSquareRoot() const { return false; }
virtual bool isRenderMathMLScripts() const { return false; }
virtual bool isRenderMathMLScriptsWrapper() const { return false; }
+ virtual bool isRenderMathMLToken() const { return false; }
virtual bool isRenderMathMLUnderOver() const { return false; }
#endif // ENABLE(MATHML)
Added: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp (0 => 163553)
--- 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)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2014 Frédéric Wang ([email protected]). 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)
Added: trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h (0 => 163553)
--- 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)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 Frédéric Wang ([email protected]). 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