Title: [152235] trunk
Revision
152235
Author
[email protected]
Date
2013-07-01 11:41:43 -0700 (Mon, 01 Jul 2013)

Log Message

Add Support for mspace element
https://bugs.webkit.org/show_bug.cgi?id=115610

Patch by Frédéric Wang <[email protected]> on 2013-07-01
Reviewed by Chris Fleizach.

Source/WebCore:

This patch adds basic support for the MathML mspace element. This is
important to let people control spacing of mathematical formulas.
Attributes width, height and depth are implemented. For the moment,
only nonnegative width are accepted.

* CMakeLists.txt: add references to the RenderMathMLSpace files.
* GNUmakefile.list.am: ditto.
* Target.pri: ditto.
* WebCore.vcxproj/WebCore.vcxproj: ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
* WebCore.xcodeproj/project.pbxproj: ditto.
* css/mathml.css:
(mtable[columnlines="dashed"] > mtr > mtd + mtd): remove the obsolete linebreaking rule.
* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::createRenderer): map mspaceTag to RenderMathMLSpace.
* mathml/mathattrs.in: add width, height and depth attributes
* mathml/mathtags.in: add mspace element
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::parseMathMLLength): fix int to float conversion.
* rendering/mathml/RenderMathMLBlock.h: declare isRenderMathMLSpace.
(WebCore::RenderMathMLBlock::isRenderMathMLSpace):
* rendering/mathml/RenderMathMLSpace.cpp: Added.
(WebCore::RenderMathMLSpace::RenderMathMLSpace):
(WebCore::RenderMathMLSpace::isChildAllowed):
(WebCore::RenderMathMLSpace::computePreferredLogicalWidths):
(WebCore::RenderMathMLSpace::updateFromElement):
(WebCore::RenderMathMLSpace::updateLogicalWidth):
(WebCore::RenderMathMLSpace::updateLogicalHeight):
(WebCore::RenderMathMLSpace::layout):
(WebCore::RenderMathMLSpace::styleDidChange):
(WebCore::RenderMathMLSpace::firstLineBoxBaseline):
* rendering/mathml/RenderMathMLSpace.h: Added.
(WebCore::RenderMathMLSpace::isRenderMathMLSpace):
(WebCore::RenderMathMLSpace::renderName):
(WebCore::toRenderMathMLSpace):

LayoutTests:

Add a reftest for the mspace element (width, height and depth) and
the parsing of MathML lengths. Import a reftest from Gecko to check
positive namedspace values.

* mathml/presentation/mspace-expected.html: Added.
* mathml/presentation/mspace-units-expected.html: Added.
* mathml/presentation/mspace-units.html: Added.
* mathml/presentation/mspace.html: Added.
* mathml/presentation/positive-namedspace-expected.html: Added.
* mathml/presentation/positive-namedspace.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152234 => 152235)


--- trunk/LayoutTests/ChangeLog	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/LayoutTests/ChangeLog	2013-07-01 18:41:43 UTC (rev 152235)
@@ -1,3 +1,21 @@
+2013-07-01  Frédéric Wang  <[email protected]>
+
+        Add Support for mspace element
+        https://bugs.webkit.org/show_bug.cgi?id=115610
+
+        Reviewed by Chris Fleizach.
+
+        Add a reftest for the mspace element (width, height and depth) and
+        the parsing of MathML lengths. Import a reftest from Gecko to check
+        positive namedspace values.
+
+        * mathml/presentation/mspace-expected.html: Added.
+        * mathml/presentation/mspace-units-expected.html: Added.
+        * mathml/presentation/mspace-units.html: Added.
+        * mathml/presentation/mspace.html: Added.
+        * mathml/presentation/positive-namedspace-expected.html: Added.
+        * mathml/presentation/positive-namedspace.html: Added.
+
 2013-07-01  Gabor Abraham  <[email protected]>
 
         [Qt] Unreviewed gardening. Skipping unsupported tests.

Added: trunk/LayoutTests/mathml/presentation/mspace-expected.html (0 => 152235)


--- trunk/LayoutTests/mathml/presentation/mspace-expected.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/mspace-expected.html	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>mspace</title>
+</head>
+
+<body>
+
+  <div style="position: absolute;
+	      top: 0; left: 0;
+	      width: 50px; height: 6em;
+	      background: red;"></div>
+
+  <div style="position: absolute;
+	      top: 2em; left: 50px;
+	      width: 40px; height: 3em;
+	      background: green;"></div>
+
+  <div style="position: absolute;
+	      top: 1em; left: 90px;
+	      width: 30px; height: 3em;
+	      background: blue;"></div>
+
+</body>
+
+</html>

Added: trunk/LayoutTests/mathml/presentation/mspace-units-expected.html (0 => 152235)


--- trunk/LayoutTests/mathml/presentation/mspace-units-expected.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/mspace-units-expected.html	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>mspace</title>
+</head>
+
+<body>
+
+  <math style="position: absolute; top: 0; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 5em; height: 10px;
+		   background:red;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 10px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 60pt; height: 10px;
+		   background:green;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 20px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 5pc; height: 10px;
+		   background:blue;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 30px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 10ex; height: 10px;
+		   background:red;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 40px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 50px; height: 10px;
+		   background:green;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 50px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 1in; height: 10px;
+		   background:blue;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 60px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 2.54cm; height: 10px;
+		   background:red;"></span>
+    </mtext>
+  </math>
+
+  <math style="position: absolute; top: 70px; left: 0; margin: 0; padding: 0;">
+    <mtext>
+      <span style="display: inline-block; width: 25.4mm; height: 10px;
+		   background:green;"></span>
+    </mtext>
+  </math>
+
+</body>
+
+</html>

Added: trunk/LayoutTests/mathml/presentation/mspace-units.html (0 => 152235)


--- trunk/LayoutTests/mathml/presentation/mspace-units.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/mspace-units.html	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>mspace</title>
+</head>
+
+<body>
+
+  <math style="position: absolute; top: 0; left: 0; margin: 0; padding: 0;">
+    <mspace width="5em" height="10px" mathbackground="red"/>
+  </math>
+
+  <math style="position: absolute; top: 10px; left: 0; margin: 0; padding: 0;">
+    <mspace width="60pt" height="10px" mathbackground="green"/>
+  </math>
+
+  <math style="position: absolute; top: 20px; left: 0; margin: 0; padding: 0;">
+    <mspace width="5pc" height="10px" mathbackground="blue"/>
+  </math>
+
+  <math style="position: absolute; top: 30px; left: 0; margin: 0; padding: 0;">
+    <mspace width="10ex" height="10px" mathbackground="red"/>
+  </math>
+
+  <math style="position: absolute; top: 40px; left: 0; margin: 0; padding: 0;">
+    <mspace width="50px" height="10px" mathbackground="green"/>
+  </math>
+
+  <math style="position: absolute; top: 50px; left: 0; margin: 0; padding: 0;">
+    <mspace width="1in" height="10px" mathbackground="blue"/>
+  </math>
+
+  <math style="position: absolute; top: 60px; left: 0; margin: 0; padding: 0;">
+    <mspace width="2.54cm" height="10px" mathbackground="red"/>
+  </math>
+
+  <math style="position: absolute; top: 70px; left: 0; margin: 0; padding: 0;">
+    <mspace width="25.4mm" height="10px" mathbackground="green"/>
+  </math>
+
+</body>
+
+</html>

Added: trunk/LayoutTests/mathml/presentation/mspace.html (0 => 152235)


--- trunk/LayoutTests/mathml/presentation/mspace.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/mspace.html	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>mspace</title>
+</head>
+
+<body>
+
+  <math style="position: absolute; top: 0; left: 0; margin: 0; padding: 0;">
+    <mspace width="50px" height="3em" depth="3em" mathbackground="red"/>
+    <mspace width="40px" height="1em" depth="2em" mathbackground="green"/>
+    <mspace width="30px" height="2em" depth="1em" mathbackground="blue"/>
+  </math>
+
+</body>
+
+</html>

Added: trunk/LayoutTests/mathml/presentation/positive-namedspace-expected.html (0 => 152235)


--- trunk/LayoutTests/mathml/presentation/positive-namedspace-expected.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/positive-namedspace-expected.html	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,53 @@
+<html>	
+  <head></head>
+  <body>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.0555555556em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.111111111em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.166666667em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.222222222em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.277777778em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.333333333em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="0.388888889em"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>	
+  </body>	    
+</html>

Added: trunk/LayoutTests/mathml/presentation/positive-namedspace.html (0 => 152235)


--- trunk/LayoutTests/mathml/presentation/positive-namedspace.html	                        (rev 0)
+++ trunk/LayoutTests/mathml/presentation/positive-namedspace.html	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,54 @@
+<html>	
+  <head></head>
+  <body>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="veryverythinmathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="verythinmathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="thinmathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="mediummathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="thickmathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="verythickmathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+    <p>
+      <math>
+	<mrow>
+	  <mi>x</mi> <mspace width="veryverythickmathspace"></mspace> <mi>y</mi> 
+	</mrow>
+      </math>
+    </p>
+  </body>	    
+</html>

Modified: trunk/Source/WebCore/CMakeLists.txt (152234 => 152235)


--- trunk/Source/WebCore/CMakeLists.txt	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/CMakeLists.txt	2013-07-01 18:41:43 UTC (rev 152235)
@@ -2219,6 +2219,7 @@
     rendering/mathml/RenderMathMLOperator.cpp
     rendering/mathml/RenderMathMLRoot.cpp
     rendering/mathml/RenderMathMLRow.cpp
+    rendering/mathml/RenderMathMLSpace.cpp
     rendering/mathml/RenderMathMLSquareRoot.cpp
     rendering/mathml/RenderMathMLSubSup.cpp
     rendering/mathml/RenderMathMLUnderOver.cpp

Modified: trunk/Source/WebCore/ChangeLog (152234 => 152235)


--- trunk/Source/WebCore/ChangeLog	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/ChangeLog	2013-07-01 18:41:43 UTC (rev 152235)
@@ -1,3 +1,46 @@
+2013-07-01  Frédéric Wang  <[email protected]>
+
+        Add Support for mspace element
+        https://bugs.webkit.org/show_bug.cgi?id=115610
+
+        Reviewed by Chris Fleizach.
+
+        This patch adds basic support for the MathML mspace element. This is
+        important to let people control spacing of mathematical formulas.
+        Attributes width, height and depth are implemented. For the moment,
+        only nonnegative width are accepted.
+
+        * CMakeLists.txt: add references to the RenderMathMLSpace files.
+        * GNUmakefile.list.am: ditto.
+        * Target.pri: ditto.
+        * WebCore.vcxproj/WebCore.vcxproj: ditto.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
+        * WebCore.xcodeproj/project.pbxproj: ditto.
+        * css/mathml.css:
+        (mtable[columnlines="dashed"] > mtr > mtd + mtd): remove the obsolete linebreaking rule.
+        * mathml/MathMLTextElement.cpp:
+        (WebCore::MathMLTextElement::createRenderer): map mspaceTag to RenderMathMLSpace.
+        * mathml/mathattrs.in: add width, height and depth attributes
+        * mathml/mathtags.in: add mspace element
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::parseMathMLLength): fix int to float conversion.
+        * rendering/mathml/RenderMathMLBlock.h: declare isRenderMathMLSpace.
+        (WebCore::RenderMathMLBlock::isRenderMathMLSpace):
+        * rendering/mathml/RenderMathMLSpace.cpp: Added.
+        (WebCore::RenderMathMLSpace::RenderMathMLSpace):
+        (WebCore::RenderMathMLSpace::isChildAllowed):
+        (WebCore::RenderMathMLSpace::computePreferredLogicalWidths):
+        (WebCore::RenderMathMLSpace::updateFromElement):
+        (WebCore::RenderMathMLSpace::updateLogicalWidth):
+        (WebCore::RenderMathMLSpace::updateLogicalHeight):
+        (WebCore::RenderMathMLSpace::layout):
+        (WebCore::RenderMathMLSpace::styleDidChange):
+        (WebCore::RenderMathMLSpace::firstLineBoxBaseline):
+        * rendering/mathml/RenderMathMLSpace.h: Added.
+        (WebCore::RenderMathMLSpace::isRenderMathMLSpace):
+        (WebCore::RenderMathMLSpace::renderName):
+        (WebCore::toRenderMathMLSpace):
+
 2013-06-27  Jer Noble  <[email protected]>
 
         Audio in apps which embed WebViews is corrupted.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (152234 => 152235)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-07-01 18:41:43 UTC (rev 152235)
@@ -4604,6 +4604,8 @@
 	Source/WebCore/rendering/mathml/RenderMathMLRoot.h \
 	Source/WebCore/rendering/mathml/RenderMathMLRow.cpp \
 	Source/WebCore/rendering/mathml/RenderMathMLRow.h \
+	Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp \
+	Source/WebCore/rendering/mathml/RenderMathMLSpace.h \
 	Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp \
 	Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h \
 	Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp \

Modified: trunk/Source/WebCore/Target.pri (152234 => 152235)


--- trunk/Source/WebCore/Target.pri	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/Target.pri	2013-07-01 18:41:43 UTC (rev 152235)
@@ -2414,6 +2414,7 @@
     rendering/mathml/RenderMathMLOperator.h \
     rendering/mathml/RenderMathMLRoot.h \
     rendering/mathml/RenderMathMLRow.h \
+    rendering/mathml/RenderMathMLSpace.h \
     rendering/mathml/RenderMathMLSquareRoot.h \
     rendering/mathml/RenderMathMLSubSup.h \
     rendering/mathml/RenderMathMLUnderOver.h \
@@ -3607,6 +3608,7 @@
         rendering/mathml/RenderMathMLOperator.cpp \
         rendering/mathml/RenderMathMLRoot.cpp \
         rendering/mathml/RenderMathMLRow.cpp \
+        rendering/mathml/RenderMathMLSpace.cpp \
         rendering/mathml/RenderMathMLSquareRoot.cpp \
         rendering/mathml/RenderMathMLSubSup.cpp \
         rendering/mathml/RenderMathMLUnderOver.cpp

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (152234 => 152235)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2013-07-01 18:41:43 UTC (rev 152235)
@@ -6684,6 +6684,7 @@
     <ClCompile Include="..\rendering\mathml\RenderMathMLOperator.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLRoot.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLRow.cpp" />
+    <ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLSubSup.cpp" />
     <ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp" />
@@ -12661,6 +12662,7 @@
     <ClInclude Include="..\rendering\mathml\RenderMathMLOperator.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLRoot.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h" />
+    <ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLSubSup.h" />
     <ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (152234 => 152235)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2013-07-01 18:41:43 UTC (rev 152235)
@@ -2865,6 +2865,9 @@
     <ClCompile Include="..\rendering\mathml\RenderMathMLRow.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
+    <ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp">
+      <Filter>rendering\mathml</Filter>
+    </ClCompile>
     <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
@@ -9825,6 +9828,9 @@
     <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
+    <ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h">
+      <Filter>rendering\mathml</Filter>
+    </ClInclude>
     <ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (152234 => 152235)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-07-01 18:41:43 UTC (rev 152235)
@@ -1691,6 +1691,7 @@
 		5A574F25131DB93900471B88 /* RenderQuote.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A574F23131DB93900471B88 /* RenderQuote.h */; };
 		5A574F28131DB96D00471B88 /* QuotesData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5A574F26131DB96D00471B88 /* QuotesData.cpp */; };
 		5A574F29131DB96D00471B88 /* QuotesData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A574F27131DB96D00471B88 /* QuotesData.h */; };
+		5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */; };
 		5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D21A80013ECE5DF00BB7064 /* WebVTTParser.cpp */; };
 		5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D21A80113ECE5DF00BB7064 /* WebVTTParser.h */; };
 		5D4F51DF132725480016F541 /* HTMLConverter.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5392D341326AD0100043D35 /* HTMLConverter.mm */; };
@@ -7249,6 +7250,7 @@
 		31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEventCustom.cpp; sourceTree = "<group>"; };
 		3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = "<group>"; };
 		3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; };
+		331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSpace.h; path = rendering/mathml/RenderMathMLSpace.h; sourceTree = SOURCE_ROOT; };
 		333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = Modules/notifications/Notification.idl; sourceTree = "<group>"; };
 		333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = Modules/notifications/Notification.h; sourceTree = "<group>"; };
 		33503C9910179A74003B47E1 /* NotificationClient.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = NotificationClient.h; path = Modules/notifications/NotificationClient.h; sourceTree = "<group>"; };
@@ -12083,6 +12085,7 @@
 		DAACB3DA16F2416400666135 /* PageConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageConsole.h; sourceTree = "<group>"; };
 		DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; };
 		DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; };
+		DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLSpace.cpp; path = rendering/mathml/RenderMathMLSpace.cpp; sourceTree = SOURCE_ROOT; };
 		DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreObjCExtras.h; sourceTree = "<group>"; };
 		DD763BB10992C2C900740B8E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; };
 		DE49B2FF165F2FC60010338D /* MediaControlElementTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlElementTypes.cpp; sourceTree = "<group>"; };
@@ -13039,6 +13042,8 @@
 				034768DFFF38A50411DB9C8B /* Products */,
 				1CDD44660BA9C80000F90147 /* Configurations */,
 				449195900FBE175B00D9F824 /* Exports */,
+				DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */,
+				331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */,
 			);
 			name = WebKit;
 			sourceTree = "<group>";
@@ -26262,6 +26267,7 @@
 				439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */,
 				439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */,
 				439046E312DA25E800AF80A2 /* RenderMathMLRow.cpp in Sources */,
+				5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */,
 				439046E512DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp in Sources */,
 				439046E712DA25E800AF80A2 /* RenderMathMLSubSup.cpp in Sources */,
 				439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */,

Modified: trunk/Source/WebCore/css/mathml.css (152234 => 152235)


--- trunk/Source/WebCore/css/mathml.css	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/css/mathml.css	2013-07-01 18:41:43 UTC (rev 152235)
@@ -237,7 +237,3 @@
 mtable[columnlines="dashed"] > mtr > mtd + mtd {
     border-left: dashed thin;
 }
-
-mspace[linebreak="newline"] {
-    display: block;
-}

Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (152234 => 152235)


--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp	2013-07-01 18:41:43 UTC (rev 152235)
@@ -32,6 +32,7 @@
 
 #include "MathMLNames.h"
 #include "RenderMathMLOperator.h"
+#include "RenderMathMLSpace.h"
 
 namespace WebCore {
     
@@ -51,6 +52,8 @@
 {
     if (hasLocalName(MathMLNames::moTag))
         return new (arena) RenderMathMLOperator(this);
+    if (hasLocalName(MathMLNames::mspaceTag))
+        return new (arena) RenderMathMLSpace(this);
 
     return MathMLElement::createRenderer(arena, style);
 }

Modified: trunk/Source/WebCore/mathml/mathattrs.in (152234 => 152235)


--- trunk/Source/WebCore/mathml/mathattrs.in	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/mathml/mathattrs.in	2013-07-01 18:41:43 UTC (rev 152235)
@@ -10,11 +10,13 @@
 columnspan
 definitionURL
 denomalign
+depth
 encoding
 fontfamily
 fontsize
 fontstyle
 fontweight
+height
 linethickness
 mathbackground
 mathcolor
@@ -25,3 +27,4 @@
 rowspan
 separators
 stretchy
+width

Modified: trunk/Source/WebCore/mathml/mathtags.in (152234 => 152235)


--- trunk/Source/WebCore/mathml/mathtags.in	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/mathml/mathtags.in	2013-07-01 18:41:43 UTC (rev 152235)
@@ -17,6 +17,7 @@
 mn interfaceName=MathMLTextElement
 mo interfaceName=MathMLTextElement
 mtext interfaceName=MathMLTextElement
+mspace interfaceName=MathMLTextElement
 msub interfaceName=MathMLInlineContainerElement
 msup interfaceName=MathMLInlineContainerElement
 mtable interfaceName=MathMLInlineContainerElement

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (152234 => 152235)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp	2013-07-01 18:41:43 UTC (rev 152235)
@@ -296,11 +296,11 @@
         return true;
     }
     if (unit == "pt") {
-        lengthValue = 4 / 3 * floatValue;
+        lengthValue = 4 * (floatValue / 3);
         return true;
     }
     if (unit == "pc") {
-        lengthValue = (4 / 3 * floatValue) * 12;
+        lengthValue = 16 * floatValue;
         return true;
     }
     if (unit == "in") {
@@ -308,11 +308,11 @@
         return true;
     }
     if (unit == "cm") {
-        lengthValue = 96 * floatValue / 2.54;
+        lengthValue = 96 * (floatValue / 2.54);
         return true;
     }
     if (unit == "mm") {
-        lengthValue = (96 * floatValue / 2.54) / 10;
+        lengthValue = 96 * (floatValue / 25.4);
         return true;
     }
 

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (152234 => 152235)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2013-07-01 18:40:27 UTC (rev 152234)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h	2013-07-01 18:41:43 UTC (rev 152235)
@@ -52,6 +52,7 @@
     virtual bool isRenderMathMLFenced() const { return false; }
     virtual bool isRenderMathMLFraction() const { return false; }
     virtual bool isRenderMathMLRoot() const { return false; }
+    virtual bool isRenderMathMLSpace() const { return false; }
     virtual bool isRenderMathMLSquareRoot() const { return false; }
     virtual bool isRenderMathMLSubSup() const { return false; }
     virtual bool isRenderMathMLUnderOver() const { return false; }

Added: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp (0 => 152235)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	                        (rev 0)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2013 The MathJax Consortium. 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 "RenderMathMLSpace.h"
+
+#if ENABLE(MATHML)
+
+#include "GraphicsContext.h"
+#include "MathMLNames.h"
+#include "PaintInfo.h"
+
+namespace WebCore {
+    
+using namespace MathMLNames;
+
+RenderMathMLSpace::RenderMathMLSpace(Element* element)
+    : RenderMathMLBlock(element)
+    , m_width(0)
+    , m_height(0)
+    , m_depth(0)
+{
+}
+
+void RenderMathMLSpace::computePreferredLogicalWidths()
+{
+    ASSERT(preferredLogicalWidthsDirty());
+
+    m_minPreferredLogicalWidth = m_width;
+    m_maxPreferredLogicalWidth = m_width;
+
+    RenderMathMLBlock::computePreferredLogicalWidths();
+}
+
+void RenderMathMLSpace::updateFromElement()
+{
+    Element* space = toElement(node());
+
+    // This parses the mspace attributes, using 0 as the default values.
+    m_width = 0;
+    m_height = 0;
+    m_depth = 0;
+    parseMathMLLength(space->getAttribute(MathMLNames::widthAttr), m_width, style());
+    parseMathMLLength(space->getAttribute(MathMLNames::heightAttr), m_height, style());
+    parseMathMLLength(space->getAttribute(MathMLNames::depthAttr), m_depth, style());
+
+    // FIXME: Negative width values should be accepted.
+    if (m_width < 0)
+        m_width = 0;
+
+    // If the total height is negative, set vertical dimensions to 0.
+    if (m_height + m_depth < 0) {
+        m_height = 0;
+        m_depth = 0;
+    }
+
+    setNeedsLayoutAndPrefWidthsRecalc();
+}
+
+void RenderMathMLSpace::updateLogicalWidth()
+{
+    setLogicalWidth(m_width);
+}
+
+void RenderMathMLSpace::updateLogicalHeight()
+{
+    setLogicalHeight(m_height + m_depth);
+}
+
+void RenderMathMLSpace::layout()
+{
+    updateFromElement();
+    RenderMathMLBlock::layout();
+}
+
+void RenderMathMLSpace::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+    RenderMathMLBlock::styleDidChange(diff, oldStyle);
+    updateFromElement();
+}
+
+int RenderMathMLSpace::firstLineBoxBaseline() const
+{
+    return m_height;
+}
+
+}
+
+#endif

Added: trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h (0 => 152235)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h	2013-07-01 18:41:43 UTC (rev 152235)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 The MathJax Consortium. 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 RenderMathMLSpace_h
+#define RenderMathMLSpace_h
+
+#if ENABLE(MATHML)
+
+#include "RenderMathMLBlock.h"
+
+namespace WebCore {
+    
+class RenderMathMLSpace : public RenderMathMLBlock {
+public:
+    explicit RenderMathMLSpace(Element*);
+
+    virtual int firstLineBoxBaseline() const OVERRIDE;
+    virtual void updateLogicalWidth() OVERRIDE;
+    virtual void updateLogicalHeight() OVERRIDE;
+
+protected:
+    virtual void layout();
+    
+private:
+    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
+    virtual const char* renderName() const OVERRIDE { return isAnonymous() ? "RenderMathMLSpace (anonymous)" : "RenderMathMLSpace"; }
+
+    virtual bool isRenderMathMLSpace() const OVERRIDE { return true; }
+
+    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE { return false; } 
+    virtual void computePreferredLogicalWidths() OVERRIDE;
+    virtual void updateFromElement() OVERRIDE;
+
+    float m_width;
+    float m_height;
+    float m_depth;
+};
+
+inline RenderMathMLSpace* toRenderMathMLSpace(RenderMathMLBlock* block)
+{ 
+    ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLSpace());
+    return static_cast<RenderMathMLSpace*>(block);
+}
+
+inline const RenderMathMLSpace* toRenderMathMLSpace(const RenderMathMLBlock* block)
+{ 
+    ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLSpace());
+    return static_cast<const RenderMathMLSpace*>(block);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toRenderMathMLSpace(const RenderMathMLSpace*);
+}
+
+#endif // ENABLE(MATHML)
+#endif // RenderMathMLSpace_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to