Add an MathMLSelectElement class to implement <maction> and <semantics>.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 17:12:38 +0000 (17:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 17:12:38 +0000 (17:12 +0000)
<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.

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

22 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/mathml/presentation/maction-dynamic-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/maction-dynamic.html [new file with mode: 0644]
LayoutTests/mathml/presentation/maction-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/maction.html [new file with mode: 0644]
LayoutTests/mathml/presentation/semantics-expected.html [new file with mode: 0644]
LayoutTests/mathml/presentation/semantics.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
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/MathMLAllInOne.cpp
Source/WebCore/mathml/MathMLElement.h
Source/WebCore/mathml/MathMLInlineContainerElement.cpp
Source/WebCore/mathml/MathMLSelectElement.cpp [new file with mode: 0644]
Source/WebCore/mathml/MathMLSelectElement.h [new file with mode: 0644]
Source/WebCore/mathml/mathattrs.in
Source/WebCore/mathml/mathtags.in

index 7d274b4..f8400e4 100644 (file)
@@ -1,3 +1,19 @@
+2013-12-03  Frédéric Wang  <fred.wang@free.fr>
+
+        Add an MathMLSelectElement class to implement <maction> and <semantics>.
+        <https://webkit.org/b/120058>
+
+        Reviewed by Chris Fleizach.
+
+        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.
+
 2013-12-02  Samuel White  <samuel_white@apple.com>
 
         AX: Add AXUIElementCountForSearchPredicate parameterized attribute.
index 87b7fbf..4548c9a 100644 (file)
@@ -21,6 +21,9 @@ webkit.org/b/99618  mathml/presentation/roots.xhtml [ Failure ]
 webkit.org/b/57700  mathml/presentation/row.xhtml [ Failure ]
 webkit.org/b/57700  mathml/presentation/mo.xhtml [ Failure ]
 
+# MathML regression with foreign objects
+webkit.org/b/124128 mathml/presentation/semantics.html [ Skip ]
+
 # These conformace tests are no longer in sync with the latest specification
 # and expect compareDocumentPosition() to return:
 # DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_DISCONNECTED
diff --git a/LayoutTests/mathml/presentation/maction-dynamic-expected.html b/LayoutTests/mathml/presentation/maction-dynamic-expected.html
new file mode 100644 (file)
index 0000000..3468932
--- /dev/null
@@ -0,0 +1,57 @@
+<!doctype html>
+<html>
+  <head>
+    <title>maction</title>
+  </head>
+  <body>
+
+    <math>
+      <maction selection="3" actiontype="tooltip">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="tooltip" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="statusline" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+
+    <math>
+      <maction actiontype="toggle" selection="2">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="4">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+
+  </body>
+</html>
diff --git a/LayoutTests/mathml/presentation/maction-dynamic.html b/LayoutTests/mathml/presentation/maction-dynamic.html
new file mode 100644 (file)
index 0000000..6de9e65
--- /dev/null
@@ -0,0 +1,84 @@
+<!doctype html>
+<html>
+  <head>
+    <title>maction</title>
+    <script type="text/javascript">
+      var mathmlNS = "http://www.w3.org/1998/Math/MathML";
+
+      function test()
+      {
+        var maction = document.getElementsByTagNameNS(mathmlNS, "maction");
+
+        // Setting the actiontype attribute
+        maction[0].setAttribute("actiontype", "tooltip");
+        maction[1].setAttribute("actiontype", "tooltip");
+        maction[2].setAttribute("actiontype", "statusline");
+        maction[3].removeAttribute("actiontype");
+
+        // Setting the selection attribute
+        maction[4].setAttribute("selection", "2");
+        maction[5].setAttribute("selection", "4");
+        maction[6].removeAttribute("selection");
+
+        // Setting the child list
+        maction[7].removeChild(maction[7].firstElementChild);
+        var e = maction[8].firstElementChild;
+        maction[8].insertBefore(e.cloneNode(true), e);
+      }
+    </script>
+
+  </head>
+  <body onload="test()">
+
+    <!-- This test verifies which child of the maction element is selected after a DOM change. The page should render the same as the static version. -->
+
+    <math>
+      <maction selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="statusline" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+
+    <math>
+      <maction actiontype="toggle">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+    <math>
+      <maction actiontype="toggle" selection="3">
+        <mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn>
+      </maction>
+    </math>
+
+  </body>
+</html>
diff --git a/LayoutTests/mathml/presentation/maction-expected.html b/LayoutTests/mathml/presentation/maction-expected.html
new file mode 100644 (file)
index 0000000..8fd3753
--- /dev/null
@@ -0,0 +1,116 @@
+<!doctype html>
+<html>
+  <head>
+    <title>maction</title>
+  </head>
+  <body>
+
+    <p>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+    </p>
+
+    <p>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+    </p>
+
+    <p>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>3</mn>
+        </mrow>
+      </math>
+    </p>
+
+    <p>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>3</mn>
+        </mrow>
+      </math>
+    </p>
+
+    <p>
+      <math>
+        <mrow>
+          <mn>2</mn>
+        </mrow>
+      </math>
+    </p>
+
+    <p>
+      <math>
+        <mrow>
+          <mn>3</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>1</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>2</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>4</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+          <mn>4</mn>
+        </mrow>
+      </math>
+      <math>
+        <mrow>
+        </mrow>
+      </math>
+    </p>
+
+  </body>
+</html>
diff --git a/LayoutTests/mathml/presentation/maction.html b/LayoutTests/mathml/presentation/maction.html
new file mode 100644 (file)
index 0000000..58e4a76
--- /dev/null
@@ -0,0 +1,173 @@
+<!doctype html>
+<html>
+  <head>
+    <title>maction</title>
+  </head>
+  <body>
+
+    <!-- This test verifies which child of the maction element is selected. -->
+
+    <!-- For the statusline action type, the first child should be visible and the selection attribute should be ignored. -->
+    <p>
+      <math>
+        <maction actiontype="statusline">
+          <mn>1</mn>
+          <mn>2</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="statusline" selection="3">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+    </p>
+
+    <!-- For the tooltip action type, the first child should be visible and the selection attribute should be ignored. -->
+    <p>
+      <math>
+        <maction actiontype="tooltip">
+          <mn>1</mn>
+          <mn>2</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="tooltip" selection="3">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+    </p>
+
+    <!-- For the toggle action type, we use the selection attribute to determine the selected child. -->
+    <p>
+      <math>
+        <maction actiontype="toggle">
+          <mn>1</mn>
+          <mn>2</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="toggle" selection="3">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+    </p>
+
+    <!-- For any unknown action type, we use the selection attribute to determine the selected child. -->
+    <p>
+      <math>
+        <maction actiontype="unknown">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="unknown" selection="3">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+    </p>
+
+    <!-- actiontype is case-sensitive, TOOLTIP is treated as unknown -->
+    <p>
+      <math>
+        <maction actiontype="TOOLTIP" selection="2">
+          <mn>1</mn>
+          <mn>2</mn>
+        </maction>
+      </math>
+    </p>
+
+    <!-- Testing a couple of special values for the "selection" attribute -->
+    <p>
+      <!-- The selection attribute has data type xsd:positiveInteger
+           http://www.w3.org/TR/xmlschema-2/#positiveInteger -->
+      <math>
+        <maction actiontype="toggle" selection="+0003">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <!-- The MathML spec discourages the use of leading and trailing
+           whitespace, but they are not strictly prohibited. -->
+      <math>
+        <maction actiontype="toggle" selection="&#x20;&#x9;&#xD;&#xA;4&#x20;&#x9;&#xD;&#xA;">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <!-- The MathML spec suggests to rounded up or down to the closest value
+           within the allowed subset -->
+      <math>
+        <maction actiontype="toggle" selection="-5">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math> 
+      <math>
+        <maction actiontype="toggle" selection="-1">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="toggle" selection="0">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="toggle" selection="2.25">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="toggle" selection="5">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="toggle" selection="8">
+          <mn>1</mn>
+          <mn>2</mn>
+          <mn>3</mn>
+          <mn>4</mn>
+        </maction>
+      </math>
+      <math>
+        <maction actiontype="toggle" selection="1">
+        </maction>
+      </math>
+    </p>
+
+  </body>
+</html>
diff --git a/LayoutTests/mathml/presentation/semantics-expected.html b/LayoutTests/mathml/presentation/semantics-expected.html
new file mode 100644 (file)
index 0000000..87985b4
--- /dev/null
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+  <head>
+    <title>semantics</title>
+  </head>
+  <body>
+
+    <math>
+      <mrow>
+        <mi>x</mi>
+      </mrow>
+   </math>
+
+  <math>
+    <mrow>
+      <mspace width="20px" height="20px" mathbackground="red"/>
+    </mrow>
+  </math>
+
+  </body>
+</html>
diff --git a/LayoutTests/mathml/presentation/semantics.html b/LayoutTests/mathml/presentation/semantics.html
new file mode 100644 (file)
index 0000000..dac9ccd
--- /dev/null
@@ -0,0 +1,30 @@
+<!doctype html>
+<html>
+  <head>
+    <title>semantics</title>
+  </head>
+  <body>
+
+    <!-- This verifies that annotations are not visible. -->
+    <math>
+      <semantics>
+        <mi>x</mi>
+        <annotation encoding="TeX">x</annotation>
+        <annotation encoding="StarMath 5.0">x</annotation>
+        <annotation-xml encoding="MathML-Content"><ci>x</ci></annotation-xml>
+      </semantics>
+   </math>
+
+    <!-- This is not valid MathML but has become a standard hack to include SVG in MathML because of Gecko's initial implementation. -->
+  <math>
+    <semantics>
+      <annotation-xml encoding="SVG1.1">
+        <svg width="20px" height="20px">
+          <rect width="20px" height="20px" fill="red" stroke="none"/>
+        </svg>
+      </annotation-xml>
+    </semantics>
+  </math>
+
+  </body>
+</html>
index db05c40..2a18974 100644 (file)
@@ -1704,6 +1704,7 @@ set(WebCore_SOURCES
     mathml/MathMLElement.cpp
     mathml/MathMLInlineContainerElement.cpp
     mathml/MathMLMathElement.cpp
+    mathml/MathMLSelectElement.cpp
     mathml/MathMLTextElement.cpp
 
     page/AutoscrollController.cpp
index 82f23ea..69846e3 100644 (file)
@@ -1,3 +1,45 @@
+2013-12-03  Frédéric Wang  <fred.wang@free.fr>
+
+        Add an MathMLSelectElement class to implement <maction> and <semantics>.
+        <https://webkit.org/b/120058>
+
+        Reviewed by Chris Fleizach.
+
+        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.
+
 2013-12-03  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
 
         Nix Upstream: Adding missing nix new files to WebCore
index 8871835..84ee950 100644 (file)
@@ -4050,6 +4050,8 @@ webcore_sources += \
        Source/WebCore/mathml/MathMLInlineContainerElement.h  \
        Source/WebCore/mathml/MathMLMathElement.cpp \
        Source/WebCore/mathml/MathMLMathElement.h \
+       Source/WebCore/mathml/MathMLSelectElement.cpp \
+       Source/WebCore/mathml/MathMLSelectElement.h  \
        Source/WebCore/mathml/MathMLTextElement.cpp \
        Source/WebCore/mathml/MathMLTextElement.h \
        Source/WebCore/page/animation/AnimationBase.cpp \
index 7b7c391..f82b887 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\mathml\MathMLSelectElement.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\mathml\MathMLTextElement.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     <ClInclude Include="..\mathml\MathMLElement.h" />
     <ClInclude Include="..\mathml\MathMLInlineContainerElement.h" />
     <ClInclude Include="..\mathml\MathMLMathElement.h" />
+    <ClInclude Include="..\mathml\MathMLSelectElement.h" />
     <ClInclude Include="..\mathml\MathMLTextElement.h" />
     <ClInclude Include="..\editing\AlternativeTextController.h" />
     <ClInclude Include="..\config.h" />
index 200b1e2..37752c7 100644 (file)
     <ClCompile Include="..\mathml\MathMLMathElement.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
+    <ClCompile Include="..\mathml\MathMLSelectElement.cpp">
+      <Filter>rendering\mathml</Filter>
+    </ClCompile>
     <ClCompile Include="..\mathml\MathMLTextElement.cpp">
       <Filter>rendering\mathml</Filter>
     </ClCompile>
     <ClInclude Include="..\mathml\MathMLMathElement.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
+    <ClInclude Include="..\mathml\MathMLSelectElement.h">
+      <Filter>rendering\mathml</Filter>
+    </ClInclude>
     <ClInclude Include="..\mathml\MathMLTextElement.h">
       <Filter>rendering\mathml</Filter>
     </ClInclude>
index b2069e9..67ab767 100644 (file)
                FEBC5F3116BD0CC300659BD3 /* DatabaseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEBC5F2F16BD0CC300659BD3 /* DatabaseBase.cpp */; };
                FEBC5F3216BD0CC300659BD3 /* DatabaseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = FEBC5F3016BD0CC300659BD3 /* DatabaseBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FED13D390CEA934600D89466 /* EditorIOS.mm */; };
+               FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */; };
                FEDBFF16182B7A8D0017FA64 /* BreakpointID.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDBFF14182B7A8D0017FA64 /* BreakpointID.h */; settings = {ATTRIBUTES = (Private, ); }; };
                FEDEF84116797108000E444A /* DatabaseStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDEF83F16797108000E444A /* DatabaseStrategy.cpp */; };
                FEDEF84216797108000E444A /* DatabaseStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDEF84016797108000E444A /* DatabaseStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
                59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientMock.h; sourceTree = "<group>"; };
                5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; };
                5958F1CC1343917C0080B31F /* XMLViewer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = XMLViewer.js; sourceTree = "<group>"; };
+               59780849D41E6F65D81198BC /* MathMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLSelectElement.h; sourceTree = "<group>"; };
                598365DC1355F53C001B185D /* JSPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionCallback.h; sourceTree = "<group>"; };
                598365DE1355F562001B185D /* JSPositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionErrorCallback.h; sourceTree = "<group>"; };
                598365E31355F604001B185D /* JSPositionCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionCallback.cpp; sourceTree = "<group>"; };
                F5C2869502846DCD018635CA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
                F5E0C6591643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseChooserOnlyDateAndTimeInputType.cpp; sourceTree = "<group>"; };
                F5E0C65A1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseChooserOnlyDateAndTimeInputType.h; sourceTree = "<group>"; };
+               F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLSelectElement.cpp; sourceTree = "<group>"; };
                F7A034C3126BF6BE007DC19E /* FontOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontOrientation.h; sourceTree = "<group>"; };
                F8216299029F4FB501000131 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestProgressEvent.cpp; sourceTree = "<group>"; };
                                FABE72F01059C1EB00D999DD /* MathMLInlineContainerElement.h */,
                                FABE72F11059C1EB00D999DD /* MathMLMathElement.cpp */,
                                FABE72F21059C1EB00D999DD /* MathMLMathElement.h */,
+                               F75A059AF170D8FAA5B8CABE /* MathMLSelectElement.cpp */,
+                               59780849D41E6F65D81198BC /* MathMLSelectElement.h */,
                                FA654A691108ABED002615E0 /* MathMLTextElement.cpp */,
                                FA654A6A1108ABED002615E0 /* MathMLTextElement.h */,
                                FABE72F31059C1EB00D999DD /* mathtags.in */,
                                FD31608512B026F700C1A359 /* AudioResampler.cpp in Sources */,
                                FD31608712B026F700C1A359 /* AudioResamplerKernel.cpp in Sources */,
                                FD8C46EB154608E700A5910C /* AudioScheduledSourceNode.cpp in Sources */,
+                               FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */,
                                078E090317D14CEE00420AA1 /* MediaStreamTrackEvent.cpp in Sources */,
                                CDA79824170A258300D45C55 /* AudioSession.cpp in Sources */,
                                CDA79827170A279100D45C55 /* AudioSessionIOS.mm in Sources */,
index d8be15d..96f186f 100644 (file)
@@ -153,10 +153,6 @@ math[mathsize="big"], mstyle[mathsize="big"], mo[mathsize="big"], mn[mathsize="b
     font-size: 1.5em;
 }
  
-annotation, annotation-xml {
-    display: none;
-}
-
 mphantom {
     visibility: hidden;
 }
index fce82bb..4176473 100644 (file)
@@ -28,5 +28,6 @@
 #include "MathMLElement.cpp"
 #include "MathMLInlineContainerElement.cpp"
 #include "MathMLMathElement.cpp"
+#include "MathMLSelectElement.cpp"
 #include "MathMLTextElement.cpp"
 
index 677140e..64b29a1 100644 (file)
@@ -45,13 +45,12 @@ protected:
     MathMLElement(const QualifiedName& tagName, Document&);
 
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
+    virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
 
 private:    
     virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) OVERRIDE;
 
-    virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
-
     inline bool isMathMLToken() const;
 };
 
index 689b11b..4c15485 100644 (file)
@@ -56,6 +56,8 @@ PassRefPtr<MathMLInlineContainerElement> MathMLInlineContainerElement::create(co
 
 RenderElement* MathMLInlineContainerElement::createRenderer(PassRef<RenderStyle> style)
 {
+    if (hasLocalName(annotation_xmlTag))
+        return new RenderMathMLRow(*this, std::move(style));
     if (hasLocalName(mrowTag))
         return new RenderMathMLRow(*this, std::move(style));
     if (hasLocalName(msubTag))
diff --git a/Source/WebCore/mathml/MathMLSelectElement.cpp b/Source/WebCore/mathml/MathMLSelectElement.cpp
new file mode 100644 (file)
index 0000000..10598f4
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * 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 "MathMLSelectElement.h"
+
+#if ENABLE(MATHML)
+
+#include "MathMLNames.h"
+#include "RenderMathMLRow.h"
+
+namespace WebCore {
+
+using namespace MathMLNames;
+
+MathMLSelectElement::MathMLSelectElement(const QualifiedName& tagName, Document& document)
+    : MathMLInlineContainerElement(tagName, document)
+    , m_selectedChild(nullptr)
+{
+}
+
+PassRefPtr<MathMLSelectElement> MathMLSelectElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(new MathMLSelectElement(tagName, document));
+}
+
+RenderElement* MathMLSelectElement::createRenderer(PassRef<RenderStyle> style)
+{
+    return new RenderMathMLRow(*this, std::move(style));
+}
+
+bool MathMLSelectElement::childShouldCreateRenderer(const Node& child) const
+{
+    return MathMLElement::childShouldCreateRenderer(child) && m_selectedChild == &child;
+}
+
+void MathMLSelectElement::finishParsingChildren()
+{
+    updateSelectedChild();
+    MathMLInlineContainerElement::finishParsingChildren();
+}
+
+void MathMLSelectElement::childrenChanged(const ChildChange& change)
+{
+    updateSelectedChild();
+    MathMLInlineContainerElement::childrenChanged(change);
+}
+
+void MathMLSelectElement::attributeChanged(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason)
+{
+    if (hasLocalName(mactionTag) && (name == MathMLNames::actiontypeAttr || name == MathMLNames::selectionAttr))
+        updateSelectedChild();
+
+    MathMLInlineContainerElement::attributeChanged(name, newValue, reason);
+}
+
+void MathMLSelectElement::updateSelectedChild()
+{
+    Element* newSelectedChild = firstElementChild();
+
+    if (newSelectedChild) {
+        if (hasLocalName(mactionTag)) {
+            // The value of the actiontype attribute is case-sensitive.
+            const AtomicString& actiontype = fastGetAttribute(MathMLNames::actiontypeAttr);
+            if (actiontype == "statusline")
+                // FIXME: implement user interaction for the "statusline" action type (http://wkbug/124922).
+                { }
+            else if (actiontype == "tooltip")
+                // FIXME: implement user interaction for the "tooltip" action type (http://wkbug/124921).
+                { }
+            else {
+                // FIXME: implement user interaction for the "toggle" action type (http://wkbug/120059).
+                // For the "toggle" action type or any unknown action type, we rely on the value of the selection attribute to determine the visible child.
+                int selection = fastGetAttribute(MathMLNames::selectionAttr).toInt();
+                for (int i = 1; i < selection; i++) {
+                    Element* nextChild = newSelectedChild->nextElementSibling();
+                    if (!nextChild)
+                        break;
+                    newSelectedChild = nextChild;
+                }
+            }
+        } else {
+            ASSERT(hasLocalName(semanticsTag));
+            // FIXME: implement Gecko's selection algorithm for <semantics> (http://wkbug/100626).
+        }
+    }
+
+    if (m_selectedChild == newSelectedChild)
+        return;
+
+    if (m_selectedChild && m_selectedChild->renderer())
+        Style::detachRenderTree(*m_selectedChild);
+
+    m_selectedChild = newSelectedChild;
+    setNeedsStyleRecalc();
+}
+
+}
+
+#endif // ENABLE(MATHML)
diff --git a/Source/WebCore/mathml/MathMLSelectElement.h b/Source/WebCore/mathml/MathMLSelectElement.h
new file mode 100644 (file)
index 0000000..6e04fa6
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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 MathMLSelectElement_h
+#define MathMLSelectElement_h
+
+#if ENABLE(MATHML)
+#include "MathMLInlineContainerElement.h"
+
+namespace WebCore {
+
+class MathMLSelectElement FINAL : public MathMLInlineContainerElement {
+public:
+    static PassRefPtr<MathMLSelectElement> create(const QualifiedName& tagName, Document&);
+
+private:
+    MathMLSelectElement(const QualifiedName& tagName, Document&);
+    virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
+
+    virtual bool childShouldCreateRenderer(const Node&) const OVERRIDE;
+
+    virtual void finishParsingChildren() OVERRIDE;
+    virtual void childrenChanged(const ChildChange&) OVERRIDE;
+    virtual void attributeChanged(const QualifiedName&, const AtomicString&, AttributeModificationReason = ModifiedDirectly) OVERRIDE;
+
+    void updateSelectedChild();
+    Element* m_selectedChild;
+};
+
+}
+
+#endif // ENABLE(MATHML)
+#endif // MathMLSelectElement_h
index 1a48f47..73ac8be 100644 (file)
@@ -3,6 +3,7 @@ namespaceURI="http://www.w3.org/1998/Math/MathML"
 guardFactoryWith="ENABLE(MATHML)"
 attrsNullNamespace
 
+actiontype
 alttext
 background
 close
@@ -26,6 +27,7 @@ mathvariant
 numalign
 open
 rowspan
+selection
 separators
 stretchy
 subscriptshift
index 89f40e3..b400856 100644 (file)
@@ -3,6 +3,9 @@ namespaceURI="http://www.w3.org/1998/Math/MathML"
 guardFactoryWith="ENABLE(MATHML)"
 fallbackInterfaceName="MathMLElement"
 
+annotation interfaceName=MathMLTextElement
+annotation-xml interfaceName=MathMLInlineContainerElement
+maction interfaceName=MathMLSelectElement
 math
 mfrac interfaceName=MathMLInlineContainerElement
 mfenced interfaceName=MathMLInlineContainerElement
@@ -27,10 +30,10 @@ mtd interfaceName=MathMLElement
 mmultiscripts interfaceName=MathMLInlineContainerElement
 mprescripts interfaceName=MathMLInlineContainerElement
 none interfaceName=MathMLInlineContainerElement
+semantics interfaceName=MathMLSelectElement
 
 #if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
 ms
 mglyph
 malignmark
-annotation-xml
 #endif