<!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
<rdar://problem/29972518>
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 <cdumez@apple.com>
+
+ [iOS] Implement support for KeyboardEvent.code
+ https://bugs.webkit.org/show_bug.cgi?id=166932
+ <rdar://problem/29972518>
+
+ 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 <sam@webkit.org>
</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 "a"
</span><ins>+PASS event.code is "KeyA"
+PASS event.key is "@"
+PASS event.code is "Digit2"
</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("Tests that KeyboardEvent.key is properly initialized on iOS.");
</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("testInput");
</span><span class="cx"> testInput.onkeydown = function(e) {
</span><span class="cx"> event = e;
</span><del>- shouldBeEqualToString("event.key", "a");
- finishJSTest();
</del><ins>+ shouldBeEqualToString("event.key", "" + tests[i][0]);
+ shouldBeEqualToString("event.code", "" + 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 "a"
</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 "KeyA"
</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 "chocolate"
</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 "[object WheelEvent]" should have a buttons property expected true got false
</span><span class="cx"> FAIL WheelEvent constructor (argument with default values) assert_true: Event object "[object WheelEvent]" 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 "[object WheelEvent]" should have a buttons property expected true got false
</span><del>-FAIL KeyboardEvent constructor (no argument) assert_true: Event object "[object KeyboardEvent]" should have a code property expected true got false
-FAIL KeyboardEvent constructor (undefined argument) assert_true: Event object "[object KeyboardEvent]" should have a code property expected true got false
-FAIL KeyboardEvent constructor (null argument) assert_true: Event object "[object KeyboardEvent]" should have a code property expected true got false
-FAIL KeyboardEvent constructor (empty argument) assert_true: Event object "[object KeyboardEvent]" should have a code property expected true got false
-FAIL KeyboardEvent constructor (argument with default values) assert_true: Event object "[object KeyboardEvent]" should have a code property expected true got false
-FAIL KeyboardEvent constructor (argument with non-default values) assert_true: Event object "[object KeyboardEvent]" 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 <cdumez@apple.com>
+
+ [iOS] Implement support for KeyboardEvent.code
+ https://bugs.webkit.org/show_bug.cgi?id=166932
+ <rdar://problem/29972518>
+
+ Reviewed by Darin Adler.
+
+ Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.
+
+ * wtf/FeatureDefines.h:
+
</ins><span class="cx"> 2017-01-11 Andreas Kling <akling@apple.com>
</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 <cdumez@apple.com>
+
+ [iOS] Implement support for KeyboardEvent.code
+ https://bugs.webkit.org/show_bug.cgi?id=166932
+ <rdar://problem/29972518>
+
+ 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 <sam@webkit.org>
</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 "Logging.h"
</span><span class="cx"> #import "WAKAppKitStubs.h"
</span><span class="cx"> #import "WebEvent.h"
</span><ins>+#import "WindowsKeyboardCodes.h"
</ins><span class="cx"> #import <wtf/CurrentTime.h>
</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("Backquote");
+ case VK_OEM_5: return ASCIILiteral("Backslash");
+ case VK_BACK: return ASCIILiteral("Backspace");
+ case VK_OEM_4: return ASCIILiteral("BracketLeft");
+ case VK_OEM_6: return ASCIILiteral("BracketRight");
+ case VK_OEM_COMMA: return ASCIILiteral("Comma");
+ case VK_0: return ASCIILiteral("Digit0");
+ case VK_1: return ASCIILiteral("Digit1");
+ case VK_2: return ASCIILiteral("Digit2");
+ case VK_3: return ASCIILiteral("Digit3");
+ case VK_4: return ASCIILiteral("Digit4");
+ case VK_5: return ASCIILiteral("Digit5");
+ case VK_6: return ASCIILiteral("Digit6");
+ case VK_7: return ASCIILiteral("Digit7");
+ case VK_8: return ASCIILiteral("Digit8");
+ case VK_9: return ASCIILiteral("Digit9");
+ case VK_OEM_PLUS: return ASCIILiteral("Equal");
+ case VK_OEM_102: return ASCIILiteral("IntlBackslash");
+ // IntlRo.
+ // IntlYen.
+ case VK_A: return ASCIILiteral("KeyA");
+ case VK_B: return ASCIILiteral("KeyB");
+ case VK_C: return ASCIILiteral("KeyC");
+ case VK_D: return ASCIILiteral("KeyD");
+ case VK_E: return ASCIILiteral("KeyE");
+ case VK_F: return ASCIILiteral("KeyF");
+ case VK_G: return ASCIILiteral("KeyG");
+ case VK_H: return ASCIILiteral("KeyH");
+ case VK_I: return ASCIILiteral("KeyI");
+ case VK_J: return ASCIILiteral("KeyJ");
+ case VK_K: return ASCIILiteral("KeyK");
+ case VK_L: return ASCIILiteral("KeyL");
+ case VK_M: return ASCIILiteral("KeyM");
+ case VK_N: return ASCIILiteral("KeyN");
+ case VK_O: return ASCIILiteral("KeyO");
+ case VK_P: return ASCIILiteral("KeyP");
+ case VK_Q: return ASCIILiteral("KeyQ");
+ case VK_R: return ASCIILiteral("KeyR");
+ case VK_S: return ASCIILiteral("KeyS");
+ case VK_T: return ASCIILiteral("KeyT");
+ case VK_U: return ASCIILiteral("KeyU");
+ case VK_V: return ASCIILiteral("KeyV");
+ case VK_W: return ASCIILiteral("KeyW");
+ case VK_X: return ASCIILiteral("KeyX");
+ case VK_Y: return ASCIILiteral("KeyY");
+ case VK_Z: return ASCIILiteral("KeyZ");
+ case VK_OEM_MINUS: return ASCIILiteral("Minus");
+ case VK_OEM_PERIOD: return ASCIILiteral("Period");
+ case VK_OEM_7: return ASCIILiteral("Quote");
+ case VK_OEM_1: return ASCIILiteral("Semicolon");
+ case VK_OEM_2: return ASCIILiteral("Slash");
+
+ // Functional keys in alphanumeric section.
+ case VK_MENU: return ASCIILiteral("AltLeft");
+ // AltRight.
+ case VK_CAPITAL: return ASCIILiteral("CapsLock");
+ // ContextMenu.
+ case VK_LCONTROL: return ASCIILiteral("ControlLeft");
+ case VK_RCONTROL: return ASCIILiteral("ControlRight");
+ case VK_RETURN: return ASCIILiteral("Enter"); // Labeled Return on Apple keyboards.
+ case VK_LWIN: return ASCIILiteral("MetaLeft");
+ case VK_RWIN: return ASCIILiteral("MetaRight");
+ case VK_LSHIFT: return ASCIILiteral("ShiftLeft");
+ case VK_RSHIFT: return ASCIILiteral("ShiftRight");
+ case VK_SPACE: return ASCIILiteral("Space");
+ case VK_TAB: return ASCIILiteral("Tab");
+
+ // Functional keys found on Japanese and Korean keyboards.
+ // Convert.
+ case VK_KANA: return ASCIILiteral("KanaMode");
+ // Lang1.
+ // Lang2.
+ // Lang3.
+ // Lang4.
+ // Lang5.
+ // NonConvert.
+
+ // Keys in the ControlPad section.
+ // Delete
+ case VK_END: return ASCIILiteral("End");
+ case VK_HELP: return ASCIILiteral("Help");
+ case VK_HOME: return ASCIILiteral("Home");
+ // Insert: Not present on Apple keyboards.
+ case VK_NEXT: return ASCIILiteral("PageDown");
+ case VK_PRIOR: return ASCIILiteral("PageUp");
+
+ // Keys in the ArrowPad section.
+ case VK_DOWN: return ASCIILiteral("ArrowDown");
+ case VK_LEFT: return ASCIILiteral("ArrowLeft");
+ case VK_RIGHT: return ASCIILiteral("ArrowRight");
+ case VK_UP: return ASCIILiteral("ArrowUp");
+
+ // Keys in the Numpad section.
+ case VK_NUMLOCK: return ASCIILiteral("NumLock");
+ case VK_NUMPAD0: return ASCIILiteral("Numpad0");
+ case VK_NUMPAD1: return ASCIILiteral("Numpad1");
+ case VK_NUMPAD2: return ASCIILiteral("Numpad2");
+ case VK_NUMPAD3: return ASCIILiteral("Numpad3");
+ case VK_NUMPAD4: return ASCIILiteral("Numpad4");
+ case VK_NUMPAD5: return ASCIILiteral("Numpad5");
+ case VK_NUMPAD6: return ASCIILiteral("Numpad6");
+ case VK_NUMPAD7: return ASCIILiteral("Numpad7");
+ case VK_NUMPAD8: return ASCIILiteral("Numpad8");
+ case VK_NUMPAD9: return ASCIILiteral("Numpad9");
+ case VK_ADD: return ASCIILiteral("NumpadAdd");
+ // NumpadBackspace.
+ // NumpadClear.
+ // NumpadClearEntry.
+ case VK_SEPARATOR: return ASCIILiteral("NumpadComma");
+ case VK_DECIMAL: return ASCIILiteral("NumpadDecimal");
+ case VK_DIVIDE: return ASCIILiteral("NumpadDivide");
+ // NumpadEnter.
+ case VK_CLEAR: return ASCIILiteral("NumpadEqual");
+ // NumpadHash.
+ // NumpadMemoryAdd.
+ // NumpadMemoryClear.
+ // NumpadMemoryRecall.
+ // NumpadMemoryStore.
+ // NumpadMemorySubtract.
+ case VK_MULTIPLY: return ASCIILiteral("NumpadMultiply");
+ // NumpadParenLeft.
+ // NumpadParenRight.
+ // NumpadStar: The specification says to use "NumpadMultiply" for the * key on numeric keypads.
+ case VK_SUBTRACT: return ASCIILiteral("NumpadSubtract");
+
+ // Keys in the Function section.
+ case VK_ESCAPE: return ASCIILiteral("Escape");
+ case VK_F1: return ASCIILiteral("F1");
+ case VK_F2: return ASCIILiteral("F2");
+ case VK_F3: return ASCIILiteral("F3");
+ case VK_F4: return ASCIILiteral("F4");
+ case VK_F5: return ASCIILiteral("F5");
+ case VK_F6: return ASCIILiteral("F6");
+ case VK_F7: return ASCIILiteral("F7");
+ case VK_F8: return ASCIILiteral("F8");
+ case VK_F9: return ASCIILiteral("F9");
+ case VK_F10: return ASCIILiteral("F10");
+ case VK_F11: return ASCIILiteral("F11");
+ case VK_F12: return ASCIILiteral("F12");
+ case VK_F13: return ASCIILiteral("F13");
+ case VK_F14: return ASCIILiteral("F14");
+ case VK_F15: return ASCIILiteral("F15");
+ case VK_F16: return ASCIILiteral("F16");
+ case VK_F17: return ASCIILiteral("F17");
+ case VK_F18: return ASCIILiteral("F18");
+ case VK_F19: return ASCIILiteral("F19");
+ case VK_F20: return ASCIILiteral("F20");
+ // 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("AudioVolumeDown");
+ case VK_VOLUME_MUTE: return ASCIILiteral("AudioVolumeMute");
+ case VK_VOLUME_UP: return ASCIILiteral("AudioVolumeUp");
+ // 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("Unidentified");
+ }
+}
+
</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 <cdumez@apple.com>
+
+ [iOS] Implement support for KeyboardEvent.code
+ https://bugs.webkit.org/show_bug.cgi?id=166932
+ <rdar://problem/29972518>
+
+ 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 <akling@apple.com>
</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& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers, double timestamp);
</span><span class="cx"> #elif PLATFORM(IOS)
</span><del>- WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
</del><ins>+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& 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& text, const String& unmodifiedText, const String& 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& text, const String& unmodifiedText, const String& key, const String& 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& text, const String& unmodifiedText, const String& key, const String& code, const String& 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>