<!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>[206803] 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/206803">206803</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-10-04 20:13:35 -0700 (Tue, 04 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement KeyboardEvent.code from the UI Event spec
https://bugs.webkit.org/show_bug.cgi?id=149584

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

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

Source/WebCore:

Add support for Keyboard.code attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-code
- https://w3c.github.io/uievents-code/

The feature is only enabled on Mac for now as the implementation is
platform-specific and Mac only.

Test: fast/events/keyboardevent-code.html

* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/KeyboardEvent.h:
* dom/KeyboardEvent.idl:
* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
(WebCore::PlatformKeyboardEvent::code):
(WebCore::PlatformKeyboardEvent::unmodifiedText): Deleted.
* platform/mac/PlatformEventFactoryMac.h:
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::codeForKeyEvent):
(WebCore::keyIdentifierForKeyEvent):
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits&lt;PlatformKeyboardEvent&gt;::encodeValue):
(JSC::EncodingTraits&lt;PlatformKeyboardEvent&gt;::decodeValue):

Source/WebKit2:

Add support for Keyboard.code attribute:
- https://w3c.github.io/uievents/#dom-keyboardevent-code
- https://w3c.github.io/uievents-code/

* Shared/WebEvent.h:
(WebKit::WebKeyboardEvent::code):
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
(WebKit::WebKeyboardEvent::encode):
(WebKit::WebKeyboardEvent::decode):
* Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebKeyboardEvent):

Source/WTF:

Add build time flag to toggle support for the code attribute on
KeyboardEvent and only enable it on Mac for now, given that the
implementation is missing on other platforms.

* wtf/FeatureDefines.h:

LayoutTests:

Extend layout test coverage.

* fast/events/arrow-keys-on-body-expected.txt:
* fast/events/arrow-keys-on-body.html:
* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.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:
* fast/events/keyboardevent-code-expected.txt: Added.
* fast/events/keyboardevent-code.html: Added.
* fast/events/special-key-events-in-input-text-expected.txt:
* fast/events/special-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="#trunkLayoutTestsfasteventsconstructorskeyboardeventconstructorexpectedtxt">trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsconstructorskeyboardeventconstructorhtml">trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html</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="#trunkLayoutTestsfasteventsspecialkeyeventsininputtextexpectedtxt">trunk/LayoutTests/fast/events/special-key-events-in-input-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsspecialkeyeventsininputtexthtml">trunk/LayoutTests/fast/events/special-key-events-in-input-text.html</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="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfFeatureDefinesh">trunk/Source/WTF/wtf/FeatureDefines.h</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="#trunkSourceWebCoreplatformPlatformKeyboardEventh">trunk/Source/WebCore/platform/PlatformKeyboardEvent.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPlatformEventFactoryMach">trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPlatformEventFactoryMacmm">trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm</a></li>
<li><a href="#trunkSourceWebCorereplaySerializationMethodscpp">trunk/Source/WebCore/replay/SerializationMethods.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebEventh">trunk/Source/WebKit2/Shared/WebEvent.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebEventConversioncpp">trunk/Source/WebKit2/Shared/WebEventConversion.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebKeyboardEventcpp">trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedmacWebEventFactorymm">trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventskeyboardeventcodeexpectedtxt">trunk/LayoutTests/fast/events/keyboardevent-code-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventskeyboardeventcodehtml">trunk/LayoutTests/fast/events/keyboardevent-code.html</a></li>
<li>trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/</li>
<li><a href="#trunkLayoutTestsplatformiossimulatorfasteventsconstructorskeyboardeventconstructorexpectedtxt">trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestsdomeventsEventsubclassesconstructorsexpectedtxt">trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/ChangeLog        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-10-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Implement KeyboardEvent.code from the UI Event spec
+        https://bugs.webkit.org/show_bug.cgi?id=149584
+
+        Reviewed by Darin Adler.
+
+        Extend layout test coverage.
+
+        * fast/events/arrow-keys-on-body-expected.txt:
+        * fast/events/arrow-keys-on-body.html:
+        * fast/events/constructors/keyboard-event-constructor-expected.txt:
+        * fast/events/constructors/keyboard-event-constructor.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:
+        * fast/events/keyboardevent-code-expected.txt: Added.
+        * fast/events/keyboardevent-code.html: Added.
+        * fast/events/special-key-events-in-input-text-expected.txt:
+        * fast/events/special-key-events-in-input-text.html:
+
</ins><span class="cx"> 2016-10-04  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS WK2] Make it possible for a test to describe a user gesture as a stream of events in JSON format
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsarrowkeysonbodyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/arrow-keys-on-body-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</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 - keyIdentifier - location - keyCode - charCode
-BODY - keydown - false,false,false,false - Left - DOM_KEY_LOCATION_STANDARD - 37 - 0
-BODY - keyup - false,false,false,false - Left - DOM_KEY_LOCATION_STANDARD - 37 - 0
</del><ins>+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
</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 (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/arrow-keys-on-body.html        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/arrow-keys-on-body.html        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -40,6 +40,8 @@
</span><span class="cx">             + (target.tagName == &quot;INPUT&quot; ? &quot; &quot; + target.type : &quot;&quot;)
</span><span class="cx">             + &quot; - &quot; + event.type
</span><span class="cx">             + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
</span><ins>+            + ' - ' + event.key
+            + ' - ' + event.code
</ins><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><span class="lines">@@ -50,6 +52,8 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> log(&quot;target - type - &quot; + [&quot;ctrlKey&quot;, &quot;altKey&quot;, &quot;shiftKey&quot;, &quot;metaKey&quot;]
</span><ins>+        + ' - ' + &quot;key&quot;
+        + ' - ' + &quot;code&quot;
</ins><span class="cx">         + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">         + ' - ' + &quot;location&quot;
</span><span class="cx">         + ' - ' + &quot;keyCode&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsconstructorskeyboardeventconstructorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -106,17 +106,18 @@
</span><span class="cx"> PASS new KeyboardEvent('eventType', { shiftKey: true }).shiftKey is true
</span><span class="cx"> PASS new KeyboardEvent('eventType', { metaKey: false }).metaKey is false
</span><span class="cx"> PASS new KeyboardEvent('eventType', { metaKey: true }).metaKey is true
</span><del>-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles is true
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable is true
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view is window
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).detail is 111
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).key is &quot;a&quot;
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier is &quot;chocolate&quot;
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).location is 222
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).ctrlKey is true
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).altKey is true
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).shiftKey is true
-PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).metaKey is true
</del><ins>+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view is window
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).detail is 111
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).key is &quot;a&quot;
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).code is &quot;KeyA&quot;
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier is &quot;chocolate&quot;
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).location is 222
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).ctrlKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).altKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).shiftKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).metaKey is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsconstructorskeyboardeventconstructorhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -122,17 +122,18 @@
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> // All initializers are passed.
</span><del>-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles&quot;, &quot;true&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable&quot;, &quot;true&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view&quot;, &quot;window&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).detail&quot;, &quot;111&quot;);
-shouldBeEqualToString(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).key&quot;, &quot;a&quot;);
-shouldBeEqualToString(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier&quot;, &quot;chocolate&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).location&quot;, &quot;222&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).ctrlKey&quot;, &quot;true&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).altKey&quot;, &quot;true&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).shiftKey&quot;, &quot;true&quot;);
-shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).metaKey&quot;, &quot;true&quot;);
</del><ins>+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles&quot;, &quot;true&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable&quot;, &quot;true&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view&quot;, &quot;window&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).detail&quot;, &quot;111&quot;);
+shouldBeEqualToString(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).key&quot;, &quot;a&quot;);
+shouldBeEqualToString(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).code&quot;, &quot;KeyA&quot;);
+shouldBeEqualToString(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier&quot;, &quot;chocolate&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).location&quot;, &quot;222&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).ctrlKey&quot;, &quot;true&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).altKey&quot;, &quot;true&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).shiftKey&quot;, &quot;true&quot;);
+shouldBe(&quot;new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).metaKey&quot;, &quot;true&quot;);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyeventsininputbuttonexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/key-events-in-input-button-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</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 - keyIdentifier - keyCode - charCode
</del><ins>+target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode
</ins><span class="cx"> Space:
</span><del>-INPUT - keydown - false,false,false,false - - U+0020 - 32 - 0
-INPUT - keypress - false,false,false,false - - - 32 - 32
-INPUT - keyup - false,false,false,false - - U+0020 - 32 - 0
</del><ins>+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
</ins><span class="cx"> INPUT - click
</span><span class="cx"> Enter:
</span><del>-INPUT - keydown - false,false,false,false - Enter - Enter - 13 - 0
-INPUT - keypress - false,false,false,false - Enter - - 13 - 13
</del><ins>+INPUT - keydown - false,false,false,false - Enter - Enter - Enter - 13 - 0
+INPUT - keypress - false,false,false,false - Enter - Enter - - 13 - 13
</ins><span class="cx"> INPUT - click
</span><del>-INPUT - keyup - false,false,false,false - Enter - Enter - 13 - 0
</del><ins>+INPUT - keyup - false,false,false,false - Enter - Enter - Enter - 13 - 0
</ins><span class="cx"> A:
</span><del>-INPUT - keydown - false,false,true,false - A - U+0041 - 65 - 0
-INPUT - keypress - false,false,true,false - A - - 65 - 65
-INPUT - keyup - false,false,true,false - A - U+0041 - 65 - 0
</del><ins>+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
</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 (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-button.html        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/key-events-in-input-button.html        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx">         return (where ? &quot;(&quot; + where + &quot;) &quot; : &quot;&quot;) + target.tagName + &quot; - &quot; + event.type
</span><span class="cx">             + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
</span><span class="cx">             + ' - ' + event.key
</span><ins>+            + ' - ' + event.code
</ins><span class="cx">             + ' - ' + event.keyIdentifier
</span><span class="cx">             + ' - ' + event.keyCode
</span><span class="cx">             + ' - ' + event.charCode;
</span><span class="lines">@@ -36,6 +37,7 @@
</span><span class="cx"> }
</span><span class="cx"> log(&quot;target - type - &quot; + [&quot;ctrlKey&quot;, &quot;altKey&quot;, &quot;shiftKey&quot;, &quot;metaKey&quot;]
</span><span class="cx">         + ' - ' + &quot;key&quot;
</span><ins>+        + ' - ' + &quot;code&quot;
</ins><span class="cx">         + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">         + ' - ' + &quot;keyCode&quot;
</span><span class="cx">         + ' - ' + &quot;charCode&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyeventsininputtextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/key-events-in-input-text-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</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 - keyIdentifier - keyCode - charCode
</del><ins>+target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode
</ins><span class="cx"> Space:
</span><del>-INPUT - keydown - false,false,false,false - - U+0020 - 32 - 0. Value: &quot;&quot;.
-INPUT - keypress - false,false,false,false - - - 32 - 32. Value: &quot;&quot;.
</del><ins>+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;.
</ins><span class="cx"> INPUT - textInput - . Value: &quot;&quot;.
</span><del>-INPUT - keyup - false,false,false,false - - U+0020 - 32 - 0. Value: &quot; &quot;.
</del><ins>+INPUT - keyup - false,false,false,false - - Space - U+0020 - 32 - 0. Value: &quot; &quot;.
</ins><span class="cx"> Backspace:
</span><del>-INPUT - keydown - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot; &quot;.
-INPUT - keyup - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</del><ins>+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;.
</ins><span class="cx"> Left Arrow:
</span><del>-INPUT - keydown - false,false,false,false - ArrowLeft - Left - 37 - 0. Value: &quot;&quot;.
-INPUT - keyup - false,false,false,false - ArrowLeft - Left - 37 - 0. Value: &quot;&quot;.
</del><ins>+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;.
</ins><span class="cx"> Tab:
</span><del>-INPUT - keydown - false,false,false,false - Tab - U+0009 - 9 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Tab - Tab - U+0009 - 9 - 0. 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 (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/key-events-in-input-text.html        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/key-events-in-input-text.html        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx">         return (where ? &quot;(&quot; + where + &quot;) &quot; : &quot;&quot;) + target.tagName + &quot; - &quot; + event.type
</span><span class="cx">             + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
</span><span class="cx">             + ' - ' + event.key
</span><ins>+            + ' - ' + event.code
</ins><span class="cx">             + ' - ' + event.keyIdentifier
</span><span class="cx">             + ' - ' + event.keyCode
</span><span class="cx">             + ' - ' + event.charCode
</span><span class="lines">@@ -40,6 +41,7 @@
</span><span class="cx"> }
</span><span class="cx"> log(&quot;target - type - &quot; + [&quot;ctrlKey&quot;, &quot;altKey&quot;, &quot;shiftKey&quot;, &quot;metaKey&quot;]
</span><span class="cx">         + ' - ' + &quot;key&quot;
</span><ins>+        + ' - ' + &quot;code&quot;
</ins><span class="cx">         + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">         + ' - ' + &quot;keyCode&quot;
</span><span class="cx">         + ' - ' + &quot;charCode&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyboardeventcodeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/keyboardevent-code-expected.txt (0 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/keyboardevent-code-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/keyboardevent-code-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -0,0 +1,190 @@
</span><ins>+Test the code attribute on KeyboardEvent.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+
+* keydown
+PASS keyboardEvent.code is &quot;Space&quot;
+* keyup
+PASS keyboardEvent.code is &quot;Space&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;KeyA&quot;
+* keyup
+PASS keyboardEvent.code is &quot;KeyA&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;Backspace&quot;
+* keyup
+PASS keyboardEvent.code is &quot;Backspace&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;Minus&quot;
+* keyup
+PASS keyboardEvent.code is &quot;Minus&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ArrowLeft&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ArrowLeft&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ArrowRight&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ArrowRight&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ArrowUp&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ArrowUp&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ArrowDown&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ArrowDown&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;PageUp&quot;
+* keyup
+PASS keyboardEvent.code is &quot;PageUp&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;PageDown&quot;
+* keyup
+PASS keyboardEvent.code is &quot;PageDown&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;Home&quot;
+* keyup
+PASS keyboardEvent.code is &quot;Home&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;End&quot;
+* keyup
+PASS keyboardEvent.code is &quot;End&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;Delete&quot;
+* keyup
+PASS keyboardEvent.code is &quot;Delete&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ControlLeft&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ControlLeft&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ShiftLeft&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ShiftLeft&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;AltLeft&quot;
+* keyup
+PASS keyboardEvent.code is &quot;AltLeft&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ControlRight&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ControlRight&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;ShiftRight&quot;
+* keyup
+PASS keyboardEvent.code is &quot;ShiftRight&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;AltRight&quot;
+* keyup
+PASS keyboardEvent.code is &quot;AltRight&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F1&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F1&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F2&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F2&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F3&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F3&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F4&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F4&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F5&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F5&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F6&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F6&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F7&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F7&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F8&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F8&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F9&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F9&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F10&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F10&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F11&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F11&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;F12&quot;
+* keyup
+PASS keyboardEvent.code is &quot;F12&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;NumpadEnter&quot;
+* keyup
+PASS keyboardEvent.code is &quot;NumpadEnter&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;KeyA&quot;
+* keyup
+PASS keyboardEvent.code is &quot;KeyA&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;KeyA&quot;
+* keyup
+PASS keyboardEvent.code is &quot;KeyA&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;KeyA&quot;
+* keyup
+PASS keyboardEvent.code is &quot;KeyA&quot;
+
+* keydown
+PASS keyboardEvent.code is &quot;Digit1&quot;
+* keyup
+PASS keyboardEvent.code is &quot;Digit1&quot;
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventskeyboardeventcodehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/keyboardevent-code.html (0 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/keyboardevent-code.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/keyboardevent-code.html        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;input type=&quot;text&quot; id=&quot;testInput&quot;&gt;
+&lt;script&gt;
+description(&quot;Test the code attribute on KeyboardEvent.&quot;);
+
+var expectedCode;
+
+function testEvent(event)
+{
+    keyboardEvent = event;
+    debug(&quot;* &quot; + event.type);
+    shouldBeEqualToString(&quot;keyboardEvent.code&quot;, &quot;&quot; + expectedCode);
+}
+
+var input = document.getElementById(&quot;testInput&quot;);
+input.onkeydown = testEvent;
+input.onkeyup = testEvent;
+input.focus();
+
+function sendKeyAndTest(key, modifiers, expected)
+{
+    debug(&quot;&quot;);
+    expectedCode = expected;
+    eventSender.keyDown(key, []);
+}
+
+sendKeyAndTest(&quot; &quot;, [], &quot;Space&quot;);
+sendKeyAndTest(&quot;a&quot;, [], &quot;KeyA&quot;);
+sendKeyAndTest(&quot;\x08&quot;, [], &quot;Backspace&quot;);
+sendKeyAndTest(&quot;\x1B&quot;, [], &quot;Minus&quot;);
+sendKeyAndTest(&quot;leftArrow&quot;, [], &quot;ArrowLeft&quot;);
+sendKeyAndTest(&quot;rightArrow&quot;, [], &quot;ArrowRight&quot;);
+sendKeyAndTest(&quot;upArrow&quot;, [], &quot;ArrowUp&quot;);
+sendKeyAndTest(&quot;downArrow&quot;, [], &quot;ArrowDown&quot;);
+sendKeyAndTest(&quot;pageUp&quot;, [], &quot;PageUp&quot;);
+sendKeyAndTest(&quot;pageDown&quot;, [], &quot;PageDown&quot;);
+sendKeyAndTest(&quot;home&quot;, [], &quot;Home&quot;);
+sendKeyAndTest(&quot;end&quot;, [], &quot;End&quot;);
+sendKeyAndTest(&quot;delete&quot;, [], &quot;Delete&quot;);
+sendKeyAndTest(&quot;leftControl&quot;, [&quot;ctrlKey&quot;], &quot;ControlLeft&quot;);
+sendKeyAndTest(&quot;leftShift&quot;, [&quot;shiftKey&quot;], &quot;ShiftLeft&quot;);
+sendKeyAndTest(&quot;leftAlt&quot;, [&quot;altKey&quot;], &quot;AltLeft&quot;);
+sendKeyAndTest(&quot;rightControl&quot;, [&quot;ctrlKey&quot;], &quot;ControlRight&quot;);
+sendKeyAndTest(&quot;rightShift&quot;, [&quot;shiftKey&quot;], &quot;ShiftRight&quot;);
+sendKeyAndTest(&quot;rightAlt&quot;, [&quot;altKey&quot;], &quot;AltRight&quot;);
+for (var i = 1; i &lt;= 12; i++)
+    sendKeyAndTest(&quot;F&quot; + i, [], &quot;F&quot; + i);
+sendKeyAndTest(&quot;\n&quot;, [], &quot;NumpadEnter&quot;);
+sendKeyAndTest(&quot;A&quot;, [], &quot;KeyA&quot;);
+sendKeyAndTest(&quot;a&quot;, [&quot;ctrlKey&quot;], &quot;KeyA&quot;);
+sendKeyAndTest(&quot;a&quot;, [&quot;metaKey&quot;], &quot;KeyA&quot;);
+sendKeyAndTest(&quot;1&quot;, ['altKey'], &quot;Digit1&quot;);
+
+debug(&quot;&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsspecialkeyeventsininputtextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/special-key-events-in-input-text-expected.txt (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/special-key-events-in-input-text-expected.txt        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/special-key-events-in-input-text-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -1,49 +1,49 @@
</span><span class="cx"> This test verifies that the correct sequence of keyboard events is generated for a keypress for certain special keys. 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 - keyIdentifier - keyCode - charCode
</del><ins>+target - type - ctrlKey,altKey,shiftKey,metaKey - key - code - keyIdentifier - keyCode - charCode
</ins><span class="cx"> 
</span><span class="cx"> Ampersand:
</span><del>-INPUT - keydown - false,false,true,false - 7 - U+0037 - 55 - 0. Value: &quot;&quot;.
-INPUT - keypress - false,false,true,false - 7 - - 55 - 55. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,true,false - 7 - Digit7 - U+0037 - 55 - 0. Value: &quot;&quot;.
+INPUT - keypress - false,false,true,false - 7 - Digit7 - - 55 - 55. Value: &quot;&quot;.
</ins><span class="cx"> INPUT - textInput - 7. Value: &quot;&quot;.
</span><del>-INPUT - keyup - false,false,true,false - 7 - U+0037 - 55 - 0. Value: &quot;7&quot;.
</del><ins>+INPUT - keyup - false,false,true,false - 7 - Digit7 - U+0037 - 55 - 0. Value: &quot;7&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Backspace:
</span><del>-INPUT - keydown - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;7&quot;.
-INPUT - keyup - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;7&quot;.
+INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Percent:
</span><del>-INPUT - keydown - false,false,true,false - 5 - U+0035 - 53 - 0. Value: &quot;&quot;.
-INPUT - keypress - false,false,true,false - 5 - - 53 - 53. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,true,false - 5 - Digit5 - U+0035 - 53 - 0. Value: &quot;&quot;.
+INPUT - keypress - false,false,true,false - 5 - Digit5 - - 53 - 53. Value: &quot;&quot;.
</ins><span class="cx"> INPUT - textInput - 5. Value: &quot;&quot;.
</span><del>-INPUT - keyup - false,false,true,false - 5 - U+0035 - 53 - 0. Value: &quot;5&quot;.
</del><ins>+INPUT - keyup - false,false,true,false - 5 - Digit5 - U+0035 - 53 - 0. Value: &quot;5&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Backspace:
</span><del>-INPUT - keydown - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;5&quot;.
-INPUT - keyup - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;5&quot;.
+INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Left parenthesis:
</span><del>-INPUT - keydown - false,false,true,false - 9 - U+0039 - 57 - 0. Value: &quot;&quot;.
-INPUT - keypress - false,false,true,false - 9 - - 57 - 57. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,true,false - 9 - Digit9 - U+0039 - 57 - 0. Value: &quot;&quot;.
+INPUT - keypress - false,false,true,false - 9 - Digit9 - - 57 - 57. Value: &quot;&quot;.
</ins><span class="cx"> INPUT - textInput - 9. Value: &quot;&quot;.
</span><del>-INPUT - keyup - false,false,true,false - 9 - U+0039 - 57 - 0. Value: &quot;9&quot;.
</del><ins>+INPUT - keyup - false,false,true,false - 9 - Digit9 - U+0039 - 57 - 0. Value: &quot;9&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Backspace:
</span><del>-INPUT - keydown - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;9&quot;.
-INPUT - keyup - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;9&quot;.
+INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Right parenthesis:
</span><del>-INPUT - keydown - false,false,true,false - 0 - U+0030 - 48 - 0. Value: &quot;&quot;.
-INPUT - keypress - false,false,true,false - 0 - - 48 - 48. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,true,false - 0 - Digit0 - U+0030 - 48 - 0. Value: &quot;&quot;.
+INPUT - keypress - false,false,true,false - 0 - Digit0 - - 48 - 48. Value: &quot;&quot;.
</ins><span class="cx"> INPUT - textInput - 0. Value: &quot;&quot;.
</span><del>-INPUT - keyup - false,false,true,false - 0 - U+0030 - 48 - 0. Value: &quot;0&quot;.
</del><ins>+INPUT - keyup - false,false,true,false - 0 - Digit0 - U+0030 - 48 - 0. Value: &quot;0&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Backspace:
</span><del>-INPUT - keydown - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;0&quot;.
-INPUT - keyup - false,false,false,false - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;0&quot;.
+INPUT - keyup - false,false,false,false - Backspace - Backspace - U+0008 - 8 - 0. Value: &quot;&quot;.
</ins><span class="cx"> 
</span><span class="cx"> Print screen:
</span><del>-INPUT - keydown - false,false,false,false - PrintScreen - PrintScreen - 44 - 0. Value: &quot;&quot;.
-INPUT - keyup - false,false,false,false - PrintScreen - PrintScreen - 44 - 0. Value: &quot;&quot;.
</del><ins>+INPUT - keydown - false,false,false,false - PrintScreen - KeyA - PrintScreen - 44 - 0. Value: &quot;&quot;.
+INPUT - keyup - false,false,false,false - PrintScreen - KeyA - PrintScreen - 44 - 0. Value: &quot;&quot;.
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsspecialkeyeventsininputtexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/special-key-events-in-input-text.html (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/special-key-events-in-input-text.html        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/fast/events/special-key-events-in-input-text.html        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -19,6 +19,7 @@
</span><span class="cx">    } else if (type == &quot;keydown&quot; || type == &quot;keypress&quot; || type == &quot;keyup&quot;) {
</span><span class="cx">      info += [e.ctrlKey, e.altKey, e.shiftKey, e.metaKey] +
</span><span class="cx">          ' - ' + e.key +
</span><ins>+         ' - ' + e.code +
</ins><span class="cx">          ' - ' + e.keyIdentifier +
</span><span class="cx">          ' - ' + e.keyCode +
</span><span class="cx">          ' - ' + e.charCode;
</span><span class="lines">@@ -29,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> log(&quot;target - type - &quot; + [&quot;ctrlKey&quot;, &quot;altKey&quot;, &quot;shiftKey&quot;, &quot;metaKey&quot;]
</span><span class="cx">        + ' - ' + &quot;key&quot;
</span><ins>+       + ' - ' + &quot;code&quot;
</ins><span class="cx">        + ' - ' + &quot;keyIdentifier&quot;
</span><span class="cx">        + ' - ' + &quot;keyCode&quot;
</span><span class="cx">        + ' - ' + &quot;charCode&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-10-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Implement KeyboardEvent.code from the UI Event spec
+        https://bugs.webkit.org/show_bug.cgi?id=149584
+
+        Reviewed by Darin Adler.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:
+
</ins><span class="cx"> 2016-10-04  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Fetch API] ReadableStream should be errored with TypeError values
</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 (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -29,12 +29,12 @@
</span><span class="cx"> FAIL WheelEvent constructor (empty argument) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
</span><span class="cx"> FAIL WheelEvent constructor (argument with default values) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
</span><span class="cx"> FAIL WheelEvent constructor (argument with non-default values) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
</span><del>-FAIL KeyboardEvent constructor (no argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
-FAIL KeyboardEvent constructor (undefined argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
-FAIL KeyboardEvent constructor (null argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
-FAIL KeyboardEvent constructor (empty argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
-FAIL KeyboardEvent constructor (argument with default values) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
-FAIL KeyboardEvent constructor (argument with non-default values) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
</del><ins>+PASS KeyboardEvent constructor (no argument) 
+PASS KeyboardEvent constructor (undefined argument) 
+PASS KeyboardEvent constructor (null argument) 
+PASS KeyboardEvent constructor (empty argument) 
+PASS KeyboardEvent constructor (argument with default values) 
+FAIL KeyboardEvent constructor (argument with non-default values) assert_equals: The value of the charCode property should be 7 expected 7 but got 0
</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="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -337,6 +337,7 @@
</span><span class="cx"> fast/shadow-dom/shadow-host-removal-crash.html [ Skip ]
</span><span class="cx"> fast/shadow-dom/input-element-in-shadow.html [ Skip ]
</span><span class="cx"> fast/events/keyboardevent-key.html [ Skip ]
</span><ins>+fast/events/keyboardevent-code.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # The file-wrapper part of &lt;attachment&gt; is not yet working on iOS
</span><span class="cx"> fast/attachment/attachment-type-attribute.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorfasteventsconstructorskeyboardeventconstructorexpectedtxtfromrev206802trunkLayoutTestsfasteventsconstructorskeyboardeventconstructorexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt (from rev 206802, trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt) (0 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -0,0 +1,124 @@
</span><ins>+This tests the constructor for the KeyboardEvent DOM class.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS new KeyboardEvent('eventType').bubbles is false
+PASS new KeyboardEvent('eventType').cancelable is false
+PASS new KeyboardEvent('eventType').view is null
+PASS new KeyboardEvent('eventType').detail is 0
+PASS new KeyboardEvent('eventType').keyIdentifier is &quot;&quot;
+PASS new KeyboardEvent('eventType').location is 0
+PASS new KeyboardEvent('eventType').ctrlKey is false
+PASS new KeyboardEvent('eventType').altKey is false
+PASS new KeyboardEvent('eventType').shiftKey is false
+PASS new KeyboardEvent('eventType').metaKey is false
+PASS new KeyboardEvent('eventType', { bubbles: false }).bubbles is false
+PASS new KeyboardEvent('eventType', { bubbles: true }).bubbles is true
+PASS new KeyboardEvent('eventType', { cancelable: false }).cancelable is false
+PASS new KeyboardEvent('eventType', { cancelable: true }).cancelable is true
+PASS new KeyboardEvent('eventType', { view: window }).view is window
+PASS new KeyboardEvent('eventType', { view: this }).view is this
+PASS new KeyboardEvent('eventType', { }).repeat is false
+PASS new KeyboardEvent('eventType', { repeat: false }).repeat is false
+PASS new KeyboardEvent('eventType', { repeat: true }).repeat is true
+PASS new KeyboardEvent('eventType', { }).isComposing is false
+PASS new KeyboardEvent('eventType', { isComposing: false }).isComposing is false
+PASS new KeyboardEvent('eventType', { isComposing: true }).isComposing is true
+PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: undefined }).view is null
+PASS new KeyboardEvent('eventType', { view: null }).view is null
+PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } }) threw exception KeyboardEvent Error.
+PASS new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier is &quot;koakuma&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: '' }).keyIdentifier is &quot;&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is &quot;undefined&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier is &quot;null&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier is &quot;false&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: true }).keyIdentifier is &quot;true&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: 12345 }).keyIdentifier is &quot;12345&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: 18446744073709551615 }).keyIdentifier is &quot;18446744073709552000&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: NaN }).keyIdentifier is &quot;NaN&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: [] }).keyIdentifier is &quot;&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: [1, 2, 3] }).keyIdentifier is &quot;1,2,3&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: {koakuma: 12345} }).keyIdentifier is &quot;[object Object]&quot;
+PASS new KeyboardEvent('eventType', { keyIdentifier: {valueOf: function () { return 'koakuma'; } } }).keyIdentifier is &quot;[object Object]&quot;
+PASS new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCATION_STANDARD }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCATION_LEFT }).location is KeyboardEvent.DOM_KEY_LOCATION_LEFT
+PASS new KeyboardEvent('eventType', { location: 4294967294 }).location is 4294967294
+PASS new KeyboardEvent('eventType', { location: 4294967295 }).location is 4294967295
+PASS new KeyboardEvent('eventType', { location: 9007199254740991 }).location is 4294967295
+PASS new KeyboardEvent('eventType', { location: 18446744073709551615 }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: 12345678901234567890 }).location is 3944679424
+PASS new KeyboardEvent('eventType', { location: -1 }).location is 4294967295
+PASS new KeyboardEvent('eventType', { location: 123.45 }).location is 123
+PASS new KeyboardEvent('eventType', { location: NaN }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: undefined }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: null }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: '' }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: '12345' }).location is 12345
+PASS new KeyboardEvent('eventType', { location: '12345a' }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: 'abc' }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: [] }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: [12345] }).location is 12345
+PASS new KeyboardEvent('eventType', { location: [12345, 67890] }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: {} }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: {moemoe: 12345} }).location is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { location: {valueOf: function () { return 12345; }} }).location is 12345
+PASS new KeyboardEvent('eventType', { keyLocation: KeyboardEvent.DOM_KEY_LOCATION_STANDARD }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: KeyboardEvent.DOM_KEY_LOCATION_LEFT }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_LEFT
+PASS new KeyboardEvent('eventType', { keyLocation: 4294967294 }).keyLocation is 4294967294
+PASS new KeyboardEvent('eventType', { keyLocation: 4294967295 }).keyLocation is 4294967295
+PASS new KeyboardEvent('eventType', { keyLocation: 9007199254740991 }).keyLocation is 4294967295
+PASS new KeyboardEvent('eventType', { keyLocation: 18446744073709551615 }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: 12345678901234567890 }).keyLocation is 3944679424
+PASS new KeyboardEvent('eventType', { keyLocation: -1 }).keyLocation is 4294967295
+PASS new KeyboardEvent('eventType', { keyLocation: 123.45 }).keyLocation is 123
+PASS new KeyboardEvent('eventType', { keyLocation: NaN }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: undefined }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: null }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: '' }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: '12345' }).keyLocation is 12345
+PASS new KeyboardEvent('eventType', { keyLocation: '12345a' }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: 'abc' }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: [] }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: [12345] }).keyLocation is 12345
+PASS new KeyboardEvent('eventType', { keyLocation: [12345, 67890] }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: {} }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: {moemoe: 12345} }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_STANDARD
+PASS new KeyboardEvent('eventType', { keyLocation: {valueOf: function () { return 12345; }} }).keyLocation is 12345
+PASS new KeyboardEvent('eventType', { keyLocation: KeyboardEvent.DOM_KEY_LOCATION_LEFT }).location is KeyboardEvent.DOM_KEY_LOCATION_LEFT
+PASS new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCATION_LEFT }).keyLocation is KeyboardEvent.DOM_KEY_LOCATION_LEFT
+PASS new KeyboardEvent('eventType', { ctrlKey: false }).ctrlKey is false
+PASS new KeyboardEvent('eventType', { ctrlKey: true }).ctrlKey is true
+PASS new KeyboardEvent('eventType', { altKey: false }).altKey is false
+PASS new KeyboardEvent('eventType', { altKey: true }).altKey is true
+PASS new KeyboardEvent('eventType', { shiftKey: false }).shiftKey is false
+PASS new KeyboardEvent('eventType', { shiftKey: true }).shiftKey is true
+PASS new KeyboardEvent('eventType', { metaKey: false }).metaKey is false
+PASS new KeyboardEvent('eventType', { metaKey: true }).metaKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view is window
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).detail is 111
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).key is &quot;a&quot;
+FAIL new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).code should be KeyA (of type string). Was undefined (of type undefined).
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier is &quot;chocolate&quot;
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).location is 222
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).ctrlKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).altKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).shiftKey is true
+PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).metaKey is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestsdomeventsEventsubclassesconstructorsexpectedtxtfromrev206802trunkLayoutTestsimportedw3cwebplatformtestsdomeventsEventsubclassesconstructorsexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt (from rev 206802, trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt) (0 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+
+PASS Event constructor (no argument) 
+PASS Event constructor (undefined argument) 
+PASS Event constructor (null argument) 
+PASS Event constructor (empty argument) 
+PASS Event constructor (argument with default values) 
+PASS Event constructor (argument with non-default values) 
+PASS UIEvent constructor (no argument) 
+PASS UIEvent constructor (undefined argument) 
+PASS UIEvent constructor (null argument) 
+PASS UIEvent constructor (empty argument) 
+PASS UIEvent constructor (argument with default values) 
+PASS UIEvent constructor (argument with non-default values) 
+PASS FocusEvent constructor (no argument) 
+PASS FocusEvent constructor (undefined argument) 
+PASS FocusEvent constructor (null argument) 
+PASS FocusEvent constructor (empty argument) 
+PASS FocusEvent constructor (argument with default values) 
+PASS FocusEvent constructor (argument with non-default values) 
+FAIL MouseEvent constructor (no argument) assert_true: Event object &quot;[object MouseEvent]&quot; should have a buttons property expected true got false
+FAIL MouseEvent constructor (undefined argument) assert_true: Event object &quot;[object MouseEvent]&quot; should have a buttons property expected true got false
+FAIL MouseEvent constructor (null argument) assert_true: Event object &quot;[object MouseEvent]&quot; should have a buttons property expected true got false
+FAIL MouseEvent constructor (empty argument) assert_true: Event object &quot;[object MouseEvent]&quot; should have a buttons property expected true got false
+FAIL MouseEvent constructor (argument with default values) assert_true: Event object &quot;[object MouseEvent]&quot; should have a buttons property expected true got false
+FAIL MouseEvent constructor (argument with non-default values) assert_true: Event object &quot;[object MouseEvent]&quot; should have a buttons property expected true got false
+FAIL WheelEvent constructor (no argument) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
+FAIL WheelEvent constructor (undefined argument) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
+FAIL WheelEvent constructor (null argument) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
+FAIL WheelEvent constructor (empty argument) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
+FAIL WheelEvent constructor (argument with default values) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
+FAIL WheelEvent constructor (argument with non-default values) assert_true: Event object &quot;[object WheelEvent]&quot; should have a buttons property expected true got false
+FAIL KeyboardEvent constructor (no argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
+FAIL KeyboardEvent constructor (undefined argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
+FAIL KeyboardEvent constructor (null argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
+FAIL KeyboardEvent constructor (empty argument) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
+FAIL KeyboardEvent constructor (argument with default values) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
+FAIL KeyboardEvent constructor (argument with non-default values) assert_true: Event object &quot;[object KeyboardEvent]&quot; should have a code property expected true got false
+PASS CompositionEvent constructor (no argument) 
+PASS CompositionEvent constructor (undefined argument) 
+PASS CompositionEvent constructor (null argument) 
+PASS CompositionEvent constructor (empty argument) 
+PASS CompositionEvent constructor (argument with default values) 
+PASS CompositionEvent constructor (argument with non-default values) 
+PASS UIEvent constructor (view argument with wrong type) 
+
</ins></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WTF/ChangeLog        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-10-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Implement KeyboardEvent.code from the UI Event spec
+        https://bugs.webkit.org/show_bug.cgi?id=149584
+
+        Reviewed by Darin Adler.
+
+        Add build time flag to toggle support for the code attribute on
+        KeyboardEvent and only enable it on Mac for now, given that the
+        implementation is missing on other platforms.
+
+        * wtf/FeatureDefines.h:
+
</ins><span class="cx"> 2016-10-03  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for KeyboardEvent.key attribute
</span></span></pre></div>
<a id="trunkSourceWTFwtfFeatureDefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FeatureDefines.h (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FeatureDefines.h        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WTF/wtf/FeatureDefines.h        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -247,6 +247,10 @@
</span><span class="cx"> #define ENABLE_MAC_GESTURE_EVENTS 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_KEYBOARD_CODE_ATTRIBUTE)
+#define ENABLE_KEYBOARD_CODE_ATTRIBUTE 1
+#endif
+
</ins><span class="cx"> #endif /* PLATFORM(MAC) */
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -777,6 +781,10 @@
</span><span class="cx"> #define ENABLE_KEYBOARD_KEY_ATTRIBUTE 0
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_KEYBOARD_CODE_ATTRIBUTE)
+#define ENABLE_KEYBOARD_CODE_ATTRIBUTE 0
+#endif
+
</ins><span class="cx"> /* Asserts, invariants for macro definitions */
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK) &amp;&amp; !ENABLE(VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/ChangeLog        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-10-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Implement KeyboardEvent.code from the UI Event spec
+        https://bugs.webkit.org/show_bug.cgi?id=149584
+
+        Reviewed by Darin Adler.
+
+        Add support for Keyboard.code attribute:
+        - https://w3c.github.io/uievents/#dom-keyboardevent-code
+        - https://w3c.github.io/uievents-code/
+
+        The feature is only enabled on Mac for now as the implementation is
+        platform-specific and Mac only.
+
+        Test: fast/events/keyboardevent-code.html
+
+        * dom/KeyboardEvent.cpp:
+        (WebCore::KeyboardEvent::KeyboardEvent):
+        * dom/KeyboardEvent.h:
+        * dom/KeyboardEvent.idl:
+        * platform/PlatformKeyboardEvent.h:
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
+        (WebCore::PlatformKeyboardEvent::code):
+        (WebCore::PlatformKeyboardEvent::unmodifiedText): Deleted.
+        * platform/mac/PlatformEventFactoryMac.h:
+        * platform/mac/PlatformEventFactoryMac.mm:
+        (WebCore::codeForKeyEvent):
+        (WebCore::keyIdentifierForKeyEvent):
+        * replay/SerializationMethods.cpp:
+        (JSC::EncodingTraits&lt;PlatformKeyboardEvent&gt;::encodeValue):
+        (JSC::EncodingTraits&lt;PlatformKeyboardEvent&gt;::decodeValue):
+
</ins><span class="cx"> 2016-10-04  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The dragged image should be the current frame only of the animated image
</span></span></pre></div>
<a id="trunkSourceWebCoredomKeyboardEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/KeyboardEvent.cpp        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -101,6 +101,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     , m_key(key.key())
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    , m_code(key.code())
+#endif
</ins><span class="cx">     , m_keyIdentifier(key.keyIdentifier())
</span><span class="cx">     , m_location(keyLocationCode(key))
</span><span class="cx">     , m_repeat(key.isAutoRepeat())
</span><span class="lines">@@ -128,6 +131,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     , m_key(initializer.key)
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    , m_code(initializer.code)
+#endif
</ins><span class="cx">     , m_keyIdentifier(initializer.keyIdentifier)
</span><span class="cx">     , m_location(initializer.location)
</span><span class="cx">     , m_repeat(initializer.repeat)
</span></span></pre></div>
<a id="trunkSourceWebCoredomKeyboardEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/KeyboardEvent.h (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/KeyboardEvent.h        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -37,6 +37,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     String key;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    String code;
+#endif
</ins><span class="cx">     String keyIdentifier;
</span><span class="cx">     unsigned location { 0 };
</span><span class="cx">     bool repeat { false };
</span><span class="lines">@@ -83,6 +86,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     const String&amp; key() const { return m_key; }
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    const String&amp; code() const { return m_code; }
+#endif
</ins><span class="cx"> 
</span><span class="cx">     const String&amp; keyIdentifier() const { return m_keyIdentifier; }
</span><span class="cx">     unsigned location() const { return m_location; }
</span><span class="lines">@@ -123,6 +129,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     String m_key;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    String m_code;
+#endif
</ins><span class="cx">     String m_keyIdentifier;
</span><span class="cx">     unsigned m_location { DOM_KEY_LOCATION_STANDARD };
</span><span class="cx">     bool m_repeat { false };
</span></span></pre></div>
<a id="trunkSourceWebCoredomKeyboardEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/KeyboardEvent.idl (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/KeyboardEvent.idl        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/dom/KeyboardEvent.idl        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -29,10 +29,7 @@
</span><span class="cx">     const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
</span><span class="cx"> 
</span><span class="cx">     [InitializedByEventConstructor, Conditional=KEYBOARD_KEY_ATTRIBUTE] readonly attribute DOMString key;
</span><del>-
-    // FIXME: We should support this.
-    // [InitializedByEventConstructor] readonly attribute DOMString code;
-
</del><ins>+    [InitializedByEventConstructor, Conditional=KEYBOARD_CODE_ATTRIBUTE] readonly attribute DOMString code;
</ins><span class="cx">     [InitializedByEventConstructor] readonly attribute unsigned long location;
</span><span class="cx"> 
</span><span class="cx">     [InitializedByEventConstructor] readonly attribute boolean ctrlKey;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformPlatformKeyboardEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/PlatformKeyboardEvent.h (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/PlatformKeyboardEvent.h        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/platform/PlatformKeyboardEvent.h        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -74,6 +74,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">         const String&amp; key,
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+        const String&amp; code,
+#endif
</ins><span class="cx">         const String&amp; keyIdentifier, int windowsVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet&lt;Modifier&gt; modifiers, double timestamp)
</span><span class="cx">             : PlatformEvent(type, modifiers, timestamp)
</span><span class="cx">             , m_text(text)
</span><span class="lines">@@ -81,6 +84,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">             , m_key(key)
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+            , m_code(code)
+#endif
</ins><span class="cx">             , m_keyIdentifier(keyIdentifier)
</span><span class="cx">             , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
</span><span class="cx"> #if USE(APPKIT) || PLATFORM(GTK)
</span><span class="lines">@@ -112,6 +118,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">         const String&amp; key() const { return m_key; }
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+        const String&amp; code() const { return m_code; }
+#endif
</ins><span class="cx"> 
</span><span class="cx">         // Most compatible Windows virtual key code associated with the event.
</span><span class="cx">         // Zero for Char events.
</span><span class="lines">@@ -168,6 +177,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">         String m_key;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+        String m_code;
+#endif
</ins><span class="cx">         String m_keyIdentifier;
</span><span class="cx">         int m_windowsVirtualKeyCode;
</span><span class="cx"> #if USE(APPKIT) || PLATFORM(GTK)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPlatformEventFactoryMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> WEBCORE_EXPORT int windowsKeyCodeForKeyEvent(NSEvent *);
</span><span class="cx"> WEBCORE_EXPORT String keyIdentifierForKeyEvent(NSEvent *);
</span><span class="cx"> WEBCORE_EXPORT String keyForKeyEvent(NSEvent *);
</span><ins>+WEBCORE_EXPORT String codeForKeyEvent(NSEvent *);
</ins><span class="cx"> WEBCORE_EXPORT double eventTimeStampSince1970(NSEvent *);
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPlatformEventFactoryMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -286,6 +286,218 @@
</span><span class="cx">     return keyForCharCode([s characterAtIndex:0]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// https://w3c.github.io/uievents-code/
+String codeForKeyEvent(NSEvent *event)
+{
+    switch ([event keyCode]) {
+    // Keys in the alphanumeric section.
+    case kVK_ANSI_Grave: return ASCIILiteral(&quot;Backquote&quot;);
+    case kVK_ANSI_Backslash: return ASCIILiteral(&quot;Backslash&quot;);
+    case kVK_Delete: return ASCIILiteral(&quot;Backspace&quot;);
+    case kVK_ANSI_LeftBracket: return ASCIILiteral(&quot;BracketLeft&quot;);
+    case kVK_ANSI_RightBracket: return ASCIILiteral(&quot;BracketRight&quot;);
+    case kVK_ANSI_Comma: return ASCIILiteral(&quot;Comma&quot;);
+    case kVK_ANSI_0: return ASCIILiteral(&quot;Digit0&quot;);
+    case kVK_ANSI_1: return ASCIILiteral(&quot;Digit1&quot;);
+    case kVK_ANSI_2: return ASCIILiteral(&quot;Digit2&quot;);
+    case kVK_ANSI_3: return ASCIILiteral(&quot;Digit3&quot;);
+    case kVK_ANSI_4: return ASCIILiteral(&quot;Digit4&quot;);
+    case kVK_ANSI_5: return ASCIILiteral(&quot;Digit5&quot;);
+    case kVK_ANSI_6: return ASCIILiteral(&quot;Digit6&quot;);
+    case kVK_ANSI_7: return ASCIILiteral(&quot;Digit7&quot;);
+    case kVK_ANSI_8: return ASCIILiteral(&quot;Digit8&quot;);
+    case kVK_ANSI_9: return ASCIILiteral(&quot;Digit9&quot;);
+    case kVK_ANSI_Equal: return ASCIILiteral(&quot;Equal&quot;);
+    case kVK_ISO_Section: return ASCIILiteral(&quot;IntlBackslash&quot;);
+    case kVK_JIS_Underscore: return ASCIILiteral(&quot;IntlRo&quot;);
+    case kVK_JIS_Yen: return ASCIILiteral(&quot;IntlYen&quot;);
+    case kVK_ANSI_A: return ASCIILiteral(&quot;KeyA&quot;);
+    case kVK_ANSI_B: return ASCIILiteral(&quot;KeyB&quot;);
+    case kVK_ANSI_C: return ASCIILiteral(&quot;KeyC&quot;);
+    case kVK_ANSI_D: return ASCIILiteral(&quot;KeyD&quot;);
+    case kVK_ANSI_E: return ASCIILiteral(&quot;KeyE&quot;);
+    case kVK_ANSI_F: return ASCIILiteral(&quot;KeyF&quot;);
+    case kVK_ANSI_G: return ASCIILiteral(&quot;KeyG&quot;);
+    case kVK_ANSI_H: return ASCIILiteral(&quot;KeyH&quot;);
+    case kVK_ANSI_I: return ASCIILiteral(&quot;KeyI&quot;);
+    case kVK_ANSI_J: return ASCIILiteral(&quot;KeyJ&quot;);
+    case kVK_ANSI_K: return ASCIILiteral(&quot;KeyK&quot;);
+    case kVK_ANSI_L: return ASCIILiteral(&quot;KeyL&quot;);
+    case kVK_ANSI_M: return ASCIILiteral(&quot;KeyM&quot;);
+    case kVK_ANSI_N: return ASCIILiteral(&quot;KeyN&quot;);
+    case kVK_ANSI_O: return ASCIILiteral(&quot;KeyO&quot;);
+    case kVK_ANSI_P: return ASCIILiteral(&quot;KeyP&quot;);
+    case kVK_ANSI_Q: return ASCIILiteral(&quot;KeyQ&quot;);
+    case kVK_ANSI_R: return ASCIILiteral(&quot;KeyR&quot;);
+    case kVK_ANSI_S: return ASCIILiteral(&quot;KeyS&quot;);
+    case kVK_ANSI_T: return ASCIILiteral(&quot;KeyT&quot;);
+    case kVK_ANSI_U: return ASCIILiteral(&quot;KeyU&quot;);
+    case kVK_ANSI_V: return ASCIILiteral(&quot;KeyV&quot;);
+    case kVK_ANSI_W: return ASCIILiteral(&quot;KeyW&quot;);
+    case kVK_ANSI_X: return ASCIILiteral(&quot;KeyX&quot;);
+    case kVK_ANSI_Y: return ASCIILiteral(&quot;KeyY&quot;);
+    case kVK_ANSI_Z: return ASCIILiteral(&quot;KeyZ&quot;);
+    case kVK_ANSI_Minus: return ASCIILiteral(&quot;Minus&quot;);
+    case kVK_ANSI_Period: return ASCIILiteral(&quot;Period&quot;);
+    case kVK_ANSI_Quote: return ASCIILiteral(&quot;Quote&quot;);
+    case kVK_ANSI_Semicolon: return ASCIILiteral(&quot;Semicolon&quot;);
+    case kVK_ANSI_Slash: return ASCIILiteral(&quot;Slash&quot;);
+
+    // Functional keys in alphanumeric section.
+    case kVK_Option: return ASCIILiteral(&quot;AltLeft&quot;);
+    case kVK_RightOption: return ASCIILiteral(&quot;AltRight&quot;);
+    case kVK_CapsLock: return ASCIILiteral(&quot;CapsLock&quot;);
+    // ContextMenu.
+    case kVK_Control: return ASCIILiteral(&quot;ControlLeft&quot;);
+    case kVK_RightControl: return ASCIILiteral(&quot;ControlRight&quot;);
+    case kVK_Return: return ASCIILiteral(&quot;Enter&quot;); //  Labeled Return on Apple keyboards.
+    case kVK_Command: return ASCIILiteral(&quot;MetaLeft&quot;);
+    case kVK_RightCommand: return ASCIILiteral(&quot;MetaRight&quot;);
+    case kVK_Shift: return ASCIILiteral(&quot;ShiftLeft&quot;);
+    case kVK_RightShift: return ASCIILiteral(&quot;ShiftRight&quot;);
+    case kVK_Space: return ASCIILiteral(&quot;Space&quot;);
+    case kVK_Tab: return ASCIILiteral(&quot;Tab&quot;);
+
+    // Functional keys found on Japanese and Korean keyboards.
+    // Convert.
+    case kVK_JIS_Kana: return ASCIILiteral(&quot;KanaMode&quot;);
+    // Lang1.
+    case kVK_JIS_Eisu: return ASCIILiteral(&quot;Lang2&quot;); // Japanese (Mac keyboard): eisu.
+    // Lang3.
+    // Lang4.
+    // Lang5.
+    // NonConvert.
+
+    // Keys in the ControlPad section.
+    case kVK_ForwardDelete: return ASCIILiteral(&quot;Delete&quot;);
+    case kVK_End: return ASCIILiteral(&quot;End&quot;);
+    case kVK_Help: return ASCIILiteral(&quot;Help&quot;);
+    case kVK_Home: return ASCIILiteral(&quot;Home&quot;);
+    // Insert: Not present on Apple keyboards.
+    case kVK_PageDown: return ASCIILiteral(&quot;PageDown&quot;);
+    case kVK_PageUp: return ASCIILiteral(&quot;PageUp&quot;);
+
+    // Keys in the ArrowPad section.
+    case kVK_DownArrow: return ASCIILiteral(&quot;ArrowDown&quot;);
+    case kVK_LeftArrow: return ASCIILiteral(&quot;ArrowLeft&quot;);
+    case kVK_RightArrow: return ASCIILiteral(&quot;ArrowRight&quot;);
+    case kVK_UpArrow: return ASCIILiteral(&quot;ArrowUp&quot;);
+
+    // Keys in the Numpad section.
+    case kVK_ANSI_KeypadClear: return ASCIILiteral(&quot;NumLock&quot;); // The specification says to use &quot;NumLock&quot; on Mac for the numpad Clear key.
+    case kVK_ANSI_Keypad0: return ASCIILiteral(&quot;Numpad0&quot;);
+    case kVK_ANSI_Keypad1: return ASCIILiteral(&quot;Numpad1&quot;);
+    case kVK_ANSI_Keypad2: return ASCIILiteral(&quot;Numpad2&quot;);
+    case kVK_ANSI_Keypad3: return ASCIILiteral(&quot;Numpad3&quot;);
+    case kVK_ANSI_Keypad4: return ASCIILiteral(&quot;Numpad4&quot;);
+    case kVK_ANSI_Keypad5: return ASCIILiteral(&quot;Numpad5&quot;);
+    case kVK_ANSI_Keypad6: return ASCIILiteral(&quot;Numpad6&quot;);
+    case kVK_ANSI_Keypad7: return ASCIILiteral(&quot;Numpad7&quot;);
+    case kVK_ANSI_Keypad8: return ASCIILiteral(&quot;Numpad8&quot;);
+    case kVK_ANSI_Keypad9: return ASCIILiteral(&quot;Numpad9&quot;);
+    case kVK_ANSI_KeypadPlus: return ASCIILiteral(&quot;NumpadAdd&quot;);
+    // NumpadBackspace.
+    // NumpadClear: The specification says that the numpad Clear key should always be encoded as &quot;NumLock&quot; on Mac.
+    // NumpadClearEntry.
+    case kVK_JIS_KeypadComma: return ASCIILiteral(&quot;NumpadComma&quot;);
+    case kVK_ANSI_KeypadDecimal: return ASCIILiteral(&quot;NumpadDecimal&quot;);
+    case kVK_ANSI_KeypadDivide: return ASCIILiteral(&quot;NumpadDivide&quot;);
+    case kVK_ANSI_KeypadEnter: return ASCIILiteral(&quot;NumpadEnter&quot;);
+    case kVK_ANSI_KeypadEquals: return ASCIILiteral(&quot;NumpadEqual&quot;);
+    // NumpadHash.
+    // NumpadMemoryAdd.
+    // NumpadMemoryClear.
+    // NumpadMemoryRecall.
+    // NumpadMemoryStore.
+    // NumpadMemorySubtract.
+    case kVK_ANSI_KeypadMultiply: return ASCIILiteral(&quot;NumpadMultiply&quot;);
+    // NumpadParenLeft.
+    // NumpadParenRight.
+    // NumpadStar: The specification says to use &quot;NumpadMultiply&quot; for the * key on numeric keypads.
+    case kVK_ANSI_KeypadMinus: return ASCIILiteral(&quot;NumpadSubtract&quot;);
+
+    // Keys in the Function section.
+    case kVK_Escape: return ASCIILiteral(&quot;Escape&quot;);
+    case kVK_F1: return ASCIILiteral(&quot;F1&quot;);
+    case kVK_F2: return ASCIILiteral(&quot;F2&quot;);
+    case kVK_F3: return ASCIILiteral(&quot;F3&quot;);
+    case kVK_F4: return ASCIILiteral(&quot;F4&quot;);
+    case kVK_F5: return ASCIILiteral(&quot;F5&quot;);
+    case kVK_F6: return ASCIILiteral(&quot;F6&quot;);
+    case kVK_F7: return ASCIILiteral(&quot;F7&quot;);
+    case kVK_F8: return ASCIILiteral(&quot;F8&quot;);
+    case kVK_F9: return ASCIILiteral(&quot;F9&quot;);
+    case kVK_F10: return ASCIILiteral(&quot;F10&quot;);
+    case kVK_F11: return ASCIILiteral(&quot;F11&quot;);
+    case kVK_F12: return ASCIILiteral(&quot;F12&quot;);
+    case kVK_F13: return ASCIILiteral(&quot;F13&quot;);
+    case kVK_F14: return ASCIILiteral(&quot;F14&quot;);
+    case kVK_F15: return ASCIILiteral(&quot;F15&quot;);
+    case kVK_F16: return ASCIILiteral(&quot;F16&quot;);
+    case kVK_F17: return ASCIILiteral(&quot;F17&quot;);
+    case kVK_F18: return ASCIILiteral(&quot;F18&quot;);
+    case kVK_F19: return ASCIILiteral(&quot;F19&quot;);
+    case kVK_F20: return ASCIILiteral(&quot;F20&quot;);
+    // Fn: This is typically a hardware key that does not generate a separate code.
+    // FnLock.
+    // PrintScreen.
+    // ScrollLock.
+    // Pause.
+
+    // Media keys.
+    // BrowserBack.
+    // BrowserFavorites.
+    // BrowserForward.
+    // BrowserHome.
+    // BrowserRefresh.
+    // BrowserSearch.
+    // BrowserStop.
+    // Eject.
+    // LaunchApp1.
+    // LaunchApp2.
+    // LaunchMail.
+    // MediaPlayPause.
+    // MediaSelect.
+    // MediaStop.
+    // MediaTrackNext.
+    // MediaTrackPrevious.
+    // Power.
+    // Sleep.
+    case kVK_VolumeDown: return ASCIILiteral(&quot;AudioVolumeDown&quot;);
+    case kVK_Mute: return ASCIILiteral(&quot;AudioVolumeMute&quot;);
+    case kVK_VolumeUp: return ASCIILiteral(&quot;AudioVolumeUp&quot;);
+    // WakeUp.
+
+    // Legacy modifier keys.
+    // Hyper.
+    // Super.
+    // Turbo.
+
+    // Legacy process control keys.
+    // Abort.
+    // Resume.
+    // Suspend.
+
+    // Legacy editing keys.
+    // Again.
+    // Copy.
+    // Cut.
+    // Find.
+    // Open.
+    // Paste.
+    // Props.
+    // Select.
+    // Undo.
+
+    // Keys found on international keyboards.
+    // Hiragana.
+    // Katakana.
+
+    default:
+        return ASCIILiteral(&quot;Unidentified&quot;);
+    }
+}
+
</ins><span class="cx"> String keyIdentifierForKeyEvent(NSEvent* event)
</span><span class="cx"> {
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200
</span><span class="lines">@@ -612,6 +824,7 @@
</span><span class="cx">         m_unmodifiedText = unmodifiedTextFromEvent(event);
</span><span class="cx">         m_keyIdentifier = keyIdentifierForKeyEvent(event);
</span><span class="cx">         m_key = keyForKeyEvent(event);
</span><ins>+        m_code = codeForKeyEvent(event);
</ins><span class="cx">         m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event);
</span><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorereplaySerializationMethodscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/replay/SerializationMethods.cpp (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/replay/SerializationMethods.cpp        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebCore/replay/SerializationMethods.cpp        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -259,6 +259,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     ENCODE_TYPE_WITH_KEY(encodedValue, String, key, input.key());
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    ENCODE_TYPE_WITH_KEY(encodedValue, String, code, input.code());
+#endif
</ins><span class="cx">     ENCODE_TYPE_WITH_KEY(encodedValue, String, keyIdentifier, input.keyIdentifier());
</span><span class="cx">     ENCODE_TYPE_WITH_KEY(encodedValue, int, windowsVirtualKeyCode, input.windowsVirtualKeyCode());
</span><span class="cx">     ENCODE_TYPE_WITH_KEY(encodedValue, bool, autoRepeat, input.isAutoRepeat());
</span><span class="lines">@@ -281,6 +284,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     DECODE_TYPE_WITH_KEY(encodedValue, String, key);
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    DECODE_TYPE_WITH_KEY(encodedValue, String, code);
+#endif
</ins><span class="cx">     DECODE_TYPE_WITH_KEY(encodedValue, String, keyIdentifier);
</span><span class="cx">     DECODE_TYPE_WITH_KEY(encodedValue, int, windowsVirtualKeyCode);
</span><span class="cx">     DECODE_TYPE_WITH_KEY(encodedValue, bool, autoRepeat);
</span><span class="lines">@@ -295,6 +301,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">         key,
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+        code,
+#endif
</ins><span class="cx">         keyIdentifier, WTF::safeCast&lt;int&gt;(windowsVirtualKeyCode), autoRepeat, keypad, systemKey, modifiers, timestamp);
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebKit2/ChangeLog        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-10-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Implement KeyboardEvent.code from the UI Event spec
+        https://bugs.webkit.org/show_bug.cgi?id=149584
+
+        Reviewed by Darin Adler.
+
+        Add support for Keyboard.code attribute:
+        - https://w3c.github.io/uievents/#dom-keyboardevent-code
+        - https://w3c.github.io/uievents-code/
+
+        * Shared/WebEvent.h:
+        (WebKit::WebKeyboardEvent::code):
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
+        * Shared/WebKeyboardEvent.cpp:
+        (WebKit::WebKeyboardEvent::WebKeyboardEvent):
+        (WebKit::WebKeyboardEvent::encode):
+        (WebKit::WebKeyboardEvent::decode):
+        * Shared/mac/WebEventFactory.mm:
+        (WebKit::WebEventFactory::createWebKeyboardEvent):
+
</ins><span class="cx"> 2016-10-04  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The dragged image should be the current frame only of the animated image
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebEvent.h (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebEvent.h        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebKit2/Shared/WebEvent.h        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -244,7 +244,7 @@
</span><span class="cx">     ~WebKeyboardEvent();
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><del>-    WebKeyboardEvent(Type, const String&amp; text, const String&amp; unmodifiedText, const String&amp; key, const String&amp; keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector&lt;WebCore::KeypressCommand&gt;&amp;, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
</del><ins>+    WebKeyboardEvent(Type, const String&amp; text, const String&amp; unmodifiedText, const String&amp; key, const String&amp; code, const String&amp; keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector&lt;WebCore::KeypressCommand&gt;&amp;, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
</ins><span class="cx"> #elif PLATFORM(GTK)
</span><span class="cx">     WebKeyboardEvent(Type, const String&amp; text, const String&amp; keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector&lt;String&gt;&amp;&amp; commands, bool isKeypad, Modifiers, double timestamp);
</span><span class="cx"> #else
</span><span class="lines">@@ -256,6 +256,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     const String&amp; key() const { return m_key; }
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    const String&amp; code() const { return m_code; }
+#endif
</ins><span class="cx">     const String&amp; keyIdentifier() const { return m_keyIdentifier; }
</span><span class="cx">     int32_t windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
</span><span class="cx">     int32_t nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
</span><span class="lines">@@ -283,6 +286,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     String m_key;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    String m_code;
+#endif
</ins><span class="cx">     String m_keyIdentifier;
</span><span class="cx">     int32_t m_windowsVirtualKeyCode;
</span><span class="cx">     int32_t m_nativeVirtualKeyCode;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebEventConversioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebEventConversion.cpp (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebEventConversion.cpp        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebKit2/Shared/WebEventConversion.cpp        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -194,6 +194,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">         m_key = webEvent.key();
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+        m_code = webEvent.code();
+#endif
</ins><span class="cx">         m_keyIdentifier = webEvent.keyIdentifier();
</span><span class="cx">         m_windowsVirtualKeyCode = webEvent.windowsVirtualKeyCode();
</span><span class="cx"> #if USE(APPKIT) || PLATFORM(GTK)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebKeyboardEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -37,11 +37,12 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><span class="cx"> 
</span><del>-WebKeyboardEvent::WebKeyboardEvent(Type type, const String&amp; text, const String&amp; unmodifiedText, const String&amp; key, const String&amp; keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector&lt;WebCore::KeypressCommand&gt;&amp; commands, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
</del><ins>+WebKeyboardEvent::WebKeyboardEvent(Type type, const String&amp; text, const String&amp; unmodifiedText, const String&amp; key, const String&amp; code, const String&amp; keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector&lt;WebCore::KeypressCommand&gt;&amp; commands, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
</ins><span class="cx">     : WebEvent(type, modifiers, timestamp)
</span><span class="cx">     , m_text(text)
</span><span class="cx">     , m_unmodifiedText(unmodifiedText)
</span><span class="cx">     , m_key(key)
</span><ins>+    , m_code(code)
</ins><span class="cx">     , m_keyIdentifier(keyIdentifier)
</span><span class="cx">     , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
</span><span class="cx">     , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
</span><span class="lines">@@ -106,6 +107,9 @@
</span><span class="cx"> #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
</span><span class="cx">     encoder &lt;&lt; m_key;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    encoder &lt;&lt; m_code;
+#endif
</ins><span class="cx">     encoder &lt;&lt; m_keyIdentifier;
</span><span class="cx">     encoder &lt;&lt; m_windowsVirtualKeyCode;
</span><span class="cx">     encoder &lt;&lt; m_nativeVirtualKeyCode;
</span><span class="lines">@@ -132,6 +136,10 @@
</span><span class="cx">     if (!decoder.decode(result.m_key))
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
+    if (!decoder.decode(result.m_code))
+        return false;
+#endif
</ins><span class="cx">     if (!decoder.decode(result.m_keyIdentifier))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.m_windowsVirtualKeyCode))
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacWebEventFactorymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm (206802 => 206803)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm        2016-10-05 01:52:35 UTC (rev 206802)
+++ trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm        2016-10-05 03:13:35 UTC (rev 206803)
</span><span class="lines">@@ -467,6 +467,7 @@
</span><span class="cx">     String text                     = textFromEvent(event, replacesSoftSpace);
</span><span class="cx">     String unmodifiedText           = unmodifiedTextFromEvent(event, replacesSoftSpace);
</span><span class="cx">     String key                      = keyForKeyEvent(event);
</span><ins>+    String code                     = codeForKeyEvent(event);
</ins><span class="cx">     String keyIdentifier            = keyIdentifierForKeyEvent(event);
</span><span class="cx">     int windowsVirtualKeyCode       = windowsKeyCodeForKeyEvent(event);
</span><span class="cx">     int nativeVirtualKeyCode        = [event keyCode];
</span><span class="lines">@@ -498,7 +499,7 @@
</span><span class="cx">         unmodifiedText = &quot;\x9&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return WebKeyboardEvent(type, text, unmodifiedText, key, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, handledByInputMethod, commands, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
</del><ins>+    return WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, handledByInputMethod, commands, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>