[iOS] Right command key has wrong value for property code
https://bugs.webkit.org/show_bug.cgi?id=193876
<rdar://problem/47577308>

Reviewed by Brent Fulgham.

Source/WebCore:

We're looking for the wrong Windows virtual key code for the right command key.
Substitute VK_APPS for VK_RWIN so we can identify the right command key and return
the correct value for the code property of the DOM key event.

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

LayoutTests:

Update test result.

* fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245162 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2fad6d8..031f523 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,17 @@
 2019-05-09  Daniel Bates  <dabates@apple.com>
 
+        [iOS] Right command key has wrong value for property code
+        https://bugs.webkit.org/show_bug.cgi?id=193876
+        <rdar://problem/47577308>
+
+        Reviewed by Brent Fulgham.
+
+        Update test result.
+
+        * fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt:
+
+2019-05-09  Daniel Bates  <dabates@apple.com>
+
         [iOS] Numpad comma key has incorrect keyIdentifier property
         https://bugs.webkit.org/show_bug.cgi?id=197753
         <rdar://problem/50636274>
diff --git a/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt b/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt
index 400e289..9e536ff 100644
--- a/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt
+++ b/LayoutTests/fast/events/ios/keydown-keyup-special-keys-in-non-editable-element-expected.txt
@@ -38,8 +38,8 @@
 type: keyup, key: Dead, code: Enter, keyIdentifier: Unidentified, keyCode: 13, charCode: 0, keyCode: 13, which: 13
 type: keydown, key: Alt, code: Unidentified, keyIdentifier: Alt, keyCode: 18, charCode: 0, keyCode: 18, which: 18
 type: keyup, key: Alt, code: Unidentified, keyIdentifier: Alt, keyCode: 18, charCode: 0, keyCode: 18, which: 18
-type: keydown, key: Meta, code: Unidentified, keyIdentifier: Meta, keyCode: 93, charCode: 0, keyCode: 93, which: 93
-type: keyup, key: Meta, code: Unidentified, keyIdentifier: Meta, keyCode: 93, charCode: 0, keyCode: 93, which: 93
+type: keydown, key: Meta, code: MetaRight, keyIdentifier: Meta, keyCode: 93, charCode: 0, keyCode: 93, which: 93
+type: keyup, key: Meta, code: MetaRight, keyIdentifier: Meta, keyCode: 93, charCode: 0, keyCode: 93, which: 93
 type: keydown, key: Control, code: ControlRight, keyIdentifier: Control, keyCode: 17, charCode: 0, keyCode: 17, which: 17
 type: keyup, key: Control, code: ControlRight, keyIdentifier: Control, keyCode: 17, charCode: 0, keyCode: 17, which: 17
 type: keydown, key: Shift, code: ShiftRight, keyIdentifier: Shift, keyCode: 16, charCode: 0, keyCode: 16, which: 16
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index ea70ef1..a72ad88 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,20 @@
 2019-05-09  Daniel Bates  <dabates@apple.com>
 
+        [iOS] Right command key has wrong value for property code
+        https://bugs.webkit.org/show_bug.cgi?id=193876
+        <rdar://problem/47577308>
+
+        Reviewed by Brent Fulgham.
+
+        We're looking for the wrong Windows virtual key code for the right command key.
+        Substitute VK_APPS for VK_RWIN so we can identify the right command key and return
+        the correct value for the code property of the DOM key event.
+
+        * platform/ios/PlatformEventFactoryIOS.mm:
+        (WebCore::codeForKeyEvent):
+
+2019-05-09  Daniel Bates  <dabates@apple.com>
+
         [iOS] Numpad comma key has incorrect keyIdentifier property
         https://bugs.webkit.org/show_bug.cgi?id=197753
         <rdar://problem/50636274>
diff --git a/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm b/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
index 63221d4..b33da5d 100644
--- a/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
+++ b/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
@@ -275,7 +275,7 @@
     case VK_RCONTROL: return "ControlRight"_s;
     case VK_RETURN: return "Enter"_s; //  Labeled Return on Apple keyboards.
     case VK_LWIN: return "MetaLeft"_s;
-    case VK_RWIN: return "MetaRight"_s;
+    case VK_APPS: return "MetaRight"_s;
     case VK_LSHIFT: return "ShiftLeft"_s;
     case VK_RSHIFT: return "ShiftRight"_s;
     case VK_SPACE: return "Space"_s;