<!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>[160631] 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/160631">160631</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-15 22:53:38 -0800 (Sun, 15 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for maction@toggle
https://bugs.webkit.org/show_bug.cgi?id=120059

Patch by Frédéric Wang &lt;fred.wang@free.fr&gt; on 2013-12-15
Reviewed by Chris Fleizach.

Source/WebCore:

Test: mathml/presentation/maction-toggle.html

* mathml/MathMLSelectElement.cpp:
(WebCore::MathMLSelectElement::getSelectedChildAndIndex):
(WebCore::MathMLSelectElement::updateSelectedChild):
(WebCore::MathMLSelectElement::defaultEventHandler):
(WebCore::MathMLSelectElement::willRespondToMouseClickEvents):
(WebCore::MathMLSelectElement::toggle):
* mathml/MathMLSelectElement.h:

LayoutTests:

* mathml/presentation/maction-toggle-expected.html: Added.
* mathml/presentation/maction-toggle.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmathmlpresentationmactiontoggleexpectedhtml">trunk/LayoutTests/mathml/presentation/maction-toggle-expected.html</a></li>
<li><a href="#trunkLayoutTestsmathmlpresentationmactiontogglehtml">trunk/LayoutTests/mathml/presentation/maction-toggle.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (160630 => 160631)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-12-16 06:39:18 UTC (rev 160630)
+++ trunk/LayoutTests/ChangeLog        2013-12-16 06:53:38 UTC (rev 160631)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2013-12-15  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        Add support for maction@toggle
+        https://bugs.webkit.org/show_bug.cgi?id=120059
+
+        Reviewed by Chris Fleizach.
+
+        * mathml/presentation/maction-toggle-expected.html: Added.
+        * mathml/presentation/maction-toggle.html: Added.
+
</ins><span class="cx"> 2013-12-15  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION: 2x regression on Dromaeo DOM query tests
</span></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationmactiontoggleexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/maction-toggle-expected.html (0 => 160631)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/maction-toggle-expected.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/maction-toggle-expected.html        2013-12-16 06:53:38 UTC (rev 160631)
</span><span class="lines">@@ -0,0 +1,111 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;maction toggle&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+
+    &lt;!-- selection=&quot;1&quot; (default) ; three clicks --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+    &lt;!-- selection=&quot;2&quot; ; one click --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+    &lt;!-- selection=&quot;4&quot; (last child) ; one click --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Other edge cases --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/mrow&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Nested &lt;maction&gt; elements ; bubble = false --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Nested &lt;maction&gt; elements ; bubble = true --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Prevent default --&gt;
+    &lt;math&gt;
+      &lt;mrow&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/mrow&gt;
+    &lt;/math&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmathmlpresentationmactiontogglehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/mathml/presentation/maction-toggle.html (0 => 160631)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/mathml/presentation/maction-toggle.html                                (rev 0)
+++ trunk/LayoutTests/mathml/presentation/maction-toggle.html        2013-12-16 06:53:38 UTC (rev 160631)
</span><span class="lines">@@ -0,0 +1,202 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;maction toggle&lt;/title&gt;
+    &lt;script type=&quot;text/javascript&quot;&gt;
+      function click(id, bubble, preventDefault)
+      {
+        var event = new MouseEvent('click', {bubbles: bubble, cancelable: true});
+        if (preventDefault)
+          event.preventDefault();
+        document.getElementById(id).dispatchEvent(event);
+      }
+      function test()
+      {
+        // selection=1 ; ([1] 2 3 4)
+        // After three clicks, selection=4: (1 2 3 [4])
+        click('m1'); click('m1'); click('m1');
+
+        // selection=2 ; (1 [2] 3 4)
+        // After one click, selection=3: (1 2 [3] 4)
+        click('m2');
+
+        // selection=4 ; (1 2 3 [4])
+        // After one click, selection=1: ([1] 2 3 4)
+        click('m3');
+
+        // Other edge cases
+        for (var i = 1; i &lt;= 13; i++)
+          click('e'+i);
+
+        // Nested maction elements, bubble = false ; ([([1] 2 3)] 4 5)
+        // After one click on the inner maction: ([(1 [2] 3)] 4 5)
+        click('m4', false);
+
+        // Nested maction elements, bubble = true ; ([([1] 2 3)] 4 5)
+        // After one click on the inner maction: ((1 [2] 3) [4] 5)
+        click('m5', true);
+
+        // Prevent default ; ([1] 2 3)
+        // After one click on the inner maction: ([1] 2 3)
+        click('m6', false, true);
+      }
+    &lt;/script&gt;
+  &lt;/head&gt;
+  &lt;body onload=&quot;test()&quot;&gt;
+
+    &lt;!-- This test verifies the effect of mouse clicks on &lt;maction actiontype=&quot;toggle&quot;&gt; elements. --&gt;
+
+    &lt;!-- selection=&quot;1&quot; (default) ; three clicks --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; id=&quot;m1&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+    &lt;!-- selection=&quot;2&quot; ; one click --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;2&quot; id=&quot;m2&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+    &lt;!-- selection=&quot;4&quot; (last child) ; one click --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;4&quot; id=&quot;m3&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Other edge cases --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; id=&quot;e1&quot;&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; id=&quot;e2&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;-10&quot; id=&quot;e3&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;-1&quot; id=&quot;e4&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;0&quot; id=&quot;e5&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;4&quot; id=&quot;e6&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;10&quot; id=&quot;e7&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;&amp;#x20;&amp;#x9;&amp;#xD;&amp;#xA;2&amp;#x20;&amp;#x9;&amp;#xD;&amp;#xA;&quot; id=&quot;e8&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;TWO&quot; id=&quot;e9&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+    &lt;math&gt;
+      &lt;!-- These values are limits for 32 bits signed integers.
+           The maction element will convert them to 1 and 3 respectively. --&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;-65536&quot; id=&quot;e10&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;65535&quot; id=&quot;e11&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+      &lt;!-- These values are -1 and +1 for 32 or 64 bits signed integers.
+           The maction element will convert both of them to 1. --&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;-18446744073709551617&quot; id=&quot;e12&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+      &lt;maction actiontype=&quot;toggle&quot; selection=&quot;18446744073709551617&quot; id=&quot;e13&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Nested &lt;maction&gt; elements ; bubble = false --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot;&gt;
+        &lt;maction actiontype=&quot;toggle&quot; id=&quot;m4&quot;&gt;
+          &lt;mn&gt;1&lt;/mn&gt;
+          &lt;mn&gt;2&lt;/mn&gt;
+          &lt;mn&gt;3&lt;/mn&gt;
+        &lt;/maction&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+        &lt;mn&gt;5&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Nested &lt;maction&gt; elements ; bubble = true --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot;&gt;
+        &lt;maction actiontype=&quot;toggle&quot; id=&quot;m5&quot;&gt;
+          &lt;mn&gt;1&lt;/mn&gt;
+          &lt;mn&gt;2&lt;/mn&gt;
+          &lt;mn&gt;3&lt;/mn&gt;
+        &lt;/maction&gt;
+        &lt;mn&gt;4&lt;/mn&gt;
+        &lt;mn&gt;5&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+    &lt;!-- Prevent default --&gt;
+    &lt;math&gt;
+      &lt;maction actiontype=&quot;toggle&quot; id=&quot;m6&quot;&gt;
+        &lt;mn&gt;1&lt;/mn&gt;
+        &lt;mn&gt;2&lt;/mn&gt;
+        &lt;mn&gt;3&lt;/mn&gt;
+      &lt;/maction&gt;
+    &lt;/math&gt;
+
+
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160630 => 160631)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-16 06:39:18 UTC (rev 160630)
+++ trunk/Source/WebCore/ChangeLog        2013-12-16 06:53:38 UTC (rev 160631)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2013-12-15  Frédéric Wang  &lt;fred.wang@free.fr&gt;
+
+        Add support for maction@toggle
+        https://bugs.webkit.org/show_bug.cgi?id=120059
+
+        Reviewed by Chris Fleizach.
+
+        Test: mathml/presentation/maction-toggle.html
+
+        * mathml/MathMLSelectElement.cpp:
+        (WebCore::MathMLSelectElement::getSelectedChildAndIndex):
+        (WebCore::MathMLSelectElement::updateSelectedChild):
+        (WebCore::MathMLSelectElement::defaultEventHandler):
+        (WebCore::MathMLSelectElement::willRespondToMouseClickEvents):
+        (WebCore::MathMLSelectElement::toggle):
+        * mathml/MathMLSelectElement.h:
+
</ins><span class="cx"> 2013-12-15  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         More nullptr in RenderElement
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLSelectElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.cpp (160630 => 160631)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLSelectElement.cpp        2013-12-16 06:39:18 UTC (rev 160630)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.cpp        2013-12-16 06:53:38 UTC (rev 160631)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MATHML)
</span><span class="cx"> 
</span><ins>+#include &quot;Event.h&quot;
</ins><span class="cx"> #include &quot;MathMLNames.h&quot;
</span><span class="cx"> #include &quot;RenderMathMLRow.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -76,6 +77,25 @@
</span><span class="cx">     MathMLInlineContainerElement::attributeChanged(name, newValue, reason);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+int MathMLSelectElement::getSelectedChildAndIndex(Element*&amp; selectedChild)
+{
+    // We &quot;round up or down to the closest allowable value&quot; of the selection attribute, as suggested by the MathML specification.
+    selectedChild = firstElementChild();
+    if (!selectedChild)
+        return 1;
+
+    int selection = fastGetAttribute(MathMLNames::selectionAttr).toInt();
+    int i;
+    for (i = 1; i &lt; selection; i++) {
+        Element* nextChild = selectedChild-&gt;nextElementSibling();
+        if (!nextChild)
+            break;
+        selectedChild = nextChild;
+    }
+
+    return i;
+}
+
</ins><span class="cx"> void MathMLSelectElement::updateSelectedChild()
</span><span class="cx"> {
</span><span class="cx">     Element* newSelectedChild = firstElementChild();
</span><span class="lines">@@ -91,15 +111,8 @@
</span><span class="cx">                 // FIXME: implement user interaction for the &quot;tooltip&quot; action type (http://wkbug/124921).
</span><span class="cx">                 { }
</span><span class="cx">             else {
</span><del>-                // FIXME: implement user interaction for the &quot;toggle&quot; action type (http://wkbug/120059).
</del><span class="cx">                 // 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.
</span><del>-                int selection = fastGetAttribute(MathMLNames::selectionAttr).toInt();
-                for (int i = 1; i &lt; selection; i++) {
-                    Element* nextChild = newSelectedChild-&gt;nextElementSibling();
-                    if (!nextChild)
-                        break;
-                    newSelectedChild = nextChild;
-                }
</del><ins>+                getSelectedChildAndIndex(newSelectedChild);
</ins><span class="cx">             }
</span><span class="cx">         } else {
</span><span class="cx">             ASSERT(hasLocalName(semanticsTag));
</span><span class="lines">@@ -117,6 +130,39 @@
</span><span class="cx">     setNeedsStyleRecalc();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MathMLSelectElement::defaultEventHandler(Event* event)
+{
+    if (event-&gt;type() == eventNames().clickEvent) {
+        if (fastGetAttribute(MathMLNames::actiontypeAttr) == &quot;toggle&quot;) {
+            toggle();
+            return;
+        }
+    }
+
+    MathMLInlineContainerElement::defaultEventHandler(event);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MathMLSelectElement::willRespondToMouseClickEvents()
+{
+    return true;
+}
+
+void MathMLSelectElement::toggle()
+{
+    // We determine the successor of the selected child.
+    // If we reach the end of the child list, we go back to the first child.
+    Element* child = nullptr;
+    int selection = getSelectedChildAndIndex(child);
+    if (!child || !child-&gt;nextElementSibling())
+        selection = 1;
+    else
+        selection++;
+
+    // We update the attribute value of the selection attribute.
+    // This will also call MathMLSelectElement::attributeChanged to update the selected child.
+    setAttribute(MathMLNames::selectionAttr, AtomicString::number(selection));
+}
+
+}
+
</ins><span class="cx"> #endif // ENABLE(MATHML)
</span></span></pre></div>
<a id="trunkSourceWebCoremathmlMathMLSelectElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.h (160630 => 160631)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/mathml/MathMLSelectElement.h        2013-12-16 06:39:18 UTC (rev 160630)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.h        2013-12-16 06:53:38 UTC (rev 160631)
</span><span class="lines">@@ -44,7 +44,12 @@
</span><span class="cx">     virtual void finishParsingChildren() OVERRIDE;
</span><span class="cx">     virtual void childrenChanged(const ChildChange&amp;) OVERRIDE;
</span><span class="cx">     virtual void attributeChanged(const QualifiedName&amp;, const AtomicString&amp;, AttributeModificationReason = ModifiedDirectly) OVERRIDE;
</span><ins>+    virtual void defaultEventHandler(Event*) OVERRIDE;
+    virtual bool willRespondToMouseClickEvents() OVERRIDE;
</ins><span class="cx"> 
</span><ins>+    void toggle();
+    int getSelectedChildAndIndex(Element*&amp; selectedChild);
+
</ins><span class="cx">     void updateSelectedChild();
</span><span class="cx">     Element* m_selectedChild;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>