<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161430] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161430">161430</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-07 09:49:04 -0800 (Tue, 07 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add Support for the semantics element.
https://bugs.webkit.org/show_bug.cgi?id=100626

Source/WebCore:

Patch by Frédéric Wang &lt;fred.wang@free.fr&gt; on 2014-01-07
Reviewed by Chris Fleizach.

Tests: mathml/presentation/semantics-2.html
       mathml/presentation/semantics-3.html
       mathml/presentation/semantics-4.html

This provides a complete support for the semantics element. When the first child is a content MathML, an annotation can be selected and displayed. The selection algorithm is identical to Gecko's one. The recognized annotations are text (e.g. LaTeX), presentation MathML, SVG and HTML.

* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::childShouldCreateRenderer):
(WebCore::MathMLElement::attributeChanged):
(WebCore::MathMLElement::isPresentationMathML):
* mathml/MathMLElement.h:
(WebCore::MathMLElement::isMathMLToken):
(WebCore::MathMLElement::isSemanticAnnotation):
(WebCore::MathMLElement::isPresentationMathML):
(WebCore::MathMLElement::updateSelectedChild):
* mathml/MathMLInlineContainerElement.h:
* mathml/MathMLSelectElement.cpp:
(WebCore::MathMLSelectElement::getSelectedActionChildAndIndex):
(WebCore::MathMLSelectElement::getSelectedActionChild):
(WebCore::MathMLSelectElement::getSelectedSemanticsChild):
(WebCore::MathMLSelectElement::updateSelectedChild):
(WebCore::MathMLSelectElement::toggle):
* mathml/MathMLSelectElement.h:
* mathml/MathMLTextElement.h:
* mathml/mathattrs.in:
* mathml/mathtags.in:

LayoutTests:

Patch by Frédéric Wang &lt;fred.wang@free.fr&gt; on 2014-01-07
Reviewed by Chris Fleizach.

* TestExpectations:
* mathml/presentation/semantics-2-expected.html: Added.
* mathml/presentation/semantics-2.html: Added.
* mathml/presentation/semantics-3-expected.html: Added.
* mathml/presentation/semantics-3.html: Added.
* mathml/presentation/semantics-4-expected.html: Added.
* mathml/presentation/semantics-4.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementcpp">trunk/Source/WebCore/mathml/MathMLElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLElementh">trunk/Source/WebCore/mathml/MathMLElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLInlineContainerElementh">trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLSelectElementcpp">trunk/Source/WebCore/mathml/MathMLSelectElement.cpp</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLSelectElementh">trunk/Source/WebCore/mathml/MathMLSelectElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlMathMLTextElementh">trunk/Source/WebCore/mathml/MathMLTextElement.h</a></li>
<li><a href="#trunkSourceWebCoremathmlmathattrsin">trunk/Source/WebCore/mathml/mathattrs.in</a></li>
<li><a href="#trunkSourceWebCoremathmlmathtagsin">trunk/Source/WebCore/mathml/mathtags.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlpresentationsemantics2expectedhtml">trunk/LayoutTests/mathml/presentation/semantics-2-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationsemantics2html">trunk/LayoutTests/mathml/presentation/semantics-2.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationsemantics3expectedhtml">trunk/LayoutTests/mathml/presentation/semantics-3-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationsemantics3html">trunk/LayoutTests/mathml/presentation/semantics-3.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationsemantics4expectedhtml">trunk/LayoutTests/mathml/presentation/semantics-4-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationsemantics4html">trunk/LayoutTests/mathml/presentation/semantics-4.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/LayoutTests/ChangeLog        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-01-07  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        Add Support for the semantics element.
+        https://bugs.webkit.org/show_bug.cgi?id=100626
+
+        Reviewed by Chris Fleizach.
+
+        * TestExpectations:
+        * mathml/presentation/semantics-2-expected.html: Added.
+        * mathml/presentation/semantics-2.html: Added.
+        * mathml/presentation/semantics-3-expected.html: Added.
+        * mathml/presentation/semantics-3.html: Added.
+        * mathml/presentation/semantics-4-expected.html: Added.
+        * mathml/presentation/semantics-4.html: Added.
+
</ins><span class="cx"> 2014-01-07  Manuel Rego Casasnovas  &lt;rego@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] fast/repaint/repaint-regions-overflow.html is failing
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/LayoutTests/TestExpectations        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -21,9 +21,6 @@
</span><span class="cx"> webkit.org/b/57700  mathml/presentation/row.xhtml [ Failure ]
</span><span class="cx"> webkit.org/b/57700  mathml/presentation/mo.xhtml [ Failure ]
</span><span class="cx"> 
</span><del>-# MathML regression with foreign objects
-webkit.org/b/124128 mathml/presentation/semantics.html [ Skip ]
-
</del><span class="cx"> # These conformace tests are no longer in sync with the latest specification
</span><span class="cx"> # and expect compareDocumentPosition() to return:
</span><span class="cx"> # DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_DISCONNECTED
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationsemantics2expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/semantics-2-expected.html (0 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/semantics-2-expected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-2-expected.html        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Semantics&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+  &lt;p&gt;presentation MathML (no annotations): &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;presentation MathML&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;content MathML (no annotations): &lt;math&gt;&lt;maction actiontype=&quot;toggle&quot;&gt;&lt;csymbol&gt;content MathML&lt;/csymbol&gt;&lt;/maction&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;presentation MathML ; annotation: &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;presentation MathML&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;presentation MathML ; annotation-xml: &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;presentation MathML&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;content MathML ; annotation: &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;annotation&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;content MathML ; annotation-xml: &lt;math&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mtext&gt;annotation-xml&lt;/mtext&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationsemantics2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/semantics-2.html (0 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/semantics-2.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-2.html        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Semantics&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+
+  &lt;!-- No annotations: the first child is displayed --&gt;
+  &lt;p&gt;presentation MathML (no annotations): &lt;math&gt;&lt;semantics&gt;&lt;mtext&gt;presentation MathML&lt;/mtext&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;content MathML (no annotations): &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;content MathML&lt;/csymbol&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+
+  &lt;!-- Presentation MathML: the child is displayed --&gt;
+  &lt;p&gt;presentation MathML ; annotation: &lt;math&gt;&lt;semantics&gt;&lt;mtext&gt;presentation MathML&lt;/mtext&gt;&lt;annotation&gt;annotation&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;presentation MathML ; annotation-xml: &lt;math&gt;&lt;semantics&gt;&lt;mtext&gt;presentation MathML&lt;/mtext&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;annotation-xml&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+
+  &lt;!-- Content MathML: the annotation is displayed --&gt;
+  &lt;p&gt;content MathML ; annotation: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;content MathML&lt;/csymbol&gt;&lt;annotation&gt;annotation&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;content MathML ; annotation-xml: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;annotation-xml&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationsemantics3expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/semantics-3-expected.html (0 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/semantics-3-expected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-3-expected.html        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Semantics&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+  &lt;p&gt;annotation 1: &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;annotation&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation 2: &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;\sin x + 5&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation 3: &lt;math&gt;&lt;mrow&gt;&lt;mtext&gt;annotation&lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+
+  &lt;p&gt;annotation-xml 1: &lt;math&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mtext&gt;application/mathml-presentation+xml&lt;/mtext&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 2: &lt;math&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mtext&gt;MathML-Presentation&lt;/mtext&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 3: &lt;math&gt;&lt;semantics&gt;&lt;annotation-xml encoding=&quot;image/svg+xml&quot;&gt;&lt;svg width=&quot;20px&quot; height=&quot;20px&quot;&gt;&lt;rect width=&quot;20px&quot; height=&quot;20px&quot; fill=&quot;red&quot; stroke=&quot;none&quot;/&gt;&lt;/svg&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 4: &lt;math&gt;&lt;semantics&gt;&lt;annotation-xml encoding=&quot;image/svg+xml&quot;&gt;&lt;svg width=&quot;20px&quot; height=&quot;20px&quot;&gt;&lt;rect width=&quot;20px&quot; height=&quot;20px&quot; fill=&quot;red&quot; stroke=&quot;none&quot;/&gt;&lt;/svg&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 5: &lt;math&gt;&lt;semantics&gt;&lt;annotation-xml encoding=&quot;application/xhtml+xml&quot;&gt;&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;&lt;title&gt;application/xhtml+xml&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;application/xhtml+xml&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&lt;/annotation-xml&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 6: &lt;math&gt;&lt;semantics&gt;&lt;annotation-xml encoding=&quot;application/xhtml+xml&quot;&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;text/html&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;text/html&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 7: &lt;math&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mtext&gt;annotation-xml&lt;/mtext&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationsemantics3html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/semantics-3.html (0 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/semantics-3.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-3.html        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Semantics&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+
+  &lt;!-- These &lt;semantics&gt; elements are content MathML expressions with various annotations. Only the first recognized annotation should be displayed. WebKit recognizes the following annotations:
+   - Any &lt;annotation&gt; element without src attribute.
+   - An &lt;annotation-xml&gt; element without src attribute and with one of the encoding among &quot;application/mathml-presentation+xml&quot;, &quot;MathML-Presentation&quot;, &quot;image/svg+xml&quot;, &quot;SVG1.1&quot;, &quot;application/xhtml+xml&quot; and &quot;text/html&quot;.
+   --&gt;
+
+  &lt;p&gt;annotation 1: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation&gt;annotation&lt;/annotation&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation 2: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;\sin x + 5&lt;/annotation&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation 3: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation src=&quot;external-resource&quot;&gt;error&lt;/annotation&gt;&lt;annotation&gt;annotation&lt;/annotation&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+
+  &lt;p&gt;annotation-xml 1: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;application/mathml-presentation+xml&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 2: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;MathML-Presentation&quot;&gt;&lt;mtext&gt;MathML-Presentation&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 3: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;image/svg+xml&quot;&gt;&lt;svg width=&quot;20px&quot; height=&quot;20px&quot;&gt;&lt;rect width=&quot;20px&quot; height=&quot;20px&quot; fill=&quot;red&quot; stroke=&quot;none&quot;/&gt;&lt;/svg&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 4: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;SVG1.1&quot;&gt;&lt;svg width=&quot;20px&quot; height=&quot;20px&quot;&gt;&lt;rect width=&quot;20px&quot; height=&quot;20px&quot; fill=&quot;red&quot; stroke=&quot;none&quot;/&gt;&lt;/svg&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 5: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;application/xhtml+xml&quot;&gt;&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;&lt;title&gt;application/xhtml+xml&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;application/xhtml+xml&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 6: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;text/html&quot;&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;text/html&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;text/html&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+  &lt;p&gt;annotation-xml 7: &lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml encoding=&quot;unknown&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml+xml&quot;&gt;&lt;mtext&gt;error&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation-xml encoding=&quot;application/mathml-presentation+xml&quot;&gt;&lt;mtext&gt;annotation-xml&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;error&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationsemantics4expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/semantics-4-expected.html (0 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/semantics-4-expected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-4-expected.html        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Semantics&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body&gt;
+
+  &lt;p&gt;&lt;math&gt;&lt;mrow&gt;&lt;mrow id=&quot;a&quot;&gt;&lt;mtext&gt;PASS&lt;/mtext&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationsemantics4html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/semantics-4.html (0 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/semantics-4.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/semantics-4.html        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+  &lt;title&gt;Semantics&lt;/title&gt;
+&lt;/head&gt;
+
+&lt;body onload=&quot;document.getElementById('a').setAttribute('encoding', 'MathML-Presentation')&quot;&gt;
+
+  &lt;!-- This test verifies that setting the encoding dynamically updates the selected annotation. This should render the same as the static reference. --&gt;
+
+  &lt;p&gt;&lt;math&gt;&lt;semantics&gt;&lt;csymbol&gt;Content MathML&lt;/csymbol&gt;&lt;annotation-xml id=&quot;a&quot;&gt;&lt;mtext&gt;PASS&lt;/mtext&gt;&lt;/annotation-xml&gt;&lt;annotation&gt;FAIL&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/ChangeLog        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-01-07  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        Add Support for the semantics element.
+        https://bugs.webkit.org/show_bug.cgi?id=100626
+
+
+        Reviewed by Chris Fleizach.
+
+        Tests: mathml/presentation/semantics-2.html
+               mathml/presentation/semantics-3.html
+               mathml/presentation/semantics-4.html
+
+        This provides a complete support for the semantics element. When the first child is a content MathML, an annotation can be selected and displayed. The selection algorithm is identical to Gecko's one. The recognized annotations are text (e.g. LaTeX), presentation MathML, SVG and HTML.
+
+        * mathml/MathMLElement.cpp:
+        (WebCore::MathMLElement::childShouldCreateRenderer):
+        (WebCore::MathMLElement::attributeChanged):
+        (WebCore::MathMLElement::isPresentationMathML):
+        * mathml/MathMLElement.h:
+        (WebCore::MathMLElement::isMathMLToken):
+        (WebCore::MathMLElement::isSemanticAnnotation):
+        (WebCore::MathMLElement::isPresentationMathML):
+        (WebCore::MathMLElement::updateSelectedChild):
+        * mathml/MathMLInlineContainerElement.h:
+        * mathml/MathMLSelectElement.cpp:
+        (WebCore::MathMLSelectElement::getSelectedActionChildAndIndex):
+        (WebCore::MathMLSelectElement::getSelectedActionChild):
+        (WebCore::MathMLSelectElement::getSelectedSemanticsChild):
+        (WebCore::MathMLSelectElement::updateSelectedChild):
+        (WebCore::MathMLSelectElement::toggle):
+        * mathml/MathMLSelectElement.h:
+        * mathml/MathMLTextElement.h:
+        * mathml/mathattrs.in:
+        * mathml/mathtags.in:
+
</ins><span class="cx"> 2014-01-07  Pascal Jacquemart  &lt;p.jacquemart@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix compilation issue with GLES2 after http://webkit.org/b/126548
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.cpp        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -48,6 +48,11 @@
</span><span class="cx">     return adoptRef(new MathMLElement(tagName, document));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MathMLElement::isPresentationMathML() const
+{
+    return hasTagName(MathMLNames::mtrTag) || hasTagName(MathMLNames::mtdTag) || hasTagName(MathMLNames::maligngroupTag) || hasTagName(MathMLNames::malignmarkTag) || hasTagName(MathMLNames::mencloseTag) || hasTagName(MathMLNames::mglyphTag) || hasTagName(MathMLNames::mlabeledtrTag) || hasTagName(MathMLNames::mlongdivTag) || hasTagName(MathMLNames::mpaddedTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mscarriesTag) || hasTagName(MathMLNames::mscarryTag) || hasTagName(MathMLNames::msgroupTag) || hasTagName(MathMLNames::mslineTag) || hasTagName(MathMLNames::msrowTag) || hasTagName(MathMLNames::mstackTag);
+}
+
</ins><span class="cx"> int MathMLElement::colSpan() const
</span><span class="cx"> {
</span><span class="cx">     if (!hasTagName(mtdTag))
</span><span class="lines">@@ -118,13 +123,23 @@
</span><span class="cx"> 
</span><span class="cx"> bool MathMLElement::childShouldCreateRenderer(const Node&amp; child) const
</span><span class="cx"> {
</span><ins>+    if (hasTagName(annotationTag))
+        return child.isTextNode();
+    if (hasTagName(annotation_xmlTag))
+        return StyledElement::childShouldCreateRenderer(child);
+
</ins><span class="cx">     // Only create renderers for MathML elements or text. MathML prohibits non-MathML markup inside a &lt;math&gt; element.
</span><span class="cx">     return child.isTextNode() || child.isMathMLElement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MathMLElement::isMathMLToken() const
</del><ins>+void MathMLElement::attributeChanged(const QualifiedName&amp; name, const AtomicString&amp; newValue, AttributeModificationReason reason)
</ins><span class="cx"> {
</span><del>-    return hasTagName(miTag) || hasTagName(mnTag) || hasTagName(moTag) || hasTagName(msTag) || hasTagName(mtextTag);
</del><ins>+    if (isSemanticAnnotation() &amp;&amp; (name == MathMLNames::srcAttr || name == MathMLNames::encodingAttr)) {
+        Element* parent = parentElement();
+        if (parent &amp;&amp; parent-&gt;isMathMLElement() &amp;&amp; parent-&gt;hasTagName(semanticsTag))
+            toMathMLElement(parent)-&gt;updateSelectedChild();
+    }
+    StyledElement::attributeChanged(name, newValue, reason);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLElement.h (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLElement.h        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/MathMLElement.h        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MATHML)
</span><span class="cx"> 
</span><ins>+#include &quot;MathMLNames.h&quot;
</ins><span class="cx"> #include &quot;StyledElement.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -41,17 +42,30 @@
</span><span class="cx">     int colSpan() const;
</span><span class="cx">     int rowSpan() const;
</span><span class="cx"> 
</span><ins>+    bool isMathMLToken() const
+    {
+        return hasTagName(MathMLNames::miTag) || hasTagName(MathMLNames::mnTag) || hasTagName(MathMLNames::moTag) || hasTagName(MathMLNames::msTag) || hasTagName(MathMLNames::mtextTag);
+    }
+
+    bool isSemanticAnnotation() const
+    {
+        return hasTagName(MathMLNames::annotationTag) || hasTagName(MathMLNames::annotation_xmlTag);
+    }
+
+    virtual bool isPresentationMathML() const;
+
</ins><span class="cx"> protected:
</span><span class="cx">     MathMLElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span><span class="cx">     virtual void parseAttribute(const QualifiedName&amp;, const AtomicString&amp;) OVERRIDE;
</span><span class="cx">     virtual bool childShouldCreateRenderer(const Node&amp;) const OVERRIDE;
</span><ins>+    virtual void attributeChanged(const QualifiedName&amp;, const AtomicString&amp; newValue, AttributeModificationReason) OVERRIDE;
</ins><span class="cx"> 
</span><span class="cx"> private:    
</span><span class="cx">     virtual bool isPresentationAttribute(const QualifiedName&amp;) const OVERRIDE;
</span><span class="cx">     virtual void collectStyleForPresentationAttribute(const QualifiedName&amp;, const AtomicString&amp;, MutableStyleProperties&amp;) OVERRIDE;
</span><span class="cx"> 
</span><del>-    inline bool isMathMLToken() const;
</del><ins>+    virtual void updateSelectedChild() { };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> void isMathMLElement(const MathMLElement&amp;); // Catch unnecessary runtime check of type known at compile time.
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLInlineContainerElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -36,6 +36,8 @@
</span><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;MathMLInlineContainerElement&gt; create(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span><ins>+    virtual bool isPresentationMathML() const OVERRIDE { return true; }
+
</ins><span class="cx"> protected:
</span><span class="cx">     MathMLInlineContainerElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLSelectElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.cpp (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLSelectElement.cpp        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.cpp        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -77,8 +77,10 @@
</span><span class="cx">     MathMLInlineContainerElement::attributeChanged(name, newValue, reason);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int MathMLSelectElement::getSelectedChildAndIndex(Element*&amp; selectedChild)
</del><ins>+int MathMLSelectElement::getSelectedActionChildAndIndex(Element*&amp; selectedChild)
</ins><span class="cx"> {
</span><ins>+    ASSERT(hasLocalName(actionTag));
+
</ins><span class="cx">     // We &quot;round up or down to the closest allowable value&quot; of the selection attribute, as suggested by the MathML specification.
</span><span class="cx">     selectedChild = firstElementChild();
</span><span class="cx">     if (!selectedChild)
</span><span class="lines">@@ -96,30 +98,85 @@
</span><span class="cx">     return i;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MathMLSelectElement::updateSelectedChild()
</del><ins>+Element* MathMLSelectElement::getSelectedActionChild()
</ins><span class="cx"> {
</span><del>-    Element* newSelectedChild = firstElementChild();
</del><ins>+    ASSERT(hasLocalName(actionTag));
</ins><span class="cx"> 
</span><del>-    if (newSelectedChild) {
-        if (hasLocalName(mactionTag)) {
-            // The value of the actiontype attribute is case-sensitive.
-            const AtomicString&amp; actiontype = fastGetAttribute(MathMLNames::actiontypeAttr);
-            if (actiontype == &quot;statusline&quot;)
-                // FIXME: implement user interaction for the &quot;statusline&quot; action type (http://wkbug/124922).
-                { }
-            else if (actiontype == &quot;tooltip&quot;)
-                // FIXME: implement user interaction for the &quot;tooltip&quot; action type (http://wkbug/124921).
-                { }
-            else {
-                // For the &quot;toggle&quot; action type or any unknown action type, we rely on the value of the selection attribute to determine the visible child.
-                getSelectedChildAndIndex(newSelectedChild);
-            }
-        } else {
-            ASSERT(hasLocalName(semanticsTag));
-            // FIXME: implement Gecko's selection algorithm for &lt;semantics&gt; (http://wkbug/100626).
</del><ins>+    Element* child = firstElementChild();
+    if (!child)
+        return child;
+
+    // The value of the actiontype attribute is case-sensitive.
+    const AtomicString&amp; actiontype = fastGetAttribute(MathMLNames::actiontypeAttr);
+    if (actiontype == &quot;statusline&quot;)
+        // FIXME: implement user interaction for the &quot;statusline&quot; action type (http://wkbug/124922).
+        { }
+    else if (actiontype == &quot;tooltip&quot;)
+        // FIXME: implement user interaction for the &quot;tooltip&quot; action type (http://wkbug/124921).
+        { }
+    else {
+        // For the &quot;toggle&quot; action type or any unknown action type, we rely on the value of the selection attribute to determine the visible child.
+        getSelectedActionChildAndIndex(child);
+    }
+
+    return child;
+}
+
+Element* MathMLSelectElement::getSelectedSemanticsChild()
+{
+    ASSERT(hasLocalName(semanticsTag));
+
+    Element* child = firstElementChild();
+    if (!child)
+        return child;
+
+    if (!child-&gt;isMathMLElement() || !toMathMLElement(child)-&gt;isPresentationMathML()) { 
+        // The first child is not a presentation MathML element. Hence we move to the second child and start searching an annotation child that could be displayed.
+        child = child-&gt;nextElementSibling();
+    } else if (!toMathMLElement(child)-&gt;isSemanticAnnotation()) {
+        // The first child is a presentation MathML but not an annotation, so we can just display it.
+        return child;
+    }
+    // Otherwise, the first child is an &lt;annotation&gt; or &lt;annotation-xml&gt; element. This is invalid, but some people use this syntax so we take care of this case too and start the search from this first child.
+
+    for ( ; child; child = child-&gt;nextElementSibling()) {
+        if (!child-&gt;isMathMLElement())
+            continue;
+
+        if (child-&gt;hasLocalName(MathMLNames::annotationTag)) {
+            // If the &lt;annotation&gt; element has an src attribute then it is a reference to arbitrary binary data and it is not clear whether we can display it. Hence we just ignore the annotation.
+            if (child-&gt;hasAttribute(MathMLNames::srcAttr))
+                continue;
+            // Otherwise, we assume it is a text annotation that can always be displayed and we stop here.
+            return child;
</ins><span class="cx">         }
</span><ins>+
+        if (child-&gt;hasLocalName(MathMLNames::annotation_xmlTag)) {
+            // If the &lt;annotation-xml&gt; element has an src attribute then it is a reference to arbitrary binary data and it is not clear whether we can display it. Hence we just ignore the annotation.
+            if (child-&gt;hasAttribute(MathMLNames::srcAttr))
+                continue;
+            // If the &lt;annotation-xml&gt; element has an encoding attribute describing presentation MathML, SVG or HTML we assume the content can be displayed and we stop here. We recognize the following encoding values:
+            //
+            // - &quot;MathML-Presentation&quot;, which is mentioned in the MathML 3 recommendation.
+            // - &quot;SVG1.1&quot; which is mentioned in the W3C note.
+            //   http://www.w3.org/Math/Documents/Notes/graphics.xml
+            // - Other MIME Content-Types for SVG and HTML.
+            //
+            // We exclude &quot;application/mathml+xml&quot; which is ambiguous about whether it is Presentation or Content MathML. Authors must use a more explicit encoding value.
+            const AtomicString&amp; value = child-&gt;fastGetAttribute(MathMLNames::encodingAttr);
+            if (value == &quot;application/mathml-presentation+xml&quot; || value == &quot;MathML-Presentation&quot; || value == &quot;image/svg+xml&quot; || value == &quot;SVG1.1&quot; || value == &quot;application/xhtml+xml&quot; || value == &quot;text/html&quot;)
+                return child;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // We fallback to the first child.
+    return firstElementChild();
+}
+
+void MathMLSelectElement::updateSelectedChild()
+{
+    Element* newSelectedChild = hasLocalName(mactionTag) ? getSelectedActionChild() : getSelectedSemanticsChild();
+
</ins><span class="cx">     if (m_selectedChild == newSelectedChild)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -153,7 +210,7 @@
</span><span class="cx">     // Select the successor of the currently selected child
</span><span class="cx">     // or the first child if the currently selected child is the last.
</span><span class="cx">     Element* selectedChild;
</span><del>-    int newSelectedChildIndex = getSelectedChildAndIndex(selectedChild) + 1;
</del><ins>+    int newSelectedChildIndex = getSelectedActionChildAndIndex(selectedChild) + 1;
</ins><span class="cx">     if (!selectedChild || !selectedChild-&gt;nextElementSibling())
</span><span class="cx">         newSelectedChildIndex = 1;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLSelectElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.h (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLSelectElement.h        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.h        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -48,9 +48,11 @@
</span><span class="cx">     virtual bool willRespondToMouseClickEvents() OVERRIDE;
</span><span class="cx"> 
</span><span class="cx">     void toggle();
</span><del>-    int getSelectedChildAndIndex(Element*&amp; selectedChild);
</del><ins>+    int getSelectedActionChildAndIndex(Element*&amp; selectedChild);
+    Element* getSelectedActionChild();
+    Element* getSelectedSemanticsChild();
</ins><span class="cx"> 
</span><del>-    void updateSelectedChild();
</del><ins>+    void updateSelectedChild() OVERRIDE;
</ins><span class="cx">     Element* m_selectedChild;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLTextElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLTextElement.h (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLTextElement.h        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.h        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -37,6 +37,8 @@
</span><span class="cx">     static PassRefPtr&lt;MathMLTextElement&gt; create(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx">     virtual void didAttachRenderers() OVERRIDE;
</span><span class="cx"> 
</span><ins>+    virtual bool isPresentationMathML() const OVERRIDE { return true; }
+
</ins><span class="cx"> private:
</span><span class="cx">     MathMLTextElement(const QualifiedName&amp; tagName, Document&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlmathattrsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/mathattrs.in (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/mathattrs.in        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/mathattrs.in        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> rowspan
</span><span class="cx"> selection
</span><span class="cx"> separators
</span><ins>+src
</ins><span class="cx"> stretchy
</span><span class="cx"> subscriptshift
</span><span class="cx"> superscriptshift
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlmathtagsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/mathtags.in (161429 => 161430)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/mathtags.in        2014-01-07 17:39:52 UTC (rev 161429)
+++ trunk/Source/WebCore/mathml/mathtags.in        2014-01-07 17:49:04 UTC (rev 161430)
</span><span class="lines">@@ -34,8 +34,18 @@
</span><span class="cx"> none interfaceName=MathMLInlineContainerElement
</span><span class="cx"> semantics interfaceName=MathMLSelectElement
</span><span class="cx"> 
</span><del>-#if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
-ms
-mglyph
-malignmark
-#endif
</del><ins>+# These presentation MathML elements are not implemented.
+maligngroup interfaceName=MathMLElement
+malignmark interfaceName=MathMLElement
+menclose interfaceName=MathMLElement # http://wkbug/85729
+mglyph interfaceName=MathMLElement
+mlabeledtr interfaceName=MathMLElement # http://wkbug/85732
+mlongdiv interfaceName=MathMLElement
+mpadded interfaceName=MathMLElement # http://wkbug/85730
+ms interfaceName=MathMLElement # http://wkbug/125859
+mscarries interfaceName=MathMLElement
+mscarry interfaceName=MathMLElement
+msgroup interfaceName=MathMLElement
+msline interfaceName=MathMLElement
+msrow interfaceName=MathMLElement
+mstack interfaceName=MathMLElement
</ins></span></pre>
</div>
</div>

</body>
</html>