Changeset 152235 in webkit


Ignore:
Timestamp:
Jul 1, 2013 11:41:43 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Add Support for mspace element
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.
Location:
trunk
Files:
8 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r152221 r152235  
     12013-07-01  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Add Support for mspace element
     4        https://bugs.webkit.org/show_bug.cgi?id=115610
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Add a reftest for the mspace element (width, height and depth) and
     9        the parsing of MathML lengths. Import a reftest from Gecko to check
     10        positive namedspace values.
     11
     12        * mathml/presentation/mspace-expected.html: Added.
     13        * mathml/presentation/mspace-units-expected.html: Added.
     14        * mathml/presentation/mspace-units.html: Added.
     15        * mathml/presentation/mspace.html: Added.
     16        * mathml/presentation/positive-namedspace-expected.html: Added.
     17        * mathml/presentation/positive-namedspace.html: Added.
     18
    1192013-07-01  Gabor Abraham  <abrhm@inf.u-szeged.hu>
    220
  • trunk/Source/WebCore/CMakeLists.txt

    r152183 r152235  
    22202220    rendering/mathml/RenderMathMLRoot.cpp
    22212221    rendering/mathml/RenderMathMLRow.cpp
     2222    rendering/mathml/RenderMathMLSpace.cpp
    22222223    rendering/mathml/RenderMathMLSquareRoot.cpp
    22232224    rendering/mathml/RenderMathMLSubSup.cpp
  • trunk/Source/WebCore/ChangeLog

    r152234 r152235  
     12013-07-01  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Add Support for mspace element
     4        https://bugs.webkit.org/show_bug.cgi?id=115610
     5
     6        Reviewed by Chris Fleizach.
     7
     8        This patch adds basic support for the MathML mspace element. This is
     9        important to let people control spacing of mathematical formulas.
     10        Attributes width, height and depth are implemented. For the moment,
     11        only nonnegative width are accepted.
     12
     13        * CMakeLists.txt: add references to the RenderMathMLSpace files.
     14        * GNUmakefile.list.am: ditto.
     15        * Target.pri: ditto.
     16        * WebCore.vcxproj/WebCore.vcxproj: ditto.
     17        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
     18        * WebCore.xcodeproj/project.pbxproj: ditto.
     19        * css/mathml.css:
     20        (mtable[columnlines="dashed"] > mtr > mtd + mtd): remove the obsolete linebreaking rule.
     21        * mathml/MathMLTextElement.cpp:
     22        (WebCore::MathMLTextElement::createRenderer): map mspaceTag to RenderMathMLSpace.
     23        * mathml/mathattrs.in: add width, height and depth attributes
     24        * mathml/mathtags.in: add mspace element
     25        * rendering/mathml/RenderMathMLBlock.cpp:
     26        (WebCore::parseMathMLLength): fix int to float conversion.
     27        * rendering/mathml/RenderMathMLBlock.h: declare isRenderMathMLSpace.
     28        (WebCore::RenderMathMLBlock::isRenderMathMLSpace):
     29        * rendering/mathml/RenderMathMLSpace.cpp: Added.
     30        (WebCore::RenderMathMLSpace::RenderMathMLSpace):
     31        (WebCore::RenderMathMLSpace::isChildAllowed):
     32        (WebCore::RenderMathMLSpace::computePreferredLogicalWidths):
     33        (WebCore::RenderMathMLSpace::updateFromElement):
     34        (WebCore::RenderMathMLSpace::updateLogicalWidth):
     35        (WebCore::RenderMathMLSpace::updateLogicalHeight):
     36        (WebCore::RenderMathMLSpace::layout):
     37        (WebCore::RenderMathMLSpace::styleDidChange):
     38        (WebCore::RenderMathMLSpace::firstLineBoxBaseline):
     39        * rendering/mathml/RenderMathMLSpace.h: Added.
     40        (WebCore::RenderMathMLSpace::isRenderMathMLSpace):
     41        (WebCore::RenderMathMLSpace::renderName):
     42        (WebCore::toRenderMathMLSpace):
     43
    1442013-06-27  Jer Noble  <jer.noble@apple.com>
    245
  • trunk/Source/WebCore/GNUmakefile.list.am

    r152167 r152235  
    46054605        Source/WebCore/rendering/mathml/RenderMathMLRow.cpp \
    46064606        Source/WebCore/rendering/mathml/RenderMathMLRow.h \
     4607        Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp \
     4608        Source/WebCore/rendering/mathml/RenderMathMLSpace.h \
    46074609        Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp \
    46084610        Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h \
  • trunk/Source/WebCore/Target.pri

    r152183 r152235  
    24152415    rendering/mathml/RenderMathMLRoot.h \
    24162416    rendering/mathml/RenderMathMLRow.h \
     2417    rendering/mathml/RenderMathMLSpace.h \
    24172418    rendering/mathml/RenderMathMLSquareRoot.h \
    24182419    rendering/mathml/RenderMathMLSubSup.h \
     
    36083609        rendering/mathml/RenderMathMLRoot.cpp \
    36093610        rendering/mathml/RenderMathMLRow.cpp \
     3611        rendering/mathml/RenderMathMLSpace.cpp \
    36103612        rendering/mathml/RenderMathMLSquareRoot.cpp \
    36113613        rendering/mathml/RenderMathMLSubSup.cpp \
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r152192 r152235  
    66856685    <ClCompile Include="..\rendering\mathml\RenderMathMLRoot.cpp" />
    66866686    <ClCompile Include="..\rendering\mathml\RenderMathMLRow.cpp" />
     6687    <ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp" />
    66876688    <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp" />
    66886689    <ClCompile Include="..\rendering\mathml\RenderMathMLSubSup.cpp" />
     
    1266212663    <ClInclude Include="..\rendering\mathml\RenderMathMLRoot.h" />
    1266312664    <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h" />
     12665    <ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h" />
    1266412666    <ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h" />
    1266512667    <ClInclude Include="..\rendering\mathml\RenderMathMLSubSup.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r152192 r152235  
    28662866      <Filter>rendering\mathml</Filter>
    28672867    </ClCompile>
     2868    <ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp">
     2869      <Filter>rendering\mathml</Filter>
     2870    </ClCompile>
    28682871    <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp">
    28692872      <Filter>rendering\mathml</Filter>
     
    98249827    </ClInclude>
    98259828    <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h">
     9829      <Filter>rendering\mathml</Filter>
     9830    </ClInclude>
     9831    <ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h">
    98269832      <Filter>rendering\mathml</Filter>
    98279833    </ClInclude>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r152167 r152235  
    16921692                5A574F28131DB96D00471B88 /* QuotesData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5A574F26131DB96D00471B88 /* QuotesData.cpp */; };
    16931693                5A574F29131DB96D00471B88 /* QuotesData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A574F27131DB96D00471B88 /* QuotesData.h */; };
     1694                5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */; };
    16941695                5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D21A80013ECE5DF00BB7064 /* WebVTTParser.cpp */; };
    16951696                5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D21A80113ECE5DF00BB7064 /* WebVTTParser.h */; };
     
    72507251                3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = "<group>"; };
    72517252                3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; };
     7253                331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSpace.h; path = rendering/mathml/RenderMathMLSpace.h; sourceTree = SOURCE_ROOT; };
    72527254                333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = Modules/notifications/Notification.idl; sourceTree = "<group>"; };
    72537255                333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = Modules/notifications/Notification.h; sourceTree = "<group>"; };
     
    1208412086                DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; };
    1208512087                DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; };
     12088                DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLSpace.cpp; path = rendering/mathml/RenderMathMLSpace.cpp; sourceTree = SOURCE_ROOT; };
    1208612089                DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreObjCExtras.h; sourceTree = "<group>"; };
    1208712090                DD763BB10992C2C900740B8E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; };
     
    1304013043                                1CDD44660BA9C80000F90147 /* Configurations */,
    1304113044                                449195900FBE175B00D9F824 /* Exports */,
     13045                                DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */,
     13046                                331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */,
    1304213047                        );
    1304313048                        name = WebKit;
     
    2626326268                                439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */,
    2626426269                                439046E312DA25E800AF80A2 /* RenderMathMLRow.cpp in Sources */,
     26270                                5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */,
    2626526271                                439046E512DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp in Sources */,
    2626626272                                439046E712DA25E800AF80A2 /* RenderMathMLSubSup.cpp in Sources */,
  • trunk/Source/WebCore/css/mathml.css

    r150264 r152235  
    238238    border-left: dashed thin;
    239239}
    240 
    241 mspace[linebreak="newline"] {
    242     display: block;
    243 }
  • trunk/Source/WebCore/mathml/MathMLTextElement.cpp

    r140923 r152235  
    3333#include "MathMLNames.h"
    3434#include "RenderMathMLOperator.h"
     35#include "RenderMathMLSpace.h"
    3536
    3637namespace WebCore {
     
    5253    if (hasLocalName(MathMLNames::moTag))
    5354        return new (arena) RenderMathMLOperator(this);
     55    if (hasLocalName(MathMLNames::mspaceTag))
     56        return new (arena) RenderMathMLSpace(this);
    5457
    5558    return MathMLElement::createRenderer(arena, style);
  • trunk/Source/WebCore/mathml/mathattrs.in

    r129695 r152235  
    1111definitionURL
    1212denomalign
     13depth
    1314encoding
    1415fontfamily
     
    1617fontstyle
    1718fontweight
     19height
    1820linethickness
    1921mathbackground
     
    2628separators
    2729stretchy
     30width
  • trunk/Source/WebCore/mathml/mathtags.in

    r151123 r152235  
    1818mo interfaceName=MathMLTextElement
    1919mtext interfaceName=MathMLTextElement
     20mspace interfaceName=MathMLTextElement
    2021msub interfaceName=MathMLInlineContainerElement
    2122msup interfaceName=MathMLInlineContainerElement
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp

    r152140 r152235  
    297297    }
    298298    if (unit == "pt") {
    299         lengthValue = 4 / 3 * floatValue;
     299        lengthValue = 4 * (floatValue / 3);
    300300        return true;
    301301    }
    302302    if (unit == "pc") {
    303         lengthValue = (4 / 3 * floatValue) * 12;
     303        lengthValue = 16 * floatValue;
    304304        return true;
    305305    }
     
    309309    }
    310310    if (unit == "cm") {
    311         lengthValue = 96 * floatValue / 2.54;
     311        lengthValue = 96 * (floatValue / 2.54);
    312312        return true;
    313313    }
    314314    if (unit == "mm") {
    315         lengthValue = (96 * floatValue / 2.54) / 10;
     315        lengthValue = 96 * (floatValue / 25.4);
    316316        return true;
    317317    }
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h

    r152140 r152235  
    5353    virtual bool isRenderMathMLFraction() const { return false; }
    5454    virtual bool isRenderMathMLRoot() const { return false; }
     55    virtual bool isRenderMathMLSpace() const { return false; }
    5556    virtual bool isRenderMathMLSquareRoot() const { return false; }
    5657    virtual bool isRenderMathMLSubSup() const { return false; }
Note: See TracChangeset for help on using the changeset viewer.