@@ -10901,10 +10901,10 @@ index 0000000000000000000000000000000000000000..5ae0ce152f06b8316dbfbbbb2efd1990
10901
10901
+} // namespace WebKit
10902
10902
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
10903
10903
new file mode 100644
10904
- index 0000000000000000000000000000000000000000..5043224bbd6378175c9ca7dce63fc5a233649878
10904
+ index 0000000000000000000000000000000000000000..5d19607e019489b33318be50ccdc94c2fcfae914
10905
10905
--- /dev/null
10906
10906
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
10907
- @@ -0,0 +1,253 @@
10907
+ @@ -0,0 +1,282 @@
10908
10908
+/*
10909
10909
+ * Copyright (C) 2019 Microsoft Corporation.
10910
10910
+ *
@@ -10937,6 +10937,7 @@ index 0000000000000000000000000000000000000000..5043224bbd6378175c9ca7dce63fc5a2
10937
10937
+#include "NativeWebMouseEvent.h"
10938
10938
+#include "WebPageProxy.h"
10939
10939
+#include <wtf/MathExtras.h>
10940
+ +#include <wtf/HexNumber.h>
10940
10941
+
10941
10942
+namespace WebKit {
10942
10943
+
@@ -11009,6 +11010,31 @@ index 0000000000000000000000000000000000000000..5043224bbd6378175c9ca7dce63fc5a2
11009
11010
+ m_mouseCallbacks = nullptr;
11010
11011
+}
11011
11012
+
11013
+ +static String keyIdentifierForKey(const String& key)
11014
+ +{
11015
+ + if (key.length() == 1)
11016
+ + return makeString("U+", hex(toASCIIUpper(key.characterAt(0)), 4));
11017
+ + if (key == "Delete")
11018
+ + return "U+007F";
11019
+ + if (key == "Backspace")
11020
+ + return "U+0008";
11021
+ + if (key == "ArrowUp")
11022
+ + return "Up";
11023
+ + if (key == "ArrowDown")
11024
+ + return "Down";
11025
+ + if (key == "ArrowLeft")
11026
+ + return "Left";
11027
+ + if (key == "ArrowRight")
11028
+ + return "Right";
11029
+ + if (key == "Tab")
11030
+ + return "U+0009";
11031
+ + if (key == "Pause")
11032
+ + return "Pause";
11033
+ + if (key == "ScrollLock")
11034
+ + return "Scroll";
11035
+ + return key;
11036
+ +}
11037
+ +
11012
11038
+void WebPageInspectorInputAgent::dispatchKeyEvent(const String& type, const int* modifiers, const String* text, const String* unmodifiedText, const String* code, const String* key, const int* windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const bool* autoRepeat, const bool* isKeypad, const bool* isSystemKey, const JSON::Array* commands, Ref<Inspector::InputBackendDispatcherHandler::DispatchKeyEventCallback>&& callback)
11013
11039
+{
11014
11040
+ WebKit::WebEvent::Type eventType;
@@ -11053,6 +11079,8 @@ index 0000000000000000000000000000000000000000..5043224bbd6378175c9ca7dce63fc5a2
11053
11079
+ }
11054
11080
+ }
11055
11081
+
11082
+ + String keyIdentifier = keyIdentifierForKey(eventKey);
11083
+ +
11056
11084
+ bool eventIsAutoRepeat = false;
11057
11085
+ if (autoRepeat)
11058
11086
+ eventIsAutoRepeat = *autoRepeat;
@@ -11071,6 +11099,7 @@ index 0000000000000000000000000000000000000000..5043224bbd6378175c9ca7dce63fc5a2
11071
11099
+ eventUnmodifiedText,
11072
11100
+ eventKey,
11073
11101
+ eventCode,
11102
+ + keyIdentifier,
11074
11103
+ eventWindowsVirtualKeyCode,
11075
11104
+ eventNativeVirtualKeyCode,
11076
11105
+ eventIsAutoRepeat,
@@ -11160,7 +11189,7 @@ index 0000000000000000000000000000000000000000..5043224bbd6378175c9ca7dce63fc5a2
11160
11189
+} // namespace WebKit
11161
11190
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
11162
11191
new file mode 100644
11163
- index 0000000000000000000000000000000000000000..76290475097e756e3d932d22be4d8c797be4aa0c
11192
+ index 0000000000000000000000000000000000000000..20311d530090b0229010957a96fc60f44b4823fe
11164
11193
--- /dev/null
11165
11194
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
11166
11195
@@ -0,0 +1,84 @@
@@ -11228,7 +11257,7 @@ index 0000000000000000000000000000000000000000..76290475097e756e3d932d22be4d8c79
11228
11257
+ void dispatchMouseEvent(const String& type, int x, int y, const int* modifiers, const String* button, const int* buttons, const int* clickCount, const int* deltaX, const int* deltaY, Ref<DispatchMouseEventCallback>&& callback) override;
11229
11258
+
11230
11259
+private:
11231
- + void platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& commands, WallTime timestamp);
11260
+ + void platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& commands, WallTime timestamp);
11232
11261
+#if PLATFORM(WPE)
11233
11262
+ void platformDispatchMouseEvent(WebMouseEvent::Type type, int x, int y, WebMouseEvent::Button button, OptionSet<WebEvent::Modifier> modifiers);
11234
11263
+#endif
@@ -12132,10 +12161,10 @@ index 0000000000000000000000000000000000000000..e5e25acebabb76a05a77db02a99f1267
12132
12161
+} // namespace WebKit
12133
12162
diff --git a/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp b/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
12134
12163
new file mode 100644
12135
- index 0000000000000000000000000000000000000000..7ad3fe416c5c747eaad8c6948c3549a3984223ea
12164
+ index 0000000000000000000000000000000000000000..d0f9827544994e450e24e3f7a427c35eeff94d67
12136
12165
--- /dev/null
12137
12166
+++ b/Source/WebKit/UIProcess/gtk/WebPageInspectorInputAgentGtk.cpp
12138
- @@ -0,0 +1,107 @@
12167
+ @@ -0,0 +1,105 @@
12139
12168
+/*
12140
12169
+ * Copyright (C) 2019 Microsoft Corporation.
12141
12170
+ *
@@ -12201,11 +12230,10 @@ index 0000000000000000000000000000000000000000..7ad3fe416c5c747eaad8c6948c3549a3
12201
12230
+ return state;
12202
12231
+}
12203
12232
+
12204
- +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& macCommands, WallTime timestamp)
12233
+ +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& macCommands, WallTime timestamp)
12205
12234
+{
12206
12235
+ Vector<String> commands;
12207
12236
+ const guint keyVal = WebCore::PlatformKeyboardEvent::gdkKeyCodeForWindowsKeyCode(windowsVirtualKeyCode);
12208
- + String keyIdentifier;
12209
12237
+ if (keyVal) {
12210
12238
+ GdkEventType event = GDK_NOTHING;
12211
12239
+ switch (type)
@@ -12222,7 +12250,6 @@ index 0000000000000000000000000000000000000000..7ad3fe416c5c747eaad8c6948c3549a3
12222
12250
+ }
12223
12251
+ unsigned state = modifiersToEventState(modifiers);
12224
12252
+ commands = commandsForKeyEvent(event, keyVal, state);
12225
- + keyIdentifier = WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode(keyVal);
12226
12253
+ }
12227
12254
+ NativeWebKeyboardEvent event(
12228
12255
+ type,
@@ -12642,10 +12669,10 @@ index 0000000000000000000000000000000000000000..6113f4cd60a5d72b8ead61176cb43200
12642
12669
+} // namespace WebKit
12643
12670
diff --git a/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm b/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
12644
12671
new file mode 100644
12645
- index 0000000000000000000000000000000000000000..30e6ae3bdc8c1695189885afae949071add54c4e
12672
+ index 0000000000000000000000000000000000000000..832e52038cf42ea73246e036a66ad9e1fc87fa78
12646
12673
--- /dev/null
12647
12674
+++ b/Source/WebKit/UIProcess/mac/WebPageInspectorInputAgentMac.mm
12648
- @@ -0,0 +1,124 @@
12675
+ @@ -0,0 +1,122 @@
12649
12676
+/*
12650
12677
+ * Copyright (C) 2019 Microsoft Corporation.
12651
12678
+ *
@@ -12678,7 +12705,6 @@ index 0000000000000000000000000000000000000000..30e6ae3bdc8c1695189885afae949071
12678
12705
+#import <WebCore/IntPoint.h>
12679
12706
+#import <WebCore/IntSize.h>
12680
12707
+#import "NativeWebKeyboardEvent.h"
12681
- +#import <wtf/HexNumber.h>
12682
12708
+
12683
12709
+namespace WebKit {
12684
12710
+
@@ -12743,9 +12769,8 @@ index 0000000000000000000000000000000000000000..30e6ae3bdc8c1695189885afae949071
12743
12769
+ }
12744
12770
+}
12745
12771
+
12746
- +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& commands, WallTime timestamp)
12772
+ +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& commands, WallTime timestamp)
12747
12773
+{
12748
- + String keyIdentifier = key.length() == 1 ? makeString("U+", hex(toASCIIUpper(key.characterAt(0)), 4)) : key;
12749
12774
+ Vector<WebCore::KeypressCommand> macCommands;
12750
12775
+ for (const String& command : commands)
12751
12776
+ macCommands.append(WebCore::KeypressCommand(command.utf8().data()));
@@ -13030,7 +13055,7 @@ index 0000000000000000000000000000000000000000..62b841fe1d0de2296e1c61e328cff564
13030
13055
+} // namespace WebKit
13031
13056
diff --git a/Source/WebKit/UIProcess/win/WebPageInspectorInputAgentWin.cpp b/Source/WebKit/UIProcess/win/WebPageInspectorInputAgentWin.cpp
13032
13057
new file mode 100644
13033
- index 0000000000000000000000000000000000000000..a299240b1fea96694cb47fa11fc6a6411ffdaf70
13058
+ index 0000000000000000000000000000000000000000..5cf8a010e9809e6a95741cdb7c2cbeb445ab638b
13034
13059
--- /dev/null
13035
13060
+++ b/Source/WebKit/UIProcess/win/WebPageInspectorInputAgentWin.cpp
13036
13061
@@ -0,0 +1,55 @@
@@ -13069,15 +13094,15 @@ index 0000000000000000000000000000000000000000..a299240b1fea96694cb47fa11fc6a641
13069
13094
+
13070
13095
+namespace WebKit {
13071
13096
+
13072
- +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& macCommands, WallTime timestamp)
13097
+ +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& macCommands, WallTime timestamp)
13073
13098
+{
13074
13099
+ NativeWebKeyboardEvent event(
13075
13100
+ type,
13076
13101
+ text,
13077
13102
+ unmodifiedText,
13078
13103
+ key,
13079
13104
+ code,
13080
- + "" ,
13105
+ + keyIdentifier ,
13081
13106
+ windowsVirtualKeyCode,
13082
13107
+ nativeVirtualKeyCode,
13083
13108
+ isAutoRepeat,
@@ -13220,10 +13245,10 @@ index 0000000000000000000000000000000000000000..5dc76aa302cb574307059e66a1b73730
13220
13245
+} // namespace WebKit
13221
13246
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
13222
13247
new file mode 100644
13223
- index 0000000000000000000000000000000000000000..585fb151f302e4b376c705ed0d0974d518733605
13248
+ index 0000000000000000000000000000000000000000..c3d7cacea987ba2b094d5022c670705ef6ced129
13224
13249
--- /dev/null
13225
13250
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
13226
- @@ -0,0 +1,59 @@
13251
+ @@ -0,0 +1,55 @@
13227
13252
+/*
13228
13253
+ * Copyright (C) 2019 Microsoft Corporation.
13229
13254
+ *
@@ -13259,12 +13284,8 @@ index 0000000000000000000000000000000000000000..585fb151f302e4b376c705ed0d0974d5
13259
13284
+
13260
13285
+namespace WebKit {
13261
13286
+
13262
- +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& macCommands, WallTime timestamp)
13287
+ +void WebPageInspectorInputAgent::platformDispatchKeyEvent(WebKeyboardEvent::Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<WebEvent::Modifier> modifiers, Vector<String>& macCommands, WallTime timestamp)
13263
13288
+{
13264
- + unsigned keyCode = WebCore::PlatformKeyboardEvent::WPEKeyCodeForWindowsKeyCode(windowsVirtualKeyCode);
13265
- + String keyIdentifier;
13266
- + if (keyCode)
13267
- + keyIdentifier = WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode(keyCode);
13268
13289
+ NativeWebKeyboardEvent event(
13269
13290
+ type,
13270
13291
+ text,
0 commit comments