<!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>[210668] 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/210668">210668</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-01-12 10:34:20 -0800 (Thu, 12 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Implement support for KeyboardEvent.code
https://bugs.webkit.org/show_bug.cgi?id=166932
&lt;rdar://problem/29972518&gt;

Reviewed by Darin Adler.

Source/WebCore:

Implement support for KeyboardEvent.code on iOS.

No new tests, updated existing test.

* platform/ios/PlatformEventFactoryIOS.h:
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::codeForKeyEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):

Source/WebKit2:

Make sure KeyboardEvent.code is properly initialized on
iOS WK2.

* Shared/WebEvent.h:
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
* Shared/ios/WebIOSEventFactory.mm:
(WebIOSEventFactory::createWebKeyboardEvent):

Source/WTF:

Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.

* wtf/FeatureDefines.h:

LayoutTests:

Extend layout test coverage and rebaseline a couple of existing tests
now that more checks are passing.

* fast/events/ios/keyboard-event-key-attribute-expected.txt:
* fast/events/ios/keyboard-event-key-attribute.html:
* platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt:
* platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventsioskeyboardeventkeyattributeexpectedtxt">trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsioskeyboardeventkeyattributehtml">trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html</a></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>
<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="#trunkSourceWebCoreplatformiosPlatformEventFactoryIOSh">trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosPlatformEventFactoryIOSmm">trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm</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="#trunkSourceWebKit2SharedWebKeyboardEventcpp">trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharediosWebIOSEventFactorymm">trunk/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/LayoutTests/ChangeLog        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-01-12  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [iOS] Implement support for KeyboardEvent.code
+        https://bugs.webkit.org/show_bug.cgi?id=166932
+        &lt;rdar://problem/29972518&gt;
+
+        Reviewed by Darin Adler.
+
+        Extend layout test coverage and rebaseline a couple of existing tests
+        now that more checks are passing.
+
+        * fast/events/ios/keyboard-event-key-attribute-expected.txt:
+        * fast/events/ios/keyboard-event-key-attribute.html:
+        * platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt:
+        * platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:
+
</ins><span class="cx"> 2017-01-12  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebIDL] Autogenerate named getters
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsioskeyboardeventkeyattributeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute-expected.txt        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -4,6 +4,9 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS event.key is &quot;a&quot;
</span><ins>+PASS event.code is &quot;KeyA&quot;
+PASS event.key is &quot;@&quot;
+PASS event.code is &quot;Digit2&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsioskeyboardeventkeyattributehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/LayoutTests/fast/events/ios/keyboard-event-key-attribute.html        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -10,6 +10,8 @@
</span><span class="cx"> description(&quot;Tests that KeyboardEvent.key is properly initialized on iOS.&quot;);
</span><span class="cx"> jsTestIsAsync = true;
</span><span class="cx"> 
</span><ins>+var tests = [['a', 'KeyA'], ['@', 'Digit2']];
+
</ins><span class="cx"> function getTypingUIScript(x, y)
</span><span class="cx"> {
</span><span class="cx">     return `
</span><span class="lines">@@ -16,7 +18,9 @@
</span><span class="cx">         (function() {
</span><span class="cx">             uiController.didShowKeyboardCallback = function() {
</span><span class="cx">                 uiController.typeCharacterUsingHardwareKeyboard('a', function() {
</span><del>-                    uiController.uiScriptComplete();
</del><ins>+                    uiController.typeCharacterUsingHardwareKeyboard('@', function() {
+                        uiController.uiScriptComplete();
+                    });
</ins><span class="cx">                 });
</span><span class="cx">             };
</span><span class="cx">             uiController.singleTapAtPoint(${x}, ${y}, function() { });
</span><span class="lines">@@ -23,11 +27,15 @@
</span><span class="cx">         })();`
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+var i = 0;
</ins><span class="cx"> var testInput = document.getElementById(&quot;testInput&quot;);
</span><span class="cx"> testInput.onkeydown = function(e) {
</span><span class="cx">     event = e;
</span><del>-    shouldBeEqualToString(&quot;event.key&quot;, &quot;a&quot;);
-    finishJSTest();
</del><ins>+    shouldBeEqualToString(&quot;event.key&quot;, &quot;&quot; + tests[i][0]);
+    shouldBeEqualToString(&quot;event.code&quot;, &quot;&quot; + tests[i][1]);
+    i++;
+    if (i == tests.length)
+        finishJSTest();
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> const x = testInput.offsetLeft + 5;
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorfasteventsconstructorskeyboardeventconstructorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx"> 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
</span><span class="cx"> 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
</span><span class="cx"> 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;
</span><del>-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).
</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 }).code is &quot;KeyA&quot;
</ins><span class="cx"> 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;
</span><span class="cx"> 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
</span><span class="cx"> 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
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorimportedw3cwebplatformtestsdomeventsEventsubclassesconstructorsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt (210667 => 210668)</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        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt        2017-01-12 18:34:20 UTC (rev 210668)
</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) 
+PASS KeyboardEvent constructor (argument with non-default values) 
</ins><span class="cx"> PASS CompositionEvent constructor (no argument) 
</span><span class="cx"> PASS CompositionEvent constructor (undefined argument) 
</span><span class="cx"> PASS CompositionEvent constructor (null argument) 
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WTF/ChangeLog        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-01-12  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [iOS] Implement support for KeyboardEvent.code
+        https://bugs.webkit.org/show_bug.cgi?id=166932
+        &lt;rdar://problem/29972518&gt;
+
+        Reviewed by Darin Adler.
+
+        Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.
+
+        * wtf/FeatureDefines.h:
+
</ins><span class="cx"> 2017-01-11  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash when WebCore's GC heap grows way too large.
</span></span></pre></div>
<a id="trunkSourceWTFwtfFeatureDefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FeatureDefines.h (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FeatureDefines.h        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WTF/wtf/FeatureDefines.h        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -247,10 +247,6 @@
</span><span class="cx"> #define ENABLE_MAC_GESTURE_EVENTS 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if !defined(ENABLE_KEYBOARD_CODE_ATTRIBUTE)
-#define ENABLE_KEYBOARD_CODE_ATTRIBUTE 1
-#endif
-
</del><span class="cx"> #endif /* PLATFORM(MAC) */
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -263,6 +259,10 @@
</span><span class="cx"> #define ENABLE_KEYBOARD_KEY_ATTRIBUTE 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(COCOA) */
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebCore/ChangeLog        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-01-12  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [iOS] Implement support for KeyboardEvent.code
+        https://bugs.webkit.org/show_bug.cgi?id=166932
+        &lt;rdar://problem/29972518&gt;
+
+        Reviewed by Darin Adler.
+
+        Implement support for KeyboardEvent.code on iOS.
+
+        No new tests, updated existing test.
+
+        * platform/ios/PlatformEventFactoryIOS.h:
+        * platform/ios/PlatformEventFactoryIOS.mm:
+        (WebCore::codeForKeyEvent):
+        (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
+
</ins><span class="cx"> 2017-01-12  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebIDL] Autogenerate named getters
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosPlatformEventFactoryIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.h (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.h        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.h        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WEBCORE_EXPORT String keyForKeyEvent(WebEvent *);
</span><ins>+WEBCORE_EXPORT String codeForKeyEvent(WebEvent *);
</ins><span class="cx"> WEBCORE_EXPORT String keyIdentifierForKeyEvent(WebEvent *);
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosPlatformEventFactoryIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;WAKAppKitStubs.h&quot;
</span><span class="cx"> #import &quot;WebEvent.h&quot;
</span><ins>+#import &quot;WindowsKeyboardCodes.h&quot;
</ins><span class="cx"> #import &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -148,6 +149,218 @@
</span><span class="cx">     return keyForCharCode([characters characterAtIndex:0]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// https://w3c.github.io/uievents-code/
+String codeForKeyEvent(WebEvent *event)
+{
+    switch (event.keyCode) {
+    // Keys in the alphanumeric section.
+    case VK_OEM_3: return ASCIILiteral(&quot;Backquote&quot;);
+    case VK_OEM_5: return ASCIILiteral(&quot;Backslash&quot;);
+    case VK_BACK: return ASCIILiteral(&quot;Backspace&quot;);
+    case VK_OEM_4: return ASCIILiteral(&quot;BracketLeft&quot;);
+    case VK_OEM_6: return ASCIILiteral(&quot;BracketRight&quot;);
+    case VK_OEM_COMMA: return ASCIILiteral(&quot;Comma&quot;);
+    case VK_0: return ASCIILiteral(&quot;Digit0&quot;);
+    case VK_1: return ASCIILiteral(&quot;Digit1&quot;);
+    case VK_2: return ASCIILiteral(&quot;Digit2&quot;);
+    case VK_3: return ASCIILiteral(&quot;Digit3&quot;);
+    case VK_4: return ASCIILiteral(&quot;Digit4&quot;);
+    case VK_5: return ASCIILiteral(&quot;Digit5&quot;);
+    case VK_6: return ASCIILiteral(&quot;Digit6&quot;);
+    case VK_7: return ASCIILiteral(&quot;Digit7&quot;);
+    case VK_8: return ASCIILiteral(&quot;Digit8&quot;);
+    case VK_9: return ASCIILiteral(&quot;Digit9&quot;);
+    case VK_OEM_PLUS: return ASCIILiteral(&quot;Equal&quot;);
+    case VK_OEM_102: return ASCIILiteral(&quot;IntlBackslash&quot;);
+    // IntlRo.
+    // IntlYen.
+    case VK_A: return ASCIILiteral(&quot;KeyA&quot;);
+    case VK_B: return ASCIILiteral(&quot;KeyB&quot;);
+    case VK_C: return ASCIILiteral(&quot;KeyC&quot;);
+    case VK_D: return ASCIILiteral(&quot;KeyD&quot;);
+    case VK_E: return ASCIILiteral(&quot;KeyE&quot;);
+    case VK_F: return ASCIILiteral(&quot;KeyF&quot;);
+    case VK_G: return ASCIILiteral(&quot;KeyG&quot;);
+    case VK_H: return ASCIILiteral(&quot;KeyH&quot;);
+    case VK_I: return ASCIILiteral(&quot;KeyI&quot;);
+    case VK_J: return ASCIILiteral(&quot;KeyJ&quot;);
+    case VK_K: return ASCIILiteral(&quot;KeyK&quot;);
+    case VK_L: return ASCIILiteral(&quot;KeyL&quot;);
+    case VK_M: return ASCIILiteral(&quot;KeyM&quot;);
+    case VK_N: return ASCIILiteral(&quot;KeyN&quot;);
+    case VK_O: return ASCIILiteral(&quot;KeyO&quot;);
+    case VK_P: return ASCIILiteral(&quot;KeyP&quot;);
+    case VK_Q: return ASCIILiteral(&quot;KeyQ&quot;);
+    case VK_R: return ASCIILiteral(&quot;KeyR&quot;);
+    case VK_S: return ASCIILiteral(&quot;KeyS&quot;);
+    case VK_T: return ASCIILiteral(&quot;KeyT&quot;);
+    case VK_U: return ASCIILiteral(&quot;KeyU&quot;);
+    case VK_V: return ASCIILiteral(&quot;KeyV&quot;);
+    case VK_W: return ASCIILiteral(&quot;KeyW&quot;);
+    case VK_X: return ASCIILiteral(&quot;KeyX&quot;);
+    case VK_Y: return ASCIILiteral(&quot;KeyY&quot;);
+    case VK_Z: return ASCIILiteral(&quot;KeyZ&quot;);
+    case VK_OEM_MINUS: return ASCIILiteral(&quot;Minus&quot;);
+    case VK_OEM_PERIOD: return ASCIILiteral(&quot;Period&quot;);
+    case VK_OEM_7: return ASCIILiteral(&quot;Quote&quot;);
+    case VK_OEM_1: return ASCIILiteral(&quot;Semicolon&quot;);
+    case VK_OEM_2: return ASCIILiteral(&quot;Slash&quot;);
+
+    // Functional keys in alphanumeric section.
+    case VK_MENU: return ASCIILiteral(&quot;AltLeft&quot;);
+    // AltRight.
+    case VK_CAPITAL: return ASCIILiteral(&quot;CapsLock&quot;);
+    // ContextMenu.
+    case VK_LCONTROL: return ASCIILiteral(&quot;ControlLeft&quot;);
+    case VK_RCONTROL: return ASCIILiteral(&quot;ControlRight&quot;);
+    case VK_RETURN: return ASCIILiteral(&quot;Enter&quot;); //  Labeled Return on Apple keyboards.
+    case VK_LWIN: return ASCIILiteral(&quot;MetaLeft&quot;);
+    case VK_RWIN: return ASCIILiteral(&quot;MetaRight&quot;);
+    case VK_LSHIFT: return ASCIILiteral(&quot;ShiftLeft&quot;);
+    case VK_RSHIFT: return ASCIILiteral(&quot;ShiftRight&quot;);
+    case VK_SPACE: return ASCIILiteral(&quot;Space&quot;);
+    case VK_TAB: return ASCIILiteral(&quot;Tab&quot;);
+
+    // Functional keys found on Japanese and Korean keyboards.
+    // Convert.
+    case VK_KANA: return ASCIILiteral(&quot;KanaMode&quot;);
+    // Lang1.
+    // Lang2.
+    // Lang3.
+    // Lang4.
+    // Lang5.
+    // NonConvert.
+
+    // Keys in the ControlPad section.
+    // Delete
+    case VK_END: return ASCIILiteral(&quot;End&quot;);
+    case VK_HELP: return ASCIILiteral(&quot;Help&quot;);
+    case VK_HOME: return ASCIILiteral(&quot;Home&quot;);
+    // Insert: Not present on Apple keyboards.
+    case VK_NEXT: return ASCIILiteral(&quot;PageDown&quot;);
+    case VK_PRIOR: return ASCIILiteral(&quot;PageUp&quot;);
+
+    // Keys in the ArrowPad section.
+    case VK_DOWN: return ASCIILiteral(&quot;ArrowDown&quot;);
+    case VK_LEFT: return ASCIILiteral(&quot;ArrowLeft&quot;);
+    case VK_RIGHT: return ASCIILiteral(&quot;ArrowRight&quot;);
+    case VK_UP: return ASCIILiteral(&quot;ArrowUp&quot;);
+
+    // Keys in the Numpad section.
+    case VK_NUMLOCK: return ASCIILiteral(&quot;NumLock&quot;);
+    case VK_NUMPAD0: return ASCIILiteral(&quot;Numpad0&quot;);
+    case VK_NUMPAD1: return ASCIILiteral(&quot;Numpad1&quot;);
+    case VK_NUMPAD2: return ASCIILiteral(&quot;Numpad2&quot;);
+    case VK_NUMPAD3: return ASCIILiteral(&quot;Numpad3&quot;);
+    case VK_NUMPAD4: return ASCIILiteral(&quot;Numpad4&quot;);
+    case VK_NUMPAD5: return ASCIILiteral(&quot;Numpad5&quot;);
+    case VK_NUMPAD6: return ASCIILiteral(&quot;Numpad6&quot;);
+    case VK_NUMPAD7: return ASCIILiteral(&quot;Numpad7&quot;);
+    case VK_NUMPAD8: return ASCIILiteral(&quot;Numpad8&quot;);
+    case VK_NUMPAD9: return ASCIILiteral(&quot;Numpad9&quot;);
+    case VK_ADD: return ASCIILiteral(&quot;NumpadAdd&quot;);
+    // NumpadBackspace.
+    // NumpadClear.
+    // NumpadClearEntry.
+    case VK_SEPARATOR: return ASCIILiteral(&quot;NumpadComma&quot;);
+    case VK_DECIMAL: return ASCIILiteral(&quot;NumpadDecimal&quot;);
+    case VK_DIVIDE: return ASCIILiteral(&quot;NumpadDivide&quot;);
+    // NumpadEnter.
+    case VK_CLEAR: return ASCIILiteral(&quot;NumpadEqual&quot;);
+    // NumpadHash.
+    // NumpadMemoryAdd.
+    // NumpadMemoryClear.
+    // NumpadMemoryRecall.
+    // NumpadMemoryStore.
+    // NumpadMemorySubtract.
+    case VK_MULTIPLY: return ASCIILiteral(&quot;NumpadMultiply&quot;);
+    // NumpadParenLeft.
+    // NumpadParenRight.
+    // NumpadStar: The specification says to use &quot;NumpadMultiply&quot; for the * key on numeric keypads.
+    case VK_SUBTRACT: return ASCIILiteral(&quot;NumpadSubtract&quot;);
+
+    // Keys in the Function section.
+    case VK_ESCAPE: return ASCIILiteral(&quot;Escape&quot;);
+    case VK_F1: return ASCIILiteral(&quot;F1&quot;);
+    case VK_F2: return ASCIILiteral(&quot;F2&quot;);
+    case VK_F3: return ASCIILiteral(&quot;F3&quot;);
+    case VK_F4: return ASCIILiteral(&quot;F4&quot;);
+    case VK_F5: return ASCIILiteral(&quot;F5&quot;);
+    case VK_F6: return ASCIILiteral(&quot;F6&quot;);
+    case VK_F7: return ASCIILiteral(&quot;F7&quot;);
+    case VK_F8: return ASCIILiteral(&quot;F8&quot;);
+    case VK_F9: return ASCIILiteral(&quot;F9&quot;);
+    case VK_F10: return ASCIILiteral(&quot;F10&quot;);
+    case VK_F11: return ASCIILiteral(&quot;F11&quot;);
+    case VK_F12: return ASCIILiteral(&quot;F12&quot;);
+    case VK_F13: return ASCIILiteral(&quot;F13&quot;);
+    case VK_F14: return ASCIILiteral(&quot;F14&quot;);
+    case VK_F15: return ASCIILiteral(&quot;F15&quot;);
+    case VK_F16: return ASCIILiteral(&quot;F16&quot;);
+    case VK_F17: return ASCIILiteral(&quot;F17&quot;);
+    case VK_F18: return ASCIILiteral(&quot;F18&quot;);
+    case VK_F19: return ASCIILiteral(&quot;F19&quot;);
+    case VK_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 VK_VOLUME_DOWN: return ASCIILiteral(&quot;AudioVolumeDown&quot;);
+    case VK_VOLUME_MUTE: return ASCIILiteral(&quot;AudioVolumeMute&quot;);
+    case VK_VOLUME_UP: 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"> class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent {
</span><span class="cx"> public:
</span><span class="cx">     PlatformKeyboardEventBuilder(WebEvent *event)
</span><span class="lines">@@ -161,6 +374,7 @@
</span><span class="cx">         m_text = event.characters;
</span><span class="cx">         m_unmodifiedText = event.charactersIgnoringModifiers;
</span><span class="cx">         m_key = keyForKeyEvent(event);
</span><ins>+        m_code = codeForKeyEvent(event);
</ins><span class="cx">         m_keyIdentifier = keyIdentifierForKeyEvent(event);
</span><span class="cx">         m_windowsVirtualKeyCode = event.keyCode;
</span><span class="cx">         m_autoRepeat = event.isKeyRepeating;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-01-12  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [iOS] Implement support for KeyboardEvent.code
+        https://bugs.webkit.org/show_bug.cgi?id=166932
+        &lt;rdar://problem/29972518&gt;
+
+        Reviewed by Darin Adler.
+
+        Make sure KeyboardEvent.code is properly initialized on
+        iOS WK2.
+
+        * Shared/WebEvent.h:
+        * Shared/WebKeyboardEvent.cpp:
+        (WebKit::WebKeyboardEvent::WebKeyboardEvent):
+        * Shared/ios/WebIOSEventFactory.mm:
+        (WebIOSEventFactory::createWebKeyboardEvent):
+
</ins><span class="cx"> 2017-01-12  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebBackForwardListProxy should remove restored session history items from PageCache on close.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebEvent.h (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebEvent.h        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebKit2/Shared/WebEvent.h        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx"> #elif PLATFORM(GTK)
</span><span class="cx">     WebKeyboardEvent(Type, const String&amp; text, const String&amp; key, const String&amp; code, 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"> #elif PLATFORM(IOS)
</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 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 isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
</ins><span class="cx"> #else
</span><span class="cx">     WebKeyboardEvent(Type, const String&amp; text, const String&amp; unmodifiedText, const String&amp; keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebKeyboardEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -79,11 +79,12 @@
</span><span class="cx"> 
</span><span class="cx"> #elif PLATFORM(IOS)
</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 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 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></pre></div>
<a id="trunkSourceWebKit2SharediosWebIOSEventFactorymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm (210667 => 210668)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm        2017-01-12 18:30:53 UTC (rev 210667)
+++ trunk/Source/WebKit2/Shared/ios/WebIOSEventFactory.mm        2017-01-12 18:34:20 UTC (rev 210668)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     String text = event.characters;
</span><span class="cx">     String unmodifiedText = event.charactersIgnoringModifiers;
</span><span class="cx">     String key = WebCore::keyForKeyEvent(event);
</span><ins>+    String code = WebCore::codeForKeyEvent(event);
</ins><span class="cx">     String keyIdentifier = WebCore::keyIdentifierForKeyEvent(event);
</span><span class="cx">     int windowsVirtualKeyCode = event.keyCode;
</span><span class="cx">     int nativeVirtualKeyCode = event.keyCode;
</span><span class="lines">@@ -84,7 +85,7 @@
</span><span class="cx">         unmodifiedText = text;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return WebKit::WebKeyboardEvent(type, text, unmodifiedText, key, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
</del><ins>+    return WebKit::WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre>
</div>
</div>

</body>
</html>