Changeset 160005 in webkit


Ignore:
Timestamp:
Dec 3, 2013 9:12:38 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Add an MathMLSelectElement class to implement <maction> and <semantics>.
<https://webkit.org/b/120058>

Patch by Frédéric Wang <fred.wang@free.fr> on 2013-12-03
Reviewed by Chris Fleizach.

Source/WebCore:

Tests: mathml/presentation/maction-dynamic.html

mathml/presentation/maction.html
mathml/presentation/semantics.html

This adds a new MathMLSelectElement class to prepare the implementation
of the <maction> and <semantics> elements, for which only one "selected"
child is visible. We now simply display the first child of the
<semantics> element instead of hiding the annotations and this allows to
handle the use case of SVG-in-MathML as generated by Instiki when
bug 124128 is fixed ; Gecko's selection algorithm will be implemented
later (bug 100626). We now also rely on the @actiontype and @selection
attributes to select the visible <maction> child ; It remains to deal
with the user interaction (bug 85734).

  • CMakeLists.txt: add the new 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: remove the CSS rule for annotation/annotation-xml.
  • mathml/MathMLAllInOne.cpp: add the new cpp file.
  • mathml/MathMLSelectElement.cpp: Added.

(WebCore::MathMLSelectElement::MathMLSelectElement):
(WebCore::MathMLSelectElement::create):
(WebCore::MathMLSelectElement::createRenderer):
(WebCore::MathMLSelectElement::childShouldCreateRenderer):
(WebCore::MathMLSelectElement::finishParsingChildren):
(WebCore::MathMLSelectElement::childrenChanged):
(WebCore::MathMLSelectElement::attributeChanged):
(WebCore::MathMLSelectElement::updateSelectedChild): basic implementation for maction, semantics, maction@actiontype and maction@selection.

  • mathml/MathMLSelectElement.h: Added.
  • mathml/mathattrs.in: add actiontype and selection attributes.
  • mathml/mathtags.in: set element classes for maction, semantics, annotation and annotation-xml.

LayoutTests:

New tests for the selection of the visible child in the <maction> and <semantics> elements.

  • mathml/presentation/maction-dynamic-expected.html: Added.
  • mathml/presentation/maction-dynamic.html: Added.
  • mathml/presentation/maction-expected.html: Added.
  • mathml/presentation/maction.html: Added.
  • mathml/presentation/semantics-expected.html: Added.
  • mathml/presentation/semantics.html: Added.
Location:
trunk
Files:
7 added
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159980 r160005  
     12013-12-03  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Add an MathMLSelectElement class to implement <maction> and <semantics>.
     4        <https://webkit.org/b/120058>
     5
     6        Reviewed by Chris Fleizach.
     7
     8        New tests for the selection of the visible child in the <maction> and <semantics> elements.
     9
     10        * mathml/presentation/maction-dynamic-expected.html: Added.
     11        * mathml/presentation/maction-dynamic.html: Added.
     12        * mathml/presentation/maction-expected.html: Added.
     13        * mathml/presentation/maction.html: Added.
     14        * mathml/presentation/semantics-expected.html: Added.
     15        * mathml/presentation/semantics.html: Added.
     16
    1172013-12-02  Samuel White  <samuel_white@apple.com>
    218
  • trunk/LayoutTests/TestExpectations

    r159938 r160005  
    2121webkit.org/b/57700  mathml/presentation/row.xhtml [ Failure ]
    2222webkit.org/b/57700  mathml/presentation/mo.xhtml [ Failure ]
     23
     24# MathML regression with foreign objects
     25webkit.org/b/124128 mathml/presentation/semantics.html [ Skip ]
    2326
    2427# These conformace tests are no longer in sync with the latest specification
  • trunk/Source/WebCore/CMakeLists.txt

    r159856 r160005  
    17051705    mathml/MathMLInlineContainerElement.cpp
    17061706    mathml/MathMLMathElement.cpp
     1707    mathml/MathMLSelectElement.cpp
    17071708    mathml/MathMLTextElement.cpp
    17081709
  • trunk/Source/WebCore/ChangeLog

    r160001 r160005  
     12013-12-03  Frédéric Wang  <fred.wang@free.fr>
     2
     3        Add an MathMLSelectElement class to implement <maction> and <semantics>.
     4        <https://webkit.org/b/120058>
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Tests: mathml/presentation/maction-dynamic.html
     9               mathml/presentation/maction.html
     10               mathml/presentation/semantics.html
     11
     12        This adds a new MathMLSelectElement class to prepare the implementation
     13        of the <maction> and <semantics> elements, for which only one "selected"
     14        child is visible. We now simply display the first child of the
     15        <semantics> element instead of hiding the annotations and this allows to
     16        handle the use case of SVG-in-MathML as generated by Instiki when
     17        bug 124128 is fixed ; Gecko's selection algorithm will be implemented
     18        later (bug 100626). We now also rely on the @actiontype and @selection
     19        attributes to select the visible <maction> child ; It remains to deal
     20        with the user interaction (bug 85734).
     21
     22        * CMakeLists.txt: add the new files.
     23        * GNUmakefile.list.am: ditto
     24        * Target.pri: ditto
     25        * WebCore.vcxproj/WebCore.vcxproj: ditto
     26        * WebCore.vcxproj/WebCore.vcxproj.filters: ditto
     27        * WebCore.xcodeproj/project.pbxproj: ditto
     28        * css/mathml.css: remove the CSS rule for annotation/annotation-xml.
     29        * mathml/MathMLAllInOne.cpp: add the new cpp file.
     30        * mathml/MathMLSelectElement.cpp: Added.
     31        (WebCore::MathMLSelectElement::MathMLSelectElement):
     32        (WebCore::MathMLSelectElement::create):
     33        (WebCore::MathMLSelectElement::createRenderer):
     34        (WebCore::MathMLSelectElement::childShouldCreateRenderer):
     35        (WebCore::MathMLSelectElement::finishParsingChildren):
     36        (WebCore::MathMLSelectElement::childrenChanged):
     37        (WebCore::MathMLSelectElement::attributeChanged):
     38        (WebCore::MathMLSelectElement::updateSelectedChild): basic implementation for maction, semantics, maction@actiontype and maction@selection.
     39        * mathml/MathMLSelectElement.h: Added.
     40        * mathml/mathattrs.in: add actiontype and selection attributes.
     41        * mathml/mathtags.in: set element classes for maction, semantics, annotation and annotation-xml.
     42
    1432013-12-03  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
    244
  • trunk/Source/WebCore/GNUmakefile.list.am

    r159856 r160005  
    40514051        Source/WebCore/mathml/MathMLMathElement.cpp \
    40524052        Source/WebCore/mathml/MathMLMathElement.h \
     4053        Source/WebCore/mathml/MathMLSelectElement.cpp \
     4054        Source/WebCore/mathml/MathMLSelectElement.h  \
    40534055        Source/WebCore/mathml/MathMLTextElement.cpp \
    40544056        Source/WebCore/mathml/MathMLTextElement.h \
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r159856 r160005  
    1803418034    </ClCompile>
    1803518035    <ClCompile Include="..\mathml\MathMLMathElement.cpp">
     18036      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     18037      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     18038      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     18039      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     18040      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     18041      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     18042    </ClCompile>
     18043    <ClCompile Include="..\mathml\MathMLSelectElement.cpp">
    1803618044      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
    1803718045      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     
    2097720985    <ClInclude Include="..\mathml\MathMLInlineContainerElement.h" />
    2097820986    <ClInclude Include="..\mathml\MathMLMathElement.h" />
     20987    <ClInclude Include="..\mathml\MathMLSelectElement.h" />
    2097920988    <ClInclude Include="..\mathml\MathMLTextElement.h" />
    2098020989    <ClInclude Include="..\editing\AlternativeTextController.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r159849 r160005  
    49784978      <Filter>rendering\mathml</Filter>
    49794979    </ClCompile>
     4980    <ClCompile Include="..\mathml\MathMLSelectElement.cpp">
     4981      <Filter>rendering\mathml</Filter>
     4982    </ClCompile>
    49804983    <ClCompile Include="..\mathml\MathMLTextElement.cpp">
    49814984      <Filter>rendering\mathml</Filter>
     
    1254812551    </ClInclude>
    1254912552    <ClInclude Include="..\mathml\MathMLMathElement.h">
     12553      <Filter>rendering\mathml</Filter>
     12554    </ClInclude>
     12555    <ClInclude Include="..\mathml\MathMLSelectElement.h">
    1255012556      <Filter>rendering\mathml</Filter>
    1255112557    </ClInclude>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r159966 r160005  
    63116311                FEBC5F3216BD0CC300659BD3 /* DatabaseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
    63126312                FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D390CEA934600D89466 /* EditorIOS.mm */; };
     6313                FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */; };
    63136314                FEDBFF16182B7A8D0017FA64 /* BreakpointID.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDBFF14182B7A8D0017FA64 /* BreakpointID.h */; settings = {ATTRIBUTES = (Private, ); }; };
    63146315                FEDEF84116797108000E444A /* DatabaseStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDEF83F16797108000E444A /* DatabaseStrategy.cpp */; };
     
    86558656                5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; };
    86568657                5958F1CC1343917C0080B31F /* XMLViewer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = XMLViewer.js; sourceTree = "<group>"; };
     8658                59780849D41E6F65D81198BC /* MathMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLSelectElement.h; sourceTree = "<group>"; };
    86578659                598365DC1355F53C001B185D /* JSPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionCallback.h; sourceTree = "<group>"; };
    86588660                598365DE1355F562001B185D /* JSPositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionErrorCallback.h; sourceTree = "<group>"; };
     
    1314313145                F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseChooserOnlyDateAndTimeInputType.cpp; sourceTree = "<group>"; };
    1314413146                F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseChooserOnlyDateAndTimeInputType.h; sourceTree = "<group>"; };
     13147                F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLSelectElement.cpp; sourceTree = "<group>"; };
    1314513148                F7A034C3126BF6BE007DC19E /* FontOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontOrientation.h; sourceTree = "<group>"; };
    1314613149                F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
     
    2164421647                                FABE72F11059C1EB00D999DD /* MathMLMathElement.cpp */,
    2164521648                                FABE72F21059C1EB00D999DD /* MathMLMathElement.h */,
     21649                                F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */,
     21650                                59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
    2164621651                                FA654A691108ABED002615E0 /* MathMLTextElement.cpp */,
    2164721652                                FA654A6A1108ABED002615E0 /* MathMLTextElement.h */,
     
    2567625681                                FD31608712B026F700C1A359 /* AudioResamplerKernel.cpp in Sources */,
    2567725682                                FD8C46EB154608E700A5910C /* AudioScheduledSourceNode.cpp in Sources */,
     25683                                FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */,
    2567825684                                078E090317D14CEE00420AA1 /* MediaStreamTrackEvent.cpp in Sources */,
    2567925685                                CDA79824170A258300D45C55 /* AudioSession.cpp in Sources */,
  • trunk/Source/WebCore/css/mathml.css

    r159035 r160005  
    154154}
    155155 
    156 annotation, annotation-xml {
    157     display: none;
    158 }
    159 
    160156mphantom {
    161157    visibility: hidden;
  • trunk/Source/WebCore/mathml/MathMLAllInOne.cpp

    r139015 r160005  
    2929#include "MathMLInlineContainerElement.cpp"
    3030#include "MathMLMathElement.cpp"
     31#include "MathMLSelectElement.cpp"
    3132#include "MathMLTextElement.cpp"
    3233
  • trunk/Source/WebCore/mathml/MathMLElement.h

    r159856 r160005  
    4646
    4747    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     48    virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
    4849
    4950private:   
    5051    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
    5152    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) OVERRIDE;
    52 
    53     virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
    5453
    5554    inline bool isMathMLToken() const;
  • trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp

    r158097 r160005  
    5757RenderElement* MathMLInlineContainerElement::createRenderer(PassRef<RenderStyle> style)
    5858{
     59    if (hasLocalName(annotation_xmlTag))
     60        return new RenderMathMLRow(*this, std::move(style));
    5961    if (hasLocalName(mrowTag))
    6062        return new RenderMathMLRow(*this, std::move(style));
  • trunk/Source/WebCore/mathml/MathMLSelectElement.h

    r160004 r160005  
    11/*
    2  * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved.
    3  * Copyright (C) 2010 Apple Inc. All rights reserved.
    4  * Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved.
     2 * Copyright (C) 2013 The MathJax Consortium. All rights reserved.
    53 *
    64 * Redistribution and use in source and binary forms, with or without
     
    2624 */
    2725
    28 #ifndef MathMLElement_h
    29 #define MathMLElement_h
     26#ifndef MathMLSelectElement_h
     27#define MathMLSelectElement_h
    3028
    3129#if ENABLE(MATHML)
    32 
    33 #include "StyledElement.h"
     30#include "MathMLInlineContainerElement.h"
    3431
    3532namespace WebCore {
    3633
    37 class MathMLElement : public StyledElement {
     34class MathMLSelectElement FINAL : public MathMLInlineContainerElement {
    3835public:
    39     static PassRefPtr<MathMLElement> create(const QualifiedName& tagName, Document&);
     36    static PassRefPtr<MathMLSelectElement> create(const QualifiedName& tagName, Document&);
    4037
    41     int colSpan() const;
    42     int rowSpan() const;
    43 
    44 protected:
    45     MathMLElement(const QualifiedName& tagName, Document&);
    46 
    47     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    48 
    49 private:   
    50     virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
    51     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) OVERRIDE;
     38private:
     39    MathMLSelectElement(const QualifiedName& tagName, Document&);
     40    virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
    5241
    5342    virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
    5443
    55     inline bool isMathMLToken() const;
     44    virtual void finishParsingChildren() OVERRIDE;
     45    virtual void childrenChanged(const ChildChange&) OVERRIDE;
     46    virtual void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly) OVERRIDE;
     47
     48    void updateSelectedChild();
     49    Element* m_selectedChild;
    5650};
    57 
    58 void isMathMLElement(const MathMLElement&); // Catch unnecessary runtime check of type known at compile time.
    59 inline bool isMathMLElement(const Node& node) { return node.isMathMLElement(); }
    60 NODE_TYPE_CASTS(MathMLElement)
    6151
    6252}
    6353
    6454#endif // ENABLE(MATHML)
    65 
    66 #endif // MathMLElement_h
     55#endif // MathMLSelectElement_h
  • trunk/Source/WebCore/mathml/mathattrs.in

    r159504 r160005  
    44attrsNullNamespace
    55
     6actiontype
    67alttext
    78background
     
    2728open
    2829rowspan
     30selection
    2931separators
    3032stretchy
  • trunk/Source/WebCore/mathml/mathtags.in

    r159504 r160005  
    44fallbackInterfaceName="MathMLElement"
    55
     6annotation interfaceName=MathMLTextElement
     7annotation-xml interfaceName=MathMLInlineContainerElement
     8maction interfaceName=MathMLSelectElement
    69math
    710mfrac interfaceName=MathMLInlineContainerElement
     
    2831mprescripts interfaceName=MathMLInlineContainerElement
    2932none interfaceName=MathMLInlineContainerElement
     33semantics interfaceName=MathMLSelectElement
    3034
    3135#if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
     
    3337mglyph
    3438malignmark
    35 annotation-xml
    3639#endif
Note: See TracChangeset for help on using the changeset viewer.