<!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>[209895] 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/209895">209895</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-12-15 17:29:23 -0800 (Thu, 15 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent
https://bugs.webkit.org/show_bug.cgi?id=165904

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

* web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:

Source/WebCore:

Move 'charCode' / 'keyCode' attributes from UIEvent to KeyboardEvent and add
'which' to KeyboardEvent to match the specification:
- https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent

We keep a 'which' attribute on UIEvent even though the specification does
not say we should because Firefox and Chrome have 'which' on UIEvent still.

Specification:
- 'charCode' / 'keyCode' / 'which' on KeyboardEvent only

Firefox:
- 'charCode' / 'keyCode' on KeyboardEvent only
- 'which' on UIEvent only

Chrome:
- 'charCode' / 'keyCode' / 'which' on KeyboardEvent
- 'which' on UIEvent as well

Old WebKit behavior:
- 'charCode' / 'keyCode' / 'which' on UIEvent only

New WebKit behavior:
- 'charCode' / 'keyCode' / 'which' on KeyboardEvent
- 'which' on UIEvent as well

Our new behavior is identical to Chrome, much closer to the specification,
and closer to Firefox as well.

No new tests, updated / rebaselined existing tests.

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
(WebCore::KeyboardEvent::keyCode):
(WebCore::KeyboardEvent::charCode):
(WebCore::KeyboardEvent::which):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::which):
* dom/UIEvent.cpp:
* dom/UIEvent.h:
* dom/UIEvent.idl:

Source/WebKit/mac:

Update ObjC bindings so they keep building.

* DOM/DOMUIEvent.mm:
(-[DOMUIEvent keyCode]):
(-[DOMUIEvent charCode]):

LayoutTests:

Extend existing testing.

* fast/events/arrow-keys-on-body-expected.txt:
* fast/events/arrow-keys-on-body.html:
* fast/events/key-events-in-input-button-expected.txt:
* fast/events/key-events-in-input-button.html:
* fast/events/key-events-in-input-text-expected.txt:
* fast/events/key-events-in-input-text.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventsarrowkeysonbodyexpectedtxt">trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsarrowkeysonbodyhtml">trunk/LayoutTests/fast/events/arrow-keys-on-body.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsiniteventsexpectedtxt">trunk/LayoutTests/fast/events/init-events-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventskeyeventsininputbuttonexpectedtxt">trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventskeyeventsininputbuttonhtml">trunk/LayoutTests/fast/events/key-events-in-input-button.html</a></li>
<li><a href="#trunkLayoutTestsfasteventskeyeventsininputtextexpectedtxt">trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventskeyeventsininputtexthtml">trunk/LayoutTests/fast/events/key-events-in-input-text.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsscripttestsiniteventsjs">trunk/LayoutTests/fast/events/script-tests/init-events.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomeventsEventsubclassesconstructorsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomKeyboardEventcpp">trunk/Source/WebCore/dom/KeyboardEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomKeyboardEventh">trunk/Source/WebCore/dom/KeyboardEvent.h</a></li>
<li><a href="#trunkSourceWebCoredomKeyboardEventidl">trunk/Source/WebCore/dom/KeyboardEvent.idl</a></li>
<li><a href="#trunkSourceWebCoredomMouseEventcpp">trunk/Source/WebCore/dom/MouseEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomUIEventcpp">trunk/Source/WebCore/dom/UIEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomUIEventh">trunk/Source/WebCore/dom/UIEvent.h</a></li>
<li><a href="#trunkSourceWebCoredomUIEventidl">trunk/Source/WebCore/dom/UIEvent.idl</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacDOMDOMUIEventmm">trunk/Source/WebKit/mac/DOM/DOMUIEvent.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMUIEventcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/ChangeLog        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-12-15  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=165904
+
+        Reviewed by Sam Weinig.
+
+        Extend existing testing.
+
+        * fast/events/arrow-keys-on-body-expected.txt:
+        * fast/events/arrow-keys-on-body.html:
+        * fast/events/key-events-in-input-button-expected.txt:
+        * fast/events/key-events-in-input-button.html:
+        * fast/events/key-events-in-input-text-expected.txt:
+        * fast/events/key-events-in-input-text.html:
+
</ins><span class="cx"> 2016-12-15  Megan Gardner  &lt;megan_gardner@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add coordinate space to event streams and streamline tests
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsarrowkeysonbodyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> 
</span><span class="cx"> To test manually, press arrow keys and verify that no keypress events are logged.
</span><span class="cx"> 
</span><del>-target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - location - keyCode - charCode
-BODY - keydown - false,false,false,false - ArrowLeft - ArrowLeft - Left - DOM_KEY_LOCATION_STANDARD - 37 - 0
-BODY - keyup - false,false,false,false - ArrowLeft - ArrowLeft - Left - DOM_KEY_LOCATION_STANDARD - 37 - 0
</del><ins>+target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - location - keyCode - charCode - keyCode - which
+BODY - keydown - false,false,false,false - ArrowLeft - ArrowLeft - Left - DOM_KEY_LOCATION_STANDARD - 37 - 0 - 37 - 37
+BODY - keyup - false,false,false,false - ArrowLeft - ArrowLeft - Left - DOM_KEY_LOCATION_STANDARD - 37 - 0 - 37 - 37
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsarrowkeysonbodyhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/arrow-keys-on-body.html (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/arrow-keys-on-body.html        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/arrow-keys-on-body.html        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -45,7 +45,9 @@
</span><span class="cx">             + ' - ' + event.keyIdentifier
</span><span class="cx">             + ' - ' + (event.location === undefined ? &quot;undefined&quot; : locationName(event.location))
</span><span class="cx">             + ' - ' + event.keyCode
</span><del>-            + ' - ' + event.charCode;
</del><ins>+            + ' - ' + event.charCode
+            + ' - ' + event.keyCode
+            + ' - ' + event.which;
</ins><span class="cx"> 
</span><span class="cx">     } catch (ex) {
</span><span class="cx">         alert(ex);
</span><span class="lines">@@ -57,7 +59,9 @@
</span><span class="cx">         + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">         + ' - ' + &quot;location&quot;
</span><span class="cx">         + ' - ' + &quot;keyCode&quot;
</span><del>-        + ' - ' + &quot;charCode&quot;);
</del><ins>+        + ' - ' + &quot;charCode&quot;
+        + ' - ' + &quot;keyCode&quot;
+        + ' - ' + &quot;which&quot;);
</ins><span class="cx"> 
</span><span class="cx"> if (window.testRunner) {
</span><span class="cx">     testRunner.dumpAsText();
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsiniteventsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/init-events-expected.txt (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/init-events-expected.txt        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/init-events-expected.txt        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -86,8 +86,8 @@
</span><span class="cx"> PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, document').fromElement is document
</span><span class="cx"> PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').toElement is null
</span><span class="cx"> PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').dataTransfer is null
</span><del>-PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').keyCode is 0
-PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').charCode is 0
</del><ins>+PASS 'keyCode' in testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null') is false
+PASS 'charCode' in testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null') is false
</ins><span class="cx"> PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').layerX is 1004
</span><span class="cx"> PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').layerY is 1005
</span><span class="cx"> PASS testInitEvent('Mouse', '&quot;a&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').pageX is 1004
</span><span class="lines">@@ -133,8 +133,8 @@
</span><span class="cx"> PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').data is 'b'
</span><span class="cx"> PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, null').data is 'null'
</span><span class="cx"> PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').detail is 0
</span><del>-PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').keyCode is 0
-PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').charCode is 0
</del><ins>+PASS 'keyCode' in testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;') is false
+PASS 'charCode' in testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;') is false
</ins><span class="cx"> PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').layerX is 0
</span><span class="cx"> PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').layerY is 0
</span><span class="cx"> PASS testInitEvent('Text', '&quot;a&quot;, false, false, window, &quot;b&quot;').pageX is 0
</span><span class="lines">@@ -149,8 +149,8 @@
</span><span class="cx"> PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').view is window
</span><span class="cx"> PASS testInitEvent('UI', '&quot;a&quot;, false, false, null, 1001').view is null
</span><span class="cx"> PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').detail is 1001
</span><del>-PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').keyCode is 0
-PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').charCode is 0
</del><ins>+PASS 'keyCode' in testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001') is false
+PASS 'charCode' in testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001') is false
</ins><span class="cx"> PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').layerX is 0
</span><span class="cx"> PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').layerY is 0
</span><span class="cx"> PASS testInitEvent('UI', '&quot;a&quot;, false, false, window, 1001').pageX is 0
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyeventsininputbuttonexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -1,19 +1,19 @@
</span><span class="cx"> To test manually, press keys and compare results to other browsers.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode
</del><ins>+target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode - which
</ins><span class="cx"> Space:
</span><del>-INPUT - keydown - false,false,false,false - - Space - U+0020 - 32 - 0
-INPUT - keypress - false,false,false,false - - Space - - 32 - 32
-INPUT - keyup - false,false,false,false - - Space - U+0020 - 32 - 0
</del><ins>+INPUT - keydown - false,false,false,false - - Space - U+0020 - 32 - 0 - 32
+INPUT - keypress - false,false,false,false - - Space - - 32 - 32 - 32
+INPUT - keyup - false,false,false,false - - Space - U+0020 - 32 - 0 - 32
</ins><span class="cx"> INPUT - click
</span><span class="cx"> Enter:
</span><del>-INPUT - keydown - false,false,false,false - Enter - Enter - Enter - 13 - 0
-INPUT - keypress - false,false,false,false - Enter - Enter - - 13 - 13
</del><ins>+INPUT - keydown - false,false,false,false - Enter - Enter - Enter - 13 - 0 - 13
+INPUT - keypress - false,false,false,false - Enter - Enter - - 13 - 13 - 13
</ins><span class="cx"> INPUT - click
</span><del>-INPUT - keyup - false,false,false,false - Enter - Enter - Enter - 13 - 0
</del><ins>+INPUT - keyup - false,false,false,false - Enter - Enter - Enter - 13 - 0 - 13
</ins><span class="cx"> A:
</span><del>-INPUT - keydown - false,false,true,false - A - KeyA - U+0041 - 65 - 0
-INPUT - keypress - false,false,true,false - A - KeyA - - 65 - 65
-INPUT - keyup - false,false,true,false - A - KeyA - U+0041 - 65 - 0
</del><ins>+INPUT - keydown - false,false,true,false - A - KeyA - U+0041 - 65 - 0 - 65
+INPUT - keypress - false,false,true,false - A - KeyA - - 65 - 65 - 65
+INPUT - keyup - false,false,true,false - A - KeyA - U+0041 - 65 - 0 - 65
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyeventsininputbuttonhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/key-events-in-input-button.html (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-button.html        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/key-events-in-input-button.html        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -27,7 +27,8 @@
</span><span class="cx">             + ' - ' + event.code
</span><span class="cx">             + ' - ' + event.keyIdentifier
</span><span class="cx">             + ' - ' + event.keyCode
</span><del>-            + ' - ' + event.charCode;
</del><ins>+            + ' - ' + event.charCode
+            + ' - ' + event.which;
</ins><span class="cx">     else if (event.type == &quot;mousedown&quot; || event.type == &quot;click&quot; || event.type == &quot;mouseup&quot;)
</span><span class="cx">         return (where ? &quot;(&quot; + where + &quot;) &quot; : &quot;&quot;) + target.tagName + &quot; - &quot; + event.type;
</span><span class="cx"> 
</span><span class="lines">@@ -40,7 +41,8 @@
</span><span class="cx">         + ' - ' + &quot;code&quot;
</span><span class="cx">         + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">         + ' - ' + &quot;keyCode&quot;
</span><del>-        + ' - ' + &quot;charCode&quot;);
</del><ins>+        + ' - ' + &quot;charCode&quot;
+        + ' - ' + &quot;which&quot;);
</ins><span class="cx"> 
</span><span class="cx"> if (document.getElementsByTagName(&quot;input&quot;)[0].addEventListener)
</span><span class="cx">     document.getElementsByTagName(&quot;input&quot;)[0].addEventListener('textInput', function(e) {log(eventInfo(e));}, false);
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyeventsininputtextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -1,18 +1,18 @@
</span><span class="cx"> To test manually, press keys and compare results to other browsers.
</span><span class="cx"> 
</span><span class="cx">   
</span><del>-target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode
</del><ins>+target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode - which
</ins><span class="cx"> Space:
</span><del>-INPUT - keydown - false,false,false,false - - Space - U+0020 - 32 - 0. Value: &quot;&quot;.
-INPUT - keypress - false,false,false,false - - Space - - 32 - 32. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - - Space - U+0020 - 32 - 0 - 32. Value: &quot;&quot;.
+INPUT - keypress - false,false,false,false - - Space - - 32 - 32 - 32. Value: &quot;&quot;.
</ins><span class="cx"> INPUT - textInput - . Value: &quot;&quot;.
</span><del>-INPUT - keyup - false,false,false,false - - Space - U+0020 - 32 - 0. Value: &quot; &quot;.
</del><ins>+INPUT - keyup - false,false,false,false - - Space - U+0020 - 32 - 0 - 32. Value: &quot; &quot;.
</ins><span class="cx"> Backspace:
</span><del>-INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot; &quot;.
-INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0 - 8. Value: &quot; &quot;.
+INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0 - 8. Value: &quot;&quot;.
</ins><span class="cx"> Left Arrow:
</span><del>-INPUT - keydown - false,false,false,false - ArrowLeft - ArrowLeft - Left - 37 - 0. Value: &quot;&quot;.
-INPUT - keyup - false,false,false,false - ArrowLeft - ArrowLeft - Left - 37 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - ArrowLeft - ArrowLeft - Left - 37 - 0 - 37. Value: &quot;&quot;.
+INPUT - keyup - false,false,false,false - ArrowLeft - ArrowLeft - Left - 37 - 0 - 37. Value: &quot;&quot;.
</ins><span class="cx"> Tab:
</span><del>-INPUT - keydown - false,false,false,false - Tab - Tab - U+0009 - 9 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Tab - Tab - U+0009 - 9 - 0 - 9. Value: &quot;&quot;.
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyeventsininputtexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/key-events-in-input-text.html (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-text.html        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/key-events-in-input-text.html        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">             + ' - ' + event.keyIdentifier
</span><span class="cx">             + ' - ' + event.keyCode
</span><span class="cx">             + ' - ' + event.charCode
</span><ins>+            + ' - ' + event.which
</ins><span class="cx">             + '. Value: &quot;' + target.value + '&quot;.';
</span><span class="cx">     else if (event.type == &quot;mousedown&quot; || event.type == &quot;click&quot; || event.type == &quot;mouseup&quot;)
</span><span class="cx">         return (where ? &quot;(&quot; + where + &quot;) &quot; : &quot;&quot;) + target.tagName + &quot; - &quot; + event.type
</span><span class="lines">@@ -44,7 +45,8 @@
</span><span class="cx">         + ' - ' + &quot;code&quot;
</span><span class="cx">         + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">         + ' - ' + &quot;keyCode&quot;
</span><del>-        + ' - ' + &quot;charCode&quot;);
</del><ins>+        + ' - ' + &quot;charCode&quot;
+        + ' - ' + &quot;which&quot;);
</ins><span class="cx"> 
</span><span class="cx"> if (document.getElementsByTagName(&quot;input&quot;)[0].addEventListener)
</span><span class="cx">     document.getElementsByTagName(&quot;input&quot;)[0].addEventListener('textInput', function(e) {log(eventInfo(e));}, false);
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsscripttestsiniteventsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/script-tests/init-events.js (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/script-tests/init-events.js        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/fast/events/script-tests/init-events.js        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -106,8 +106,8 @@
</span><span class="cx"> shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, document').fromElement&quot;, &quot;document&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').toElement&quot;, &quot;null&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').dataTransfer&quot;, &quot;null&quot;);
</span><del>-shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').keyCode&quot;, &quot;0&quot;);
-shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').charCode&quot;, &quot;0&quot;);
</del><ins>+shouldBeFalse(&quot;'keyCode' in testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null')&quot;);
+shouldBeFalse(&quot;'charCode' in testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null')&quot;);
</ins><span class="cx"> shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').layerX&quot;, &quot;1004&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').layerY&quot;, &quot;1005&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Mouse', '\&quot;a\&quot;, false, false, window, 1001, 1002, 1003, 1004, 1005, false, false, false, false, 1006, null').pageX&quot;, &quot;1004&quot;);
</span><span class="lines">@@ -156,8 +156,8 @@
</span><span class="cx"> shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').data&quot;, &quot;'b'&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, null').data&quot;, &quot;'null'&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').detail&quot;, &quot;0&quot;);
</span><del>-shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').keyCode&quot;, &quot;0&quot;);
-shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').charCode&quot;, &quot;0&quot;);
</del><ins>+shouldBeFalse(&quot;'keyCode' in testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;')&quot;);
+shouldBeFalse(&quot;'charCode' in testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;')&quot;);
</ins><span class="cx"> shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').layerX&quot;, &quot;0&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').layerY&quot;, &quot;0&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('Text', '\&quot;a\&quot;, false, false, window, \&quot;b\&quot;').pageX&quot;, &quot;0&quot;);
</span><span class="lines">@@ -173,8 +173,8 @@
</span><span class="cx"> shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').view&quot;, &quot;window&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, null, 1001').view&quot;, &quot;null&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').detail&quot;, &quot;1001&quot;);
</span><del>-shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').keyCode&quot;, &quot;0&quot;);
-shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').charCode&quot;, &quot;0&quot;);
</del><ins>+shouldBeFalse(&quot;'keyCode' in testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001')&quot;);
+shouldBeFalse(&quot;'charCode' in testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001')&quot;);
</ins><span class="cx"> shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').layerX&quot;, &quot;0&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').layerY&quot;, &quot;0&quot;);
</span><span class="cx"> shouldBe(&quot;testInitEvent('UI', '\&quot;a\&quot;, false, false, window, 1001').pageX&quot;, &quot;0&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-12-15  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=165904
+
+        Reviewed by Sam Weinig.
+
+        Rebaseline W3C test now that one more check is passing.
+
+        * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:
+
</ins><span class="cx"> 2016-12-15  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Sync web-platform-tests up to revision a4c2b37
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomeventsEventsubclassesconstructorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> PASS KeyboardEvent constructor (null argument) 
</span><span class="cx"> PASS KeyboardEvent constructor (empty argument) 
</span><span class="cx"> PASS KeyboardEvent constructor (argument with default values) 
</span><del>-FAIL KeyboardEvent constructor (argument with non-default values) assert_equals: The value of the charCode property should be 7 expected 7 but got 0
</del><ins>+PASS KeyboardEvent constructor (argument with non-default values) 
</ins><span class="cx"> PASS CompositionEvent constructor (no argument) 
</span><span class="cx"> PASS CompositionEvent constructor (undefined argument) 
</span><span class="cx"> PASS CompositionEvent constructor (null argument) 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/ChangeLog        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2016-12-15  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=165904
+
+        Reviewed by Sam Weinig.
+
+        Move 'charCode' / 'keyCode' attributes from UIEvent to KeyboardEvent and add
+        'which' to KeyboardEvent to match the specification:
+        - https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent
+
+        We keep a 'which' attribute on UIEvent even though the specification does
+        not say we should because Firefox and Chrome have 'which' on UIEvent still.
+
+        Specification:
+        - 'charCode' / 'keyCode' / 'which' on KeyboardEvent only
+
+        Firefox:
+        - 'charCode' / 'keyCode' on KeyboardEvent only
+        - 'which' on UIEvent only
+
+        Chrome:
+        - 'charCode' / 'keyCode' / 'which' on KeyboardEvent
+        - 'which' on UIEvent as well
+
+        Old WebKit behavior:
+        - 'charCode' / 'keyCode' / 'which' on UIEvent only
+
+        New WebKit behavior:
+        - 'charCode' / 'keyCode' / 'which' on KeyboardEvent
+        - 'which' on UIEvent as well
+
+        Our new behavior is identical to Chrome, much closer to the specification,
+        and closer to Firefox as well.
+
+        No new tests, updated / rebaselined existing tests.
+
+        * dom/KeyboardEvent.cpp:
+        (WebCore::KeyboardEvent::KeyboardEvent):
+        (WebCore::KeyboardEvent::keyCode):
+        (WebCore::KeyboardEvent::charCode):
+        (WebCore::KeyboardEvent::which):
+        * dom/KeyboardEvent.h:
+        * dom/KeyboardEvent.idl:
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEvent::which):
+        * dom/UIEvent.cpp:
+        * dom/UIEvent.h:
+        * dom/UIEvent.idl:
+
</ins><span class="cx"> 2016-12-15  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IndexedDB: Add an &quot;IDBCursorRecord&quot; struct.
</span></span></pre></div>
<a id="trunkSourceWebCoredomKeyboardEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/KeyboardEvent.cpp        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -137,6 +137,9 @@
</span><span class="cx">     , m_location(initializer.keyLocation ? *initializer.keyLocation : initializer.location)
</span><span class="cx">     , m_repeat(initializer.repeat)
</span><span class="cx">     , m_isComposing(initializer.isComposing)
</span><ins>+    , m_charCode(initializer.charCode)
+    , m_keyCode(initializer.keyCode)
+    , m_which(initializer.which)
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     , m_handledByInputMethod(false)
</span><span class="cx"> #endif
</span><span class="lines">@@ -185,6 +188,9 @@
</span><span class="cx"> 
</span><span class="cx"> int KeyboardEvent::keyCode() const
</span><span class="cx"> {
</span><ins>+    if (m_keyCode)
+        return m_keyCode.value();
+
</ins><span class="cx">     // IE: virtual key code for keyup/keydown, character code for keypress
</span><span class="cx">     // Firefox: virtual key code for keyup/keydown, zero for keypress
</span><span class="cx">     // We match IE.
</span><span class="lines">@@ -198,6 +204,9 @@
</span><span class="cx"> 
</span><span class="cx"> int KeyboardEvent::charCode() const
</span><span class="cx"> {
</span><ins>+    if (m_charCode)
+        return m_charCode.value();
+
</ins><span class="cx">     // IE: not supported
</span><span class="cx">     // Firefox: 0 for keydown/keyup events, character code for keypress
</span><span class="cx">     // We match Firefox, unless in backward compatibility mode, where we always return the character code.
</span><span class="lines">@@ -225,6 +234,8 @@
</span><span class="cx"> {
</span><span class="cx">     // Netscape's &quot;which&quot; returns a virtual key code for keydown and keyup, and a character code for keypress.
</span><span class="cx">     // That's exactly what IE's &quot;keyCode&quot; returns. So they are the same for keyboard events.
</span><ins>+    if (m_which)
+        return m_which.value();
</ins><span class="cx">     return keyCode();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomKeyboardEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/KeyboardEvent.h (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/KeyboardEvent.h        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -63,6 +63,9 @@
</span><span class="cx">         // Legacy.
</span><span class="cx">         String keyIdentifier;
</span><span class="cx">         std::optional&lt;unsigned&gt; keyLocation;
</span><ins>+        unsigned charCode;
+        unsigned keyCode;
+        unsigned which;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     static Ref&lt;KeyboardEvent&gt; create(const AtomicString&amp; type, const Init&amp; initializer, IsTrusted isTrusted = IsTrusted::No)
</span><span class="lines">@@ -98,8 +101,8 @@
</span><span class="cx">     
</span><span class="cx">     const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT int keyCode() const final; // key code for keydown and keyup, character for keypress
-    WEBCORE_EXPORT int charCode() const final; // character code for keypress, 0 for keydown and keyup
</del><ins>+    WEBCORE_EXPORT int keyCode() const; // key code for keydown and keyup, character for keypress
+    WEBCORE_EXPORT int charCode() const; // character code for keypress, 0 for keydown and keyup
</ins><span class="cx"> 
</span><span class="cx">     EventInterface eventInterface() const final;
</span><span class="cx">     bool isKeyboardEvent() const final;
</span><span class="lines">@@ -134,6 +137,9 @@
</span><span class="cx">     unsigned m_location { DOM_KEY_LOCATION_STANDARD };
</span><span class="cx">     bool m_repeat { false };
</span><span class="cx">     bool m_isComposing { false };
</span><ins>+    std::optional&lt;unsigned&gt; m_charCode;
+    std::optional&lt;unsigned&gt; m_keyCode;
+    std::optional&lt;unsigned&gt; m_which;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     // Commands that were sent by AppKit when interpreting the event. Doesn't include input method commands.
</span></span></pre></div>
<a id="trunkSourceWebCoredomKeyboardEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/KeyboardEvent.idl (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/KeyboardEvent.idl        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/KeyboardEvent.idl        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -45,6 +45,9 @@
</span><span class="cx">     readonly attribute DOMString keyIdentifier;
</span><span class="cx">     [ImplementedAs=location] readonly attribute unsigned long keyLocation;
</span><span class="cx">     readonly attribute boolean altGraphKey;
</span><ins>+    readonly attribute unsigned long charCode;
+    readonly attribute unsigned long keyCode;
+    readonly attribute unsigned long which;
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: this does not match the version in the DOM spec.
</span><span class="cx">     // FIXME: Using &quot;undefined&quot; as default parameter value is wrong.
</span><span class="lines">@@ -64,4 +67,7 @@
</span><span class="cx">     // attributes we still support on KeyboardEvent for backward compatibility.
</span><span class="cx">     DOMString keyIdentifier = &quot;&quot;;
</span><span class="cx">     unsigned long keyLocation;
</span><ins>+    unsigned long charCode = 0;
+    unsigned long keyCode = 0;
+    unsigned long which = 0;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoredomMouseEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MouseEvent.cpp        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx"> int MouseEvent::which() const
</span><span class="cx"> {
</span><span class="cx">     // For the DOM, the return values for left, middle and right mouse buttons are 0, 1, 2, respectively.
</span><del>-    // For the Netscape &quot;which&quot; property, the return values for left, middle and right mouse buttons are 1, 2, 3, respectively. 
</del><ins>+    // For the Netscape &quot;which&quot; property, the return values for left, middle and right mouse buttons are 1, 2, 3, respectively.
</ins><span class="cx">     // So we must add 1.
</span><span class="cx">     if (!m_buttonDown)
</span><span class="cx">         return 0;
</span></span></pre></div>
<a id="trunkSourceWebCoredomUIEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/UIEvent.cpp (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/UIEvent.cpp        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/UIEvent.cpp        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -78,16 +78,6 @@
</span><span class="cx">     return UIEventInterfaceType;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int UIEvent::keyCode() const
-{
-    return 0;
-}
-
-int UIEvent::charCode() const
-{
-    return 0;
-}
-
</del><span class="cx"> int UIEvent::layerX()
</span><span class="cx"> {
</span><span class="cx">     return 0;
</span></span></pre></div>
<a id="trunkSourceWebCoredomUIEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/UIEvent.h (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/UIEvent.h        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/UIEvent.h        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -55,9 +55,6 @@
</span><span class="cx"> 
</span><span class="cx">     EventInterface eventInterface() const override;
</span><span class="cx"> 
</span><del>-    virtual int keyCode() const;
-    virtual int charCode() const;
-
</del><span class="cx">     virtual int layerX();
</span><span class="cx">     virtual int layerY();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomUIEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/UIEvent.idl (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/UIEvent.idl        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebCore/dom/UIEvent.idl        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -26,11 +26,12 @@
</span><span class="cx">     // FIXME: Using &quot;undefined&quot; as default parameter value is wrong.
</span><span class="cx">     void initUIEvent(optional DOMString type = &quot;undefined&quot;, optional boolean canBubble = false, optional boolean cancelable = false, optional DOMWindow? view = null, optional long detail = 0);
</span><span class="cx"> 
</span><del>-    readonly attribute long keyCode;
-    readonly attribute long charCode;
</del><span class="cx">     readonly attribute long layerX;
</span><span class="cx">     readonly attribute long layerY;
</span><span class="cx">     readonly attribute long pageX;
</span><span class="cx">     readonly attribute long pageY;
</span><ins>+
+    // FIXME: This should be on KeyboardEvent only as per the specification but Firefox and Chrome
+    // still have this attribute on UIEvent as of December 2016.
</ins><span class="cx">     readonly attribute long which;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-12-15  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Move charCode / keyCode / which attributes from UIEvent to KeyboardEvent
+        https://bugs.webkit.org/show_bug.cgi?id=165904
+
+        Reviewed by Sam Weinig.
+
+        Update ObjC bindings so they keep building.
+
+        * DOM/DOMUIEvent.mm:
+        (-[DOMUIEvent keyCode]):
+        (-[DOMUIEvent charCode]):
+
</ins><span class="cx"> 2016-12-15  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Always clear RenderLayer backing stores when going into page cache.
</span></span></pre></div>
<a id="trunkSourceWebKitmacDOMDOMUIEventmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/DOMUIEvent.mm (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/DOMUIEvent.mm        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebKit/mac/DOM/DOMUIEvent.mm        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -28,9 +28,10 @@
</span><span class="cx"> #import &quot;DOMAbstractViewInternal.h&quot;
</span><span class="cx"> #import &quot;DOMEventInternal.h&quot;
</span><span class="cx"> #import &quot;DOMNodeInternal.h&quot;
</span><ins>+#import &quot;ExceptionHandlers.h&quot;
</ins><span class="cx"> #import &lt;WebCore/DOMWindow.h&gt;
</span><del>-#import &quot;ExceptionHandlers.h&quot;
</del><span class="cx"> #import &lt;WebCore/JSMainThreadExecState.h&gt;
</span><ins>+#import &lt;WebCore/KeyboardEvent.h&gt;
</ins><span class="cx"> #import &lt;WebCore/ThreadCheck.h&gt;
</span><span class="cx"> #import &lt;WebCore/UIEvent.h&gt;
</span><span class="cx"> #import &lt;WebCore/URL.h&gt;
</span><span class="lines">@@ -56,13 +57,17 @@
</span><span class="cx"> - (int)keyCode
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    return IMPL-&gt;keyCode();
</del><ins>+    if (is&lt;WebCore::KeyboardEvent&gt;(*IMPL))
+        return downcast&lt;WebCore::KeyboardEvent&gt;(*IMPL).keyCode();
+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (int)charCode
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    return IMPL-&gt;charCode();
</del><ins>+    if (is&lt;WebCore::KeyboardEvent&gt;(*IMPL))
+        return downcast&lt;WebCore::KeyboardEvent&gt;(*IMPL).charCode();
+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (int)layerX
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMUIEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp (209894 => 209895)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp        2016-12-16 01:28:57 UTC (rev 209894)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp        2016-12-16 01:29:23 UTC (rev 209895)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &lt;WebCore/ExceptionCode.h&gt;
</span><span class="cx"> #include &lt;WebCore/ExceptionCodeDescription.h&gt;
</span><span class="cx"> #include &lt;WebCore/JSMainThreadExecState.h&gt;
</span><ins>+#include &lt;WebCore/KeyboardEvent.h&gt;
</ins><span class="cx"> #include &quot;WebKitDOMDOMWindowPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMEventPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitDOMPrivate.h&quot;
</span><span class="lines">@@ -229,7 +230,7 @@
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="cx">     g_return_val_if_fail(WEBKIT_DOM_IS_UI_EVENT(self), 0);
</span><span class="cx">     WebCore::UIEvent* item = WebKit::core(self);
</span><del>-    glong result = item-&gt;keyCode();
</del><ins>+    glong result = is&lt;WebCore::KeyboardEvent&gt;(*item) ? downcast&lt;WebCore::KeyboardEvent&gt;(*item).keyCode() : 0;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -238,7 +239,7 @@
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="cx">     g_return_val_if_fail(WEBKIT_DOM_IS_UI_EVENT(self), 0);
</span><span class="cx">     WebCore::UIEvent* item = WebKit::core(self);
</span><del>-    glong result = item-&gt;charCode();
</del><ins>+    glong result = is&lt;WebCore::KeyboardEvent&gt;(*item) ? downcast&lt;WebCore::KeyboardEvent&gt;(*item).charCode() : 0;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>