Add Support for mspace element
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jul 2013 18:41:43 +0000 (18:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jul 2013 18:41:43 +0000 (18:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115610

Patch by Frédéric Wang <fred.wang@free.fr> 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@152235 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
LayoutTests/ChangeLog
LayoutTests/mathml/presentation/mspace-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/mspace-units-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/mspace-units.html [new file with mode: 0644]
LayoutTests/mathml/presentation/mspace.html [new file with mode: 0644]
LayoutTests/mathml/presentation/positive-namedspace-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/positive-namedspace.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/mathml.css
Source/WebCore/mathml/MathMLTextElement.cpp
Source/WebCore/mathml/mathattrs.in
Source/WebCore/mathml/mathtags.in
Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp [new file with mode: 0644]
Source/WebCore/rendering/mathml/RenderMathMLSpace.h [new file with mode: 0644]

index c25739119b39d390f0027d334d6a7b01e5612778..b1b01edf1ff218b0106f4ce565d28fabe027a46a 100644 (file)
@@ -1,3 +1,21 @@
+2013-07-01  Frédéric Wang  <fred.wang@free.fr>
+
+        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  <abrhm@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening. Skipping unsupported tests.
diff --git a/LayoutTests/mathml/presentation/mspace-expected.html b/LayoutTests/mathml/presentation/mspace-expected.html
new file mode 100644 (file)
index 0000000..3a9e9d4
--- /dev/null
@@ -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>
diff --git a/LayoutTests/mathml/presentation/mspace-units-expected.html b/LayoutTests/mathml/presentation/mspace-units-expected.html
new file mode 100644 (file)
index 0000000..751cbbf
--- /dev/null
@@ -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>
diff --git a/LayoutTests/mathml/presentation/mspace-units.html b/LayoutTests/mathml/presentation/mspace-units.html
new file mode 100644 (file)
index 0000000..b2dc987
--- /dev/null
@@ -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>
diff --git a/LayoutTests/mathml/presentation/mspace.html b/LayoutTests/mathml/presentation/mspace.html
new file mode 100644 (file)
index 0000000..76d76a9
--- /dev/null
@@ -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>
diff --git a/LayoutTests/mathml/presentation/positive-namedspace-expected.html b/LayoutTests/mathml/presentation/positive-namedspace-expected.html
new file mode 100644 (file)
index 0000000..c362b85
--- /dev/null
@@ -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>
diff --git a/LayoutTests/mathml/presentation/positive-namedspace.html b/LayoutTests/mathml/presentation/positive-namedspace.html
new file mode 100644 (file)
index 0000000..bc8b60b
--- /dev/null
@@ -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>
index 2dd3c2687c97c37b0713d711a5c4ef43b05e3051..bf8875a5708e371199f8097b29e69a5adc4f2ab6 100644 (file)
@@ -2219,6 +2219,7 @@ set(WebCore_SOURCES
     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
index 93cd2211acf753c4302a0f3621ed79b7dc4e30c2..b8b9c0297888438a1ed2b4c0d09d610df478fbf0 100644 (file)
@@ -1,3 +1,46 @@
+2013-07-01  Frédéric Wang  <fred.wang@free.fr>
+
+        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  <jer.noble@apple.com>
 
         Audio in apps which embed WebViews is corrupted.
index f51c9ce2afa19a7b051e53343f6b47958480bc02..a5b1793b112cd0fc2b3c2daf1da371e6d9ac7c5f 100644 (file)
@@ -4604,6 +4604,8 @@ webcore_sources += \
        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 \
index 5fa6271dfec54da45b7bd7dbb7f62d43a5873c73..ec5635604f20a7d11441f5b8f6fcd7acb61a6dac 100644 (file)
@@ -2414,6 +2414,7 @@ HEADERS += \
     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 @@ enable?(MATHML) {
         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
index daa09df8d32414d361b7649aa4ceb6878e273004..1956e794dc55d10284bd11d46fad66793cfcca8c 100644 (file)
     <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" />
     <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" />
index e9c684d8f872991918bd20343aadb33069e29beb..a9f1824c417cc4d413a2d8f20955daeeddd1bb3f 100644 (file)
     <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>
     <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>
index 49124e468020e8293437c481f050cda6872192f4..04f40a14201604114108ad0a92c63d6149edcc8b 100644 (file)
                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 */; };
                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>"; };
                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>"; };
                                034768DFFF38A50411DB9C8B /* Products */,
                                1CDD44660BA9C80000F90147 /* Configurations */,
                                449195900FBE175B00D9F824 /* Exports */,
+                               DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */,
+                               331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */,
                        );
                        name = WebKit;
                        sourceTree = "<group>";
                                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 */,
index 7ce45b7a156ffb22ea7d95698764b109910c1f83..92d1029f8a100111f7a1e9330c643d33769bf368 100644 (file)
@@ -237,7 +237,3 @@ mtable[columnlines="solid"] > mtr > mtd + mtd {
 mtable[columnlines="dashed"] > mtr > mtd + mtd {
     border-left: dashed thin;
 }
-
-mspace[linebreak="newline"] {
-    display: block;
-}
index 8f830cbf61b3709663b0b48c52a1b7845e4c77bb..7f32875243f2d656b31d98d611bec6fef642c261 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "MathMLNames.h"
 #include "RenderMathMLOperator.h"
+#include "RenderMathMLSpace.h"
 
 namespace WebCore {
     
@@ -51,6 +52,8 @@ RenderObject* MathMLTextElement::createRenderer(RenderArena* arena, RenderStyle*
 {
     if (hasLocalName(MathMLNames::moTag))
         return new (arena) RenderMathMLOperator(this);
+    if (hasLocalName(MathMLNames::mspaceTag))
+        return new (arena) RenderMathMLSpace(this);
 
     return MathMLElement::createRenderer(arena, style);
 }
index afa5feca713cc2c524bcf1f697c679e5210c2aac..4b7c2300fcab921cad65a0f8d0bc8820953e6df4 100644 (file)
@@ -10,11 +10,13 @@ color
 columnspan
 definitionURL
 denomalign
+depth
 encoding
 fontfamily
 fontsize
 fontstyle
 fontweight
+height
 linethickness
 mathbackground
 mathcolor
@@ -25,3 +27,4 @@ open
 rowspan
 separators
 stretchy
+width
index 1eef8849461225f1fafa590d56f56c33c21d4ece..805c15c3da432a9be4a71aea795bb1cf2d068523 100644 (file)
@@ -17,6 +17,7 @@ mi interfaceName=MathMLTextElement
 mn interfaceName=MathMLTextElement
 mo interfaceName=MathMLTextElement
 mtext interfaceName=MathMLTextElement
+mspace interfaceName=MathMLTextElement
 msub interfaceName=MathMLInlineContainerElement
 msup interfaceName=MathMLInlineContainerElement
 mtable interfaceName=MathMLInlineContainerElement
index d90ea8ceeb9c0be583c0e3ded90bb763acf655ca..c217a8a4fb9be720d7ea84eaa177cd9f98257be6 100644 (file)
@@ -296,11 +296,11 @@ bool parseMathMLLength(const String& string, float& lengthValue, const RenderSty
         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 @@ bool parseMathMLLength(const String& string, float& lengthValue, const RenderSty
         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;
     }
 
index 4eeeff0cfe1afd03f5dd5272a943ae32f6a53b48..6f3dbb07ae3672faf83acdc79146600ec1a2d5e5 100644 (file)
@@ -52,6 +52,7 @@ public:
     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; }
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp b/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp
new file mode 100644 (file)
index 0000000..27df785
--- /dev/null
@@ -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
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSpace.h b/Source/WebCore/rendering/mathml/RenderMathMLSpace.h
new file mode 100644 (file)
index 0000000..021f9dc
--- /dev/null
@@ -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