<!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>[210504] 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/210504">210504</a></dd>
<dt>Author</dt> <dd>gns@gnome.org</dd>
<dt>Date</dt> <dd>2017-01-09 06:14:57 -0800 (Mon, 09 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Should support key and code properties on keyboard events
https://bugs.webkit.org/show_bug.cgi?id=166759

Reviewed by Carlos Garcia Campos.

Source/WebCore:

This change fixes a bunch of tests which are currently failing, such as:
- fast/events/arrow-keys-on-body.html
- fast/events/constructors/keyboard-event-constructor.html
- fast/events/key-events-in-input-button.html
- fast/events/key-events-in-input-text.html
- fast/events/keyboardevent-code.html
- fast/events/keyboardevent-key.html

* platform/PlatformKeyboardEvent.h:
* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
to GDK key symbol.
(WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
to hardware code as reported by GDK.
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
code to the keyboard event upon creation.

Source/WebKit2:

* Shared/WebEvent.h:
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent): accept web key value and code on construction.
* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebKeyboardEvent): pass web key value and code on construction.

Source/WTF:

* wtf/FeatureDefines.h: enable key and code properties support for GTK.

Tools:

* WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
(WTR::getGDKKeySymForKeyRef): add missing modifier keys which were being reported as 'l' and 'r' only
on tests.

LayoutTests:

* platform/gtk/fast/events/keyboardevent-code-expected.txt: Added. Hardware
codes are different for Mac and Linux for a couple of keys, so we need
platform-specific results.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</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="#trunkSourceWebCoreplatformPlatformKeyboardEventh">trunk/Source/WebCore/platform/PlatformKeyboardEvent.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkPlatformKeyboardEventGtkcpp">trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.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="#trunkSourceWebKit2SharedWebKeyboardEventcpp">trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedgtkWebEventFactorycpp">trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnergtkEventSenderProxyGtkcpp">trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformgtkfasteventskeyboardeventcodeexpectedtxt">trunk/LayoutTests/platform/gtk/fast/events/keyboardevent-code-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/LayoutTests/ChangeLog        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-01-06  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.co.uk&gt;
+
+        [GTK] Should support key and code properties on keyboard events
+        https://bugs.webkit.org/show_bug.cgi?id=166759
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/fast/events/keyboardevent-code-expected.txt: Added. Hardware
+        codes are different for Mac and Linux for a couple of keys, so we need
+        platform-specific results.
+
</ins><span class="cx"> 2017-01-09  Alejandro G. Castro  &lt;alex@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkfasteventskeyboardeventcodeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/gtk/fast/events/keyboardevent-code-expected.txt (0 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/fast/events/keyboardevent-code-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/gtk/fast/events/keyboardevent-code-expected.txt        2017-01-09 14:14:57 UTC (rev 210504)
</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
+FAIL keyboardEvent.code should be Minus. Was Escape.
+* keyup
+FAIL keyboardEvent.code should be Minus. Was Escape.
+
+* 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
+FAIL keyboardEvent.code should be NumpadEnter. Was Enter.
+* keyup
+FAIL keyboardEvent.code should be NumpadEnter. Was Enter.
+
+* 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="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WTF/ChangeLog        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2017-01-06  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.co.uk&gt;
+
+        [GTK] Should support key and code properties on keyboard events
+        https://bugs.webkit.org/show_bug.cgi?id=166759
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wtf/FeatureDefines.h: enable key and code properties support for GTK.
+
</ins><span class="cx"> 2017-01-08  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move cache coders to WTF
</span></span></pre></div>
<a id="trunkSourceWTFwtfFeatureDefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FeatureDefines.h (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FeatureDefines.h        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WTF/wtf/FeatureDefines.h        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -324,6 +324,13 @@
</span><span class="cx"> 
</span><span class="cx"> /* --------- Gtk port (Unix, Windows, Mac) --------- */
</span><span class="cx"> #if PLATFORM(GTK)
</span><ins>+#if !defined(ENABLE_KEYBOARD_KEY_ATTRIBUTE)
+#define ENABLE_KEYBOARD_KEY_ATTRIBUTE 1
+#endif
+
+#if !defined(ENABLE_KEYBOARD_CODE_ATTRIBUTE)
+#define ENABLE_KEYBOARD_CODE_ATTRIBUTE 1
+#endif
</ins><span class="cx"> #endif /* PLATFORM(GTK) */
</span><span class="cx"> 
</span><span class="cx"> /* ENABLE macro defaults for WebCore */
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebCore/ChangeLog        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2017-01-06  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.co.uk&gt;
+
+        [GTK] Should support key and code properties on keyboard events
+        https://bugs.webkit.org/show_bug.cgi?id=166759
+
+        Reviewed by Carlos Garcia Campos.
+
+        This change fixes a bunch of tests which are currently failing, such as:
+        - fast/events/arrow-keys-on-body.html
+        - fast/events/constructors/keyboard-event-constructor.html
+        - fast/events/key-events-in-input-button.html
+        - fast/events/key-events-in-input-text.html
+        - fast/events/keyboardevent-code.html
+        - fast/events/keyboardevent-key.html
+
+        * platform/PlatformKeyboardEvent.h:
+        * platform/gtk/PlatformKeyboardEventGtk.cpp:
+        (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
+        to GDK key symbol.
+        (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
+        to hardware code as reported by GDK.
+        (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
+        code to the keyboard event upon creation.
+
</ins><span class="cx"> 2017-01-09  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] WebProcess from WebKitGtk+ 2.15.2 SIGSEGVs in std::unique_ptr&lt;SoupBuffer, WTF::GPtrDeleter&lt;SoupBuffer&gt; &gt;::get() const () at /usr/include/c++/6/bits/unique_ptr.h:305
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformPlatformKeyboardEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/PlatformKeyboardEvent.h (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/PlatformKeyboardEvent.h        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebCore/platform/PlatformKeyboardEvent.h        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -161,6 +161,8 @@
</span><span class="cx">         const CompositionResults&amp; compositionResults() const { return m_compositionResults; }
</span><span class="cx"> 
</span><span class="cx">         // Used by WebKit2
</span><ins>+        static String keyValueForGdkKeyCode(unsigned);
+        static String keyCodeForHardwareKeyCode(unsigned);
</ins><span class="cx">         static String keyIdentifierForGdkKeyCode(unsigned);
</span><span class="cx">         static int windowsKeyCodeForGdkKeyCode(unsigned);
</span><span class="cx">         static String singleCharacterString(unsigned);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkPlatformKeyboardEventGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -34,10 +34,10 @@
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> #include &quot;TextEncoding.h&quot;
</span><span class="cx"> #include &quot;WindowsKeyboardCodes.h&quot;
</span><del>-
</del><span class="cx"> #include &lt;gdk/gdk.h&gt;
</span><span class="cx"> #include &lt;gdk/gdkkeysyms.h&gt;
</span><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><ins>+#include &lt;wtf/glib/GUniquePtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -44,6 +44,692 @@
</span><span class="cx"> // FIXME: This is incomplete.  We should change this to mirror
</span><span class="cx"> // more like what Firefox does, and generate these switch statements
</span><span class="cx"> // at build time.
</span><ins>+// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
+String PlatformKeyboardEvent::keyValueForGdkKeyCode(unsigned keyCode)
+{
+    switch (keyCode) {
+    // Modifier keys.
+    case GDK_KEY_Alt_L:
+    case GDK_KEY_Alt_R:
+        return ASCIILiteral(&quot;Alt&quot;);
+    // Firefox uses GDK_KEY_Mode_switch for AltGraph as well.
+    case GDK_KEY_ISO_Level3_Shift:
+    case GDK_KEY_ISO_Level3_Latch:
+    case GDK_KEY_ISO_Level3_Lock:
+    case GDK_KEY_ISO_Level5_Shift:
+    case GDK_KEY_ISO_Level5_Latch:
+    case GDK_KEY_ISO_Level5_Lock:
+        return ASCIILiteral(&quot;AltGraph&quot;);
+    case GDK_KEY_Caps_Lock:
+        return ASCIILiteral(&quot;CapsLock&quot;);
+    case GDK_KEY_Control_L:
+    case GDK_KEY_Control_R:
+        return ASCIILiteral(&quot;Control&quot;);
+    // Fn: This is typically a hardware key that does not generate a separate code.
+    // FnLock.
+    case GDK_KEY_Hyper_L:
+    case GDK_KEY_Hyper_R:
+        return ASCIILiteral(&quot;Hyper&quot;);
+    case GDK_KEY_Meta_L:
+    case GDK_KEY_Meta_R:
+        return ASCIILiteral(&quot;Meta&quot;);
+    case GDK_KEY_Num_Lock:
+        return ASCIILiteral(&quot;NumLock&quot;);
+    case GDK_KEY_Scroll_Lock:
+        return ASCIILiteral(&quot;ScrollLock&quot;);
+    case GDK_KEY_Shift_L:
+    case GDK_KEY_Shift_R:
+        return ASCIILiteral(&quot;Shift&quot;);
+    case GDK_KEY_Super_L:
+    case GDK_KEY_Super_R:
+        return ASCIILiteral(&quot;Super&quot;);
+    // Symbol.
+    // SymbolLock.
+
+    // Whitespace keys.
+    case GDK_KEY_Return:
+    case GDK_KEY_KP_Enter:
+    case GDK_KEY_ISO_Enter:
+    case GDK_KEY_3270_Enter:
+        return ASCIILiteral(&quot;Enter&quot;);
+    case GDK_KEY_Tab:
+    case GDK_KEY_KP_Tab:
+        return ASCIILiteral(&quot;Tab&quot;);
+
+    // Navigation keys.
+    case GDK_KEY_Down:
+    case GDK_KEY_KP_Down:
+        return ASCIILiteral(&quot;ArrowDown&quot;);
+    case GDK_KEY_Left:
+    case GDK_KEY_KP_Left:
+        return ASCIILiteral(&quot;ArrowLeft&quot;);
+    case GDK_KEY_Right:
+    case GDK_KEY_KP_Right:
+        return ASCIILiteral(&quot;ArrowRight&quot;);
+    case GDK_KEY_Up:
+    case GDK_KEY_KP_Up:
+        return ASCIILiteral(&quot;ArrowUp&quot;);
+    case GDK_KEY_End:
+    case GDK_KEY_KP_End:
+        return ASCIILiteral(&quot;End&quot;);
+    case GDK_KEY_Home:
+    case GDK_KEY_KP_Home:
+        return ASCIILiteral(&quot;Home&quot;);
+    case GDK_KEY_Page_Down:
+    case GDK_KEY_KP_Page_Down:
+        return ASCIILiteral(&quot;PageDown&quot;);
+    case GDK_KEY_Page_Up:
+    case GDK_KEY_KP_Page_Up:
+        return ASCIILiteral(&quot;PageUp&quot;);
+
+    // Editing keys.
+    case GDK_KEY_BackSpace:
+        return ASCIILiteral(&quot;Backspace&quot;);
+    case GDK_KEY_Clear:
+        return ASCIILiteral(&quot;Clear&quot;);
+    case GDK_KEY_Copy:
+        return ASCIILiteral(&quot;Copy&quot;);
+    case GDK_KEY_3270_CursorSelect:
+        return ASCIILiteral(&quot;CrSel&quot;);
+    case GDK_KEY_Cut:
+        return ASCIILiteral(&quot;Cut&quot;);
+    case GDK_KEY_Delete:
+    case GDK_KEY_KP_Delete:
+        return ASCIILiteral(&quot;Delete&quot;);
+    case GDK_KEY_3270_EraseEOF:
+        return ASCIILiteral(&quot;EraseEof&quot;);
+    case GDK_KEY_3270_ExSelect:
+        return ASCIILiteral(&quot;ExSel&quot;);
+    case GDK_KEY_Insert:
+    case GDK_KEY_KP_Insert:
+        return ASCIILiteral(&quot;Insert&quot;);
+    case GDK_KEY_Paste:
+        return ASCIILiteral(&quot;Paste&quot;);
+    case GDK_KEY_Redo:
+        return ASCIILiteral(&quot;Redo&quot;);
+    case GDK_KEY_Undo:
+        return ASCIILiteral(&quot;Undo&quot;);
+
+    // UI keys.
+    // Accept.
+    // Again.
+    case GDK_KEY_3270_Attn:
+        return ASCIILiteral(&quot;Attn&quot;);
+    case GDK_KEY_Cancel:
+        return ASCIILiteral(&quot;Cancel&quot;);
+    case GDK_KEY_Menu:
+        return ASCIILiteral(&quot;ContextMenu&quot;);
+    case GDK_KEY_Escape:
+        return ASCIILiteral(&quot;Escape&quot;);
+    case GDK_KEY_Execute:
+        return ASCIILiteral(&quot;Execute&quot;);
+    case GDK_KEY_Find:
+        return ASCIILiteral(&quot;Find&quot;);
+    case GDK_KEY_Help:
+        return ASCIILiteral(&quot;Help&quot;);
+    case GDK_KEY_Pause:
+    case GDK_KEY_Break:
+        return ASCIILiteral(&quot;Pause&quot;);
+    case GDK_KEY_3270_Play:
+        return ASCIILiteral(&quot;Play&quot;);
+    // Props.
+    case GDK_KEY_Select:
+        return ASCIILiteral(&quot;Select&quot;);
+    case GDK_KEY_ZoomIn:
+        return ASCIILiteral(&quot;ZoomIn&quot;);
+    case GDK_KEY_ZoomOut:
+        return ASCIILiteral(&quot;ZoomOut&quot;);
+
+    // Device keys.
+    case GDK_KEY_MonBrightnessDown:
+        return ASCIILiteral(&quot;BrightnessDown&quot;);
+    case GDK_KEY_MonBrightnessUp:
+        return ASCIILiteral(&quot;BrightnessUp&quot;);
+    case GDK_KEY_Eject:
+        return ASCIILiteral(&quot;Eject&quot;);
+    case GDK_KEY_LogOff:
+        return ASCIILiteral(&quot;LogOff&quot;);
+    // Power.
+    case GDK_KEY_PowerDown:
+    case GDK_KEY_PowerOff:
+        return ASCIILiteral(&quot;PowerOff&quot;);
+    case GDK_KEY_3270_PrintScreen:
+    case GDK_KEY_Print:
+    case GDK_KEY_Sys_Req:
+        return ASCIILiteral(&quot;PrintScreen&quot;);
+    case GDK_KEY_Hibernate:
+        return ASCIILiteral(&quot;Hibernate&quot;);
+    case GDK_KEY_Standby:
+    case GDK_KEY_Suspend:
+    case GDK_KEY_Sleep:
+        return ASCIILiteral(&quot;Standby&quot;);
+    case GDK_KEY_WakeUp:
+        return ASCIILiteral(&quot;WakeUp&quot;);
+
+    // IME keys.
+    case GDK_KEY_MultipleCandidate:
+        return ASCIILiteral(&quot;AllCandidates&quot;);
+    case GDK_KEY_Eisu_Shift:
+    case GDK_KEY_Eisu_toggle:
+        return ASCIILiteral(&quot;Alphanumeric&quot;);
+    case GDK_KEY_Codeinput:
+        return ASCIILiteral(&quot;CodeInput&quot;);
+    case GDK_KEY_Multi_key:
+        return ASCIILiteral(&quot;Compose&quot;);
+    case GDK_KEY_Henkan:
+        return ASCIILiteral(&quot;Convert&quot;);
+    case GDK_KEY_dead_grave:
+    case GDK_KEY_dead_acute:
+    case GDK_KEY_dead_circumflex:
+    case GDK_KEY_dead_tilde:
+    case GDK_KEY_dead_macron:
+    case GDK_KEY_dead_breve:
+    case GDK_KEY_dead_abovedot:
+    case GDK_KEY_dead_diaeresis:
+    case GDK_KEY_dead_abovering:
+    case GDK_KEY_dead_doubleacute:
+    case GDK_KEY_dead_caron:
+    case GDK_KEY_dead_cedilla:
+    case GDK_KEY_dead_ogonek:
+    case GDK_KEY_dead_iota:
+    case GDK_KEY_dead_voiced_sound:
+    case GDK_KEY_dead_semivoiced_sound:
+    case GDK_KEY_dead_belowdot:
+    case GDK_KEY_dead_hook:
+    case GDK_KEY_dead_horn:
+    case GDK_KEY_dead_stroke:
+    case GDK_KEY_dead_abovecomma:
+    case GDK_KEY_dead_abovereversedcomma:
+    case GDK_KEY_dead_doublegrave:
+    case GDK_KEY_dead_belowring:
+    case GDK_KEY_dead_belowmacron:
+    case GDK_KEY_dead_belowcircumflex:
+    case GDK_KEY_dead_belowtilde:
+    case GDK_KEY_dead_belowbreve:
+    case GDK_KEY_dead_belowdiaeresis:
+    case GDK_KEY_dead_invertedbreve:
+    case GDK_KEY_dead_belowcomma:
+    case GDK_KEY_dead_currency:
+    case GDK_KEY_dead_a:
+    case GDK_KEY_dead_A:
+    case GDK_KEY_dead_e:
+    case GDK_KEY_dead_E:
+    case GDK_KEY_dead_i:
+    case GDK_KEY_dead_I:
+    case GDK_KEY_dead_o:
+    case GDK_KEY_dead_O:
+    case GDK_KEY_dead_u:
+    case GDK_KEY_dead_U:
+    case GDK_KEY_dead_small_schwa:
+    case GDK_KEY_dead_capital_schwa:
+        return ASCIILiteral(&quot;Dead&quot;);
+    // FinalMode
+    case GDK_KEY_ISO_First_Group:
+        return ASCIILiteral(&quot;GroupFirst&quot;);
+    case GDK_KEY_ISO_Last_Group:
+        return ASCIILiteral(&quot;GroupLast&quot;);
+    case GDK_KEY_ISO_Next_Group:
+        return ASCIILiteral(&quot;GroupNext&quot;);
+    case GDK_KEY_ISO_Prev_Group:
+        return ASCIILiteral(&quot;GroupPrevious&quot;);
+    case GDK_KEY_Mode_switch:
+        return ASCIILiteral(&quot;ModeChange&quot;);
+    // NextCandidate.
+    case GDK_KEY_Muhenkan:
+        return ASCIILiteral(&quot;NonConvert&quot;);
+    case GDK_KEY_PreviousCandidate:
+        return ASCIILiteral(&quot;PreviousCandidate&quot;);
+    // Process.
+    case GDK_KEY_SingleCandidate:
+        return ASCIILiteral(&quot;SingleCandidate&quot;);
+
+    // Korean and Japanese keys.
+    case GDK_KEY_Hangul:
+        return ASCIILiteral(&quot;HangulMode&quot;);
+    case GDK_KEY_Hangul_Hanja:
+        return ASCIILiteral(&quot;HanjaMode&quot;);
+    case GDK_KEY_Hangul_Jeonja:
+        return ASCIILiteral(&quot;JunjaMode&quot;);
+    case GDK_KEY_Hankaku:
+        return ASCIILiteral(&quot;Hankaku&quot;);
+    case GDK_KEY_Hiragana:
+        return ASCIILiteral(&quot;Hiragana&quot;);
+    case GDK_KEY_Hiragana_Katakana:
+        return ASCIILiteral(&quot;HiraganaKatakana&quot;);
+    case GDK_KEY_Kana_Lock:
+    case GDK_KEY_Kana_Shift:
+        return ASCIILiteral(&quot;KanaMode&quot;);
+    case GDK_KEY_Kanji:
+        return ASCIILiteral(&quot;KanjiMode&quot;);
+    case GDK_KEY_Katakana:
+        return ASCIILiteral(&quot;Katakana&quot;);
+    case GDK_KEY_Romaji:
+        return ASCIILiteral(&quot;Romaji&quot;);
+    case GDK_KEY_Zenkaku:
+        return ASCIILiteral(&quot;Zenkaku&quot;);
+    case GDK_KEY_Zenkaku_Hankaku:
+        return ASCIILiteral(&quot;ZenkakuHanaku&quot;);
+
+    // Multimedia keys.
+    // ChannelDown.
+    // ChannelUp.
+    case GDK_KEY_Close:
+        return ASCIILiteral(&quot;Close&quot;);
+    case GDK_KEY_MailForward:
+        return ASCIILiteral(&quot;MailForward&quot;);
+    case GDK_KEY_Reply:
+        return ASCIILiteral(&quot;MailReply&quot;);
+    case GDK_KEY_Send:
+        return ASCIILiteral(&quot;MailSend&quot;);
+    case GDK_KEY_AudioForward:
+        return ASCIILiteral(&quot;MediaFastForward&quot;);
+    case GDK_KEY_AudioPause:
+        return ASCIILiteral(&quot;MediaPause&quot;);
+    case GDK_KEY_AudioPlay:
+        return ASCIILiteral(&quot;MediaPlay&quot;);
+    // MediaPlayPause
+    case GDK_KEY_AudioRecord:
+        return ASCIILiteral(&quot;MediaRecord&quot;);
+    case GDK_KEY_AudioRewind:
+        return ASCIILiteral(&quot;MediaRewind&quot;);
+    case GDK_KEY_AudioStop:
+        return ASCIILiteral(&quot;MediaStop&quot;);
+    case GDK_KEY_AudioNext:
+        return ASCIILiteral(&quot;MediaTrackNext&quot;);
+    case GDK_KEY_AudioPrev:
+        return ASCIILiteral(&quot;MediaTrackPrevious&quot;);
+    case GDK_KEY_New:
+        return ASCIILiteral(&quot;New&quot;);
+    case GDK_KEY_Open:
+        return ASCIILiteral(&quot;Open&quot;);
+    // Print.
+    case GDK_KEY_Save:
+        return ASCIILiteral(&quot;Save&quot;);
+    case GDK_KEY_Spell:
+        return ASCIILiteral(&quot;SpellCheck&quot;);
+
+    // Function keys.
+    case GDK_KEY_F1:
+        return ASCIILiteral(&quot;F1&quot;);
+    case GDK_KEY_F2:
+        return ASCIILiteral(&quot;F2&quot;);
+    case GDK_KEY_F3:
+        return ASCIILiteral(&quot;F3&quot;);
+    case GDK_KEY_F4:
+        return ASCIILiteral(&quot;F4&quot;);
+    case GDK_KEY_F5:
+        return ASCIILiteral(&quot;F5&quot;);
+    case GDK_KEY_F6:
+        return ASCIILiteral(&quot;F6&quot;);
+    case GDK_KEY_F7:
+        return ASCIILiteral(&quot;F7&quot;);
+    case GDK_KEY_F8:
+        return ASCIILiteral(&quot;F8&quot;);
+    case GDK_KEY_F9:
+        return ASCIILiteral(&quot;F9&quot;);
+    case GDK_KEY_F10:
+        return ASCIILiteral(&quot;F10&quot;);
+    case GDK_KEY_F11:
+        return ASCIILiteral(&quot;F11&quot;);
+    case GDK_KEY_F12:
+        return ASCIILiteral(&quot;F12&quot;);
+    case GDK_KEY_F13:
+        return ASCIILiteral(&quot;F13&quot;);
+    case GDK_KEY_F14:
+        return ASCIILiteral(&quot;F14&quot;);
+    case GDK_KEY_F15:
+        return ASCIILiteral(&quot;F15&quot;);
+    case GDK_KEY_F16:
+        return ASCIILiteral(&quot;F16&quot;);
+    case GDK_KEY_F17:
+        return ASCIILiteral(&quot;F17&quot;);
+    case GDK_KEY_F18:
+        return ASCIILiteral(&quot;F18&quot;);
+    case GDK_KEY_F19:
+        return ASCIILiteral(&quot;F19&quot;);
+    case GDK_KEY_F20:
+        return ASCIILiteral(&quot;F20&quot;);
+
+    default: {
+        guint32 unicodeCharacter = gdk_keyval_to_unicode(keyCode);
+        if (unicodeCharacter) {
+            // UTF-8 will use up to 6 bytes.
+            char utf8[7] = { 0 };
+            g_unichar_to_utf8(unicodeCharacter, utf8);
+            return String::fromUTF8(utf8);
+        }
+        return ASCIILiteral(&quot;Unidentified&quot;);
+    }
+    }
+}
+
+// FIXME: This is incomplete. We should change this to mirror
+// more like what Firefox does, and generate these switch statements
+// at build time.
+// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
+String PlatformKeyboardEvent::keyCodeForHardwareKeyCode(unsigned keyCode)
+{
+    switch (keyCode) {
+    case 0x0009:
+        return ASCIILiteral(&quot;Escape&quot;);
+    case 0x000A:
+        return ASCIILiteral(&quot;Digit1&quot;);
+    case 0x000B:
+        return ASCIILiteral(&quot;Digit2&quot;);
+    case 0x000C:
+        return ASCIILiteral(&quot;Digit3&quot;);
+    case 0x000D:
+        return ASCIILiteral(&quot;Digit4&quot;);
+    case 0x000E:
+        return ASCIILiteral(&quot;Digit5&quot;);
+    case 0x000F:
+        return ASCIILiteral(&quot;Digit6&quot;);
+    case 0x0010:
+        return ASCIILiteral(&quot;Digit7&quot;);
+    case 0x0011:
+        return ASCIILiteral(&quot;Digit8&quot;);
+    case 0x0012:
+        return ASCIILiteral(&quot;Digit9&quot;);
+    case 0x0013:
+        return ASCIILiteral(&quot;Digit0&quot;);
+    case 0x0014:
+        return ASCIILiteral(&quot;Minus&quot;);
+    case 0x0015:
+        return ASCIILiteral(&quot;Equal&quot;);
+    case 0x0016:
+        return ASCIILiteral(&quot;Backspace&quot;);
+    case 0x0017:
+        return ASCIILiteral(&quot;Tab&quot;);
+    case 0x0018:
+        return ASCIILiteral(&quot;KeyQ&quot;);
+    case 0x0019:
+        return ASCIILiteral(&quot;KeyW&quot;);
+    case 0x001A:
+        return ASCIILiteral(&quot;KeyE&quot;);
+    case 0x001B:
+        return ASCIILiteral(&quot;KeyR&quot;);
+    case 0x001C:
+        return ASCIILiteral(&quot;KeyT&quot;);
+    case 0x001D:
+        return ASCIILiteral(&quot;KeyY&quot;);
+    case 0x001E:
+        return ASCIILiteral(&quot;KeyU&quot;);
+    case 0x001F:
+        return ASCIILiteral(&quot;KeyI&quot;);
+    case 0x0020:
+        return ASCIILiteral(&quot;KeyO&quot;);
+    case 0x0021:
+        return ASCIILiteral(&quot;KeyP&quot;);
+    case 0x0022:
+        return ASCIILiteral(&quot;BracketLeft&quot;);
+    case 0x0023:
+        return ASCIILiteral(&quot;BracketRight&quot;);
+    case 0x0024:
+        return ASCIILiteral(&quot;Enter&quot;);
+    case 0x0025:
+        return ASCIILiteral(&quot;ControlLeft&quot;);
+    case 0x0026:
+        return ASCIILiteral(&quot;KeyA&quot;);
+    case 0x0027:
+        return ASCIILiteral(&quot;KeyS&quot;);
+    case 0x0028:
+        return ASCIILiteral(&quot;KeyD&quot;);
+    case 0x0029:
+        return ASCIILiteral(&quot;KeyF&quot;);
+    case 0x002A:
+        return ASCIILiteral(&quot;KeyG&quot;);
+    case 0x002B:
+        return ASCIILiteral(&quot;KeyH&quot;);
+    case 0x002C:
+        return ASCIILiteral(&quot;KeyJ&quot;);
+    case 0x002D:
+        return ASCIILiteral(&quot;KeyK&quot;);
+    case 0x002E:
+        return ASCIILiteral(&quot;KeyL&quot;);
+    case 0x002F:
+        return ASCIILiteral(&quot;Semicolon&quot;);
+    case 0x0030:
+        return ASCIILiteral(&quot;Quote&quot;);
+    case 0x0031:
+        return ASCIILiteral(&quot;Backquote&quot;);
+    case 0x0032:
+        return ASCIILiteral(&quot;ShiftLeft&quot;);
+    case 0x0033:
+        return ASCIILiteral(&quot;Backslash&quot;);
+    case 0x0034:
+        return ASCIILiteral(&quot;KeyZ&quot;);
+    case 0x0035:
+        return ASCIILiteral(&quot;KeyX&quot;);
+    case 0x0036:
+        return ASCIILiteral(&quot;KeyC&quot;);
+    case 0x0037:
+        return ASCIILiteral(&quot;KeyV&quot;);
+    case 0x0038:
+        return ASCIILiteral(&quot;KeyB&quot;);
+    case 0x0039:
+        return ASCIILiteral(&quot;KeyN&quot;);
+    case 0x003A:
+        return ASCIILiteral(&quot;KeyM&quot;);
+    case 0x003B:
+        return ASCIILiteral(&quot;Comma&quot;);
+    case 0x003C:
+        return ASCIILiteral(&quot;Period&quot;);
+    case 0x003D:
+        return ASCIILiteral(&quot;Slash&quot;);
+    case 0x003E:
+        return ASCIILiteral(&quot;ShiftRight&quot;);
+    case 0x003F:
+        return ASCIILiteral(&quot;NumpadMultiply&quot;);
+    case 0x0040:
+        return ASCIILiteral(&quot;AltLeft&quot;);
+    case 0x0041:
+        return ASCIILiteral(&quot;Space&quot;);
+    case 0x0042:
+        return ASCIILiteral(&quot;CapsLock&quot;);
+    case 0x0043:
+        return ASCIILiteral(&quot;F1&quot;);
+    case 0x0044:
+        return ASCIILiteral(&quot;F2&quot;);
+    case 0x0045:
+        return ASCIILiteral(&quot;F3&quot;);
+    case 0x0046:
+        return ASCIILiteral(&quot;F4&quot;);
+    case 0x0047:
+        return ASCIILiteral(&quot;F5&quot;);
+    case 0x0048:
+        return ASCIILiteral(&quot;F6&quot;);
+    case 0x0049:
+        return ASCIILiteral(&quot;F7&quot;);
+    case 0x004A:
+        return ASCIILiteral(&quot;F8&quot;);
+    case 0x004B:
+        return ASCIILiteral(&quot;F9&quot;);
+    case 0x004C:
+        return ASCIILiteral(&quot;F10&quot;);
+    case 0x004D:
+        return ASCIILiteral(&quot;NumLock&quot;);
+    case 0x004E:
+        return ASCIILiteral(&quot;ScrollLock&quot;);
+    case 0x004F:
+        return ASCIILiteral(&quot;Numpad7&quot;);
+    case 0x0050:
+        return ASCIILiteral(&quot;Numpad8&quot;);
+    case 0x0051:
+        return ASCIILiteral(&quot;Numpad9&quot;);
+    case 0x0052:
+        return ASCIILiteral(&quot;NumpadSubtract&quot;);
+    case 0x0053:
+        return ASCIILiteral(&quot;Numpad4&quot;);
+    case 0x0054:
+        return ASCIILiteral(&quot;Numpad5&quot;);
+    case 0x0055:
+        return ASCIILiteral(&quot;Numpad6&quot;);
+    case 0x0056:
+        return ASCIILiteral(&quot;NumpadAdd&quot;);
+    case 0x0057:
+        return ASCIILiteral(&quot;Numpad1&quot;);
+    case 0x0058:
+        return ASCIILiteral(&quot;Numpad2&quot;);
+    case 0x0059:
+        return ASCIILiteral(&quot;Numpad3&quot;);
+    case 0x005A:
+        return ASCIILiteral(&quot;Numpad0&quot;);
+    case 0x005B:
+        return ASCIILiteral(&quot;NumpadDecimal&quot;);
+    case 0x005E:
+        return ASCIILiteral(&quot;IntlBackslash&quot;);
+    case 0x005F:
+        return ASCIILiteral(&quot;F11&quot;);
+    case 0x0060:
+        return ASCIILiteral(&quot;F12&quot;);
+    case 0x0061:
+        return ASCIILiteral(&quot;IntlRo&quot;);
+    case 0x0064:
+        return ASCIILiteral(&quot;Convert&quot;);
+    case 0x0065:
+        return ASCIILiteral(&quot;KanaMode&quot;);
+    case 0x0066:
+        return ASCIILiteral(&quot;NonConvert&quot;);
+    case 0x0068:
+        return ASCIILiteral(&quot;NumpadEnter&quot;);
+    case 0x0069:
+        return ASCIILiteral(&quot;ControlRight&quot;);
+    case 0x006A:
+        return ASCIILiteral(&quot;NumpadDivide&quot;);
+    case 0x006B:
+        return ASCIILiteral(&quot;PrintScreen&quot;);
+    case 0x006C:
+        return ASCIILiteral(&quot;AltRight&quot;);
+    case 0x006E:
+        return ASCIILiteral(&quot;Home&quot;);
+    case 0x006F:
+        return ASCIILiteral(&quot;ArrowUp&quot;);
+    case 0x0070:
+        return ASCIILiteral(&quot;PageUp&quot;);
+    case 0x0071:
+        return ASCIILiteral(&quot;ArrowLeft&quot;);
+    case 0x0072:
+        return ASCIILiteral(&quot;ArrowRight&quot;);
+    case 0x0073:
+        return ASCIILiteral(&quot;End&quot;);
+    case 0x0074:
+        return ASCIILiteral(&quot;ArrowDown&quot;);
+    case 0x0075:
+        return ASCIILiteral(&quot;PageDown&quot;);
+    case 0x0076:
+        return ASCIILiteral(&quot;Insert&quot;);
+    case 0x0077:
+        return ASCIILiteral(&quot;Delete&quot;);
+    case 0x0079:
+        return ASCIILiteral(&quot;AudioVolumeMute&quot;);
+    case 0x007A:
+        return ASCIILiteral(&quot;AudioVolumeDown&quot;);
+    case 0x007B:
+        return ASCIILiteral(&quot;AudioVolumeUp&quot;);
+    case 0x007D:
+        return ASCIILiteral(&quot;NumpadEqual&quot;);
+    case 0x007F:
+        return ASCIILiteral(&quot;Pause&quot;);
+    case 0x0081:
+        return ASCIILiteral(&quot;NumpadComma&quot;);
+    case 0x0082:
+        return ASCIILiteral(&quot;Lang1&quot;);
+    case 0x0083:
+        return ASCIILiteral(&quot;Lang2&quot;);
+    case 0x0084:
+        return ASCIILiteral(&quot;IntlYen&quot;);
+    case 0x0085:
+        return ASCIILiteral(&quot;OSLeft&quot;);
+    case 0x0086:
+        return ASCIILiteral(&quot;OSRight&quot;);
+    case 0x0087:
+        return ASCIILiteral(&quot;ContextMenu&quot;);
+    case 0x0088:
+        return ASCIILiteral(&quot;BrowserStop&quot;);
+    case 0x0089:
+        return ASCIILiteral(&quot;Again&quot;);
+    case 0x008A:
+        return ASCIILiteral(&quot;Props&quot;);
+    case 0x008B:
+        return ASCIILiteral(&quot;Undo&quot;);
+    case 0x008C:
+        return ASCIILiteral(&quot;Select&quot;);
+    case 0x008D:
+        return ASCIILiteral(&quot;Copy&quot;);
+    case 0x008E:
+        return ASCIILiteral(&quot;Open&quot;);
+    case 0x008F:
+        return ASCIILiteral(&quot;Paste&quot;);
+    case 0x0090:
+        return ASCIILiteral(&quot;Find&quot;);
+    case 0x0091:
+        return ASCIILiteral(&quot;Cut&quot;);
+    case 0x0092:
+        return ASCIILiteral(&quot;Help&quot;);
+    case 0x0094:
+        return ASCIILiteral(&quot;LaunchApp2&quot;);
+    case 0x0097:
+        return ASCIILiteral(&quot;WakeUp&quot;);
+    case 0x0098:
+        return ASCIILiteral(&quot;LaunchApp1&quot;);
+    case 0x00A3:
+        return ASCIILiteral(&quot;LaunchMail&quot;);
+    case 0x00A4:
+        return ASCIILiteral(&quot;BrowserFavorites&quot;);
+    case 0x00A6:
+        return ASCIILiteral(&quot;BrowserBack&quot;);
+    case 0x00A7:
+        return ASCIILiteral(&quot;BrowserForward&quot;);
+    case 0x00A9:
+        return ASCIILiteral(&quot;Eject&quot;);
+    case 0x00AB:
+        return ASCIILiteral(&quot;MediaTrackNext&quot;);
+    case 0x00AC:
+        return ASCIILiteral(&quot;MediaPlayPause&quot;);
+    case 0x00AD:
+        return ASCIILiteral(&quot;MediaTrackPrevious&quot;);
+    case 0x00AE:
+        return ASCIILiteral(&quot;MediaStop&quot;);
+    case 0x00B3:
+        return ASCIILiteral(&quot;LaunchMediaPlayer&quot;);
+    case 0x00B4:
+        return ASCIILiteral(&quot;BrowserHome&quot;);
+    case 0x00B5:
+        return ASCIILiteral(&quot;BrowserRefresh&quot;);
+    case 0x00BF:
+        return ASCIILiteral(&quot;F13&quot;);
+    case 0x00C0:
+        return ASCIILiteral(&quot;F14&quot;);
+    case 0x00C1:
+        return ASCIILiteral(&quot;F15&quot;);
+    case 0x00C2:
+        return ASCIILiteral(&quot;F16&quot;);
+    case 0x00C3:
+        return ASCIILiteral(&quot;F17&quot;);
+    case 0x00C4:
+        return ASCIILiteral(&quot;F18&quot;);
+    case 0x00C5:
+        return ASCIILiteral(&quot;F19&quot;);
+    case 0x00C6:
+        return ASCIILiteral(&quot;F20&quot;);
+    case 0x00C7:
+        return ASCIILiteral(&quot;F21&quot;);
+    case 0x00C8:
+        return ASCIILiteral(&quot;F22&quot;);
+    case 0x00C9:
+        return ASCIILiteral(&quot;F23&quot;);
+    case 0x00CA:
+        return ASCIILiteral(&quot;F24&quot;);
+    case 0x00E1:
+        return ASCIILiteral(&quot;BrowserSearch&quot;);
+    default:
+        return ASCIILiteral(&quot;Unidentified&quot;);
+    }
+}
+
+// FIXME: This is incomplete. We should change this to mirror
+// more like what Firefox does, and generate these switch statements
+// at build time.
</ins><span class="cx"> String PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(unsigned keyCode)
</span><span class="cx"> {
</span><span class="cx">     switch (keyCode) {
</span><span class="lines">@@ -574,6 +1260,8 @@
</span><span class="cx">     : PlatformEvent(eventTypeForGdkKeyEvent(event), modifiersForGdkKeyEvent(event), currentTime())
</span><span class="cx">     , m_text(compositionResults.simpleString.length() ? compositionResults.simpleString : singleCharacterString(event-&gt;keyval))
</span><span class="cx">     , m_unmodifiedText(m_text)
</span><ins>+    , m_key(keyValueForGdkKeyCode(event-&gt;keyval))
+    , m_code(keyCodeForHardwareKeyCode(event-&gt;hardware_keycode))
</ins><span class="cx">     , m_keyIdentifier(keyIdentifierForGdkKeyCode(event-&gt;keyval))
</span><span class="cx">     , m_windowsVirtualKeyCode(windowsKeyCodeForGdkKeyCode(event-&gt;keyval))
</span><span class="cx">     , m_autoRepeat(false)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-01-06  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.co.uk&gt;
+
+        [GTK] Should support key and code properties on keyboard events
+        https://bugs.webkit.org/show_bug.cgi?id=166759
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Shared/WebEvent.h:
+        * Shared/WebKeyboardEvent.cpp:
+        (WebKit::WebKeyboardEvent::WebKeyboardEvent): accept web key value and code on construction.
+        * Shared/gtk/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebKeyboardEvent): pass web key value and code on construction.
+
</ins><span class="cx"> 2017-01-08  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move cache coders to WTF
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebEvent.h (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebEvent.h        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebKit2/Shared/WebEvent.h        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx"> #if USE(APPKIT)
</span><span class="cx">     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);
</span><span class="cx"> #elif PLATFORM(GTK)
</span><del>-    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);
</del><ins>+    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);
</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 (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebKit2/Shared/WebKeyboardEvent.cpp        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -58,10 +58,12 @@
</span><span class="cx"> 
</span><span class="cx"> #elif PLATFORM(GTK)
</span><span class="cx"> 
</span><del>-WebKeyboardEvent::WebKeyboardEvent(Type 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 modifiers, double timestamp)
</del><ins>+WebKeyboardEvent::WebKeyboardEvent(Type 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 modifiers, double timestamp)
</ins><span class="cx">     : WebEvent(type, modifiers, timestamp)
</span><span class="cx">     , m_text(text)
</span><span class="cx">     , m_unmodifiedText(text)
</span><ins>+    , m_key(key)
+    , 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="trunkSourceWebKit2SharedgtkWebEventFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -193,6 +193,8 @@
</span><span class="cx">     return WebKeyboardEvent(
</span><span class="cx">         event-&gt;type == GDK_KEY_RELEASE ? WebEvent::KeyUp : WebEvent::KeyDown,
</span><span class="cx">         compositionResults.simpleString.length() ? compositionResults.simpleString : PlatformKeyboardEvent::singleCharacterString(event-&gt;key.keyval),
</span><ins>+        PlatformKeyboardEvent::keyValueForGdkKeyCode(event-&gt;key.keyval),
+        PlatformKeyboardEvent::keyCodeForHardwareKeyCode(event-&gt;key.hardware_keycode),
</ins><span class="cx">         PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(event-&gt;key.keyval),
</span><span class="cx">         PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode(event-&gt;key.keyval),
</span><span class="cx">         static_cast&lt;int&gt;(event-&gt;key.keyval),
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Tools/ChangeLog        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-01-06  Gustavo Noronha Silva  &lt;gustavo.noronha@collabora.co.uk&gt;
+
+        [GTK] Should support key and code properties on keyboard events
+        https://bugs.webkit.org/show_bug.cgi?id=166759
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
+        (WTR::getGDKKeySymForKeyRef): add missing modifier keys which were being reported as 'l' and 'r' only
+        on tests.
+
</ins><span class="cx"> 2017-01-06  Per Arne Vollan  &lt;pvollan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Some tests are flaky because certain DLLs are writing to stdout.
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnergtkEventSenderProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp (210503 => 210504)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp        2017-01-09 12:46:34 UTC (rev 210503)
+++ trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp        2017-01-09 14:14:57 UTC (rev 210504)
</span><span class="lines">@@ -226,6 +226,18 @@
</span><span class="cx">         return GDK_KEY_VoidSymbol;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(keyRef, &quot;leftControl&quot;))
+        return GDK_KEY_Control_L;
+    if (WKStringIsEqualToUTF8CString(keyRef, &quot;rightControl&quot;))
+        return GDK_KEY_Control_R;
+    if (WKStringIsEqualToUTF8CString(keyRef, &quot;leftShift&quot;))
+        return GDK_KEY_Shift_L;
+    if (WKStringIsEqualToUTF8CString(keyRef, &quot;rightShift&quot;))
+        return GDK_KEY_Shift_R;
+    if (WKStringIsEqualToUTF8CString(keyRef, &quot;leftAlt&quot;))
+        return GDK_KEY_Alt_L;
+    if (WKStringIsEqualToUTF8CString(keyRef, &quot;rightAlt&quot;))
+        return GDK_KEY_Alt_R;
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(keyRef, &quot;leftArrow&quot;))
</span><span class="cx">         return GDK_KEY_Left;
</span><span class="cx">     if (WKStringIsEqualToUTF8CString(keyRef, &quot;rightArrow&quot;))
</span></span></pre>
</div>
</div>

</body>
</html>