mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
chore(webkit): shorten page proxy id, fix variable naming (#429)
This commit is contained in:
parent
28bad69093
commit
37dd56ff37
@ -1 +1 @@
|
|||||||
1073
|
1074
|
||||||
|
@ -5929,7 +5929,7 @@ index d7695088e7cfc4f638f157338754f9f157489749..fd0e1db93b4b6fc094ff47565ca19e83
|
|||||||
std::unique_ptr<BackingStore> m_backingStore;
|
std::unique_ptr<BackingStore> m_backingStore;
|
||||||
diff --git a/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
diff --git a/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..7d8f2f4c767becde3ef05cc418b237e17ec0ac34
|
index 0000000000000000000000000000000000000000..cf7832855e823cea9b3773e47e88499dc7727d1d
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
+++ b/Source/WebKit/UIProcess/InspectorBrowserAgent.cpp
|
||||||
@@ -0,0 +1,388 @@
|
@@ -0,0 +1,388 @@
|
||||||
@ -6296,7 +6296,7 @@ index 0000000000000000000000000000000000000000..7d8f2f4c767becde3ef05cc418b237e1
|
|||||||
+
|
+
|
||||||
+String InspectorBrowserAgent::toPageProxyIDProtocolString(const WebPageProxy& page)
|
+String InspectorBrowserAgent::toPageProxyIDProtocolString(const WebPageProxy& page)
|
||||||
+{
|
+{
|
||||||
+ return makeString("page-proxy-", page.identifier().toUInt64());
|
+ return makeString(page.identifier().toUInt64());
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+BrowserContext InspectorBrowserAgent::lookupBrowserContext(ErrorString& errorString, const String* browserContextID)
|
+BrowserContext InspectorBrowserAgent::lookupBrowserContext(ErrorString& errorString, const String* browserContextID)
|
||||||
@ -7467,10 +7467,10 @@ index 0000000000000000000000000000000000000000..77dff2c191fee081773bc5705d80168c
|
|||||||
+} // namespace WebKit
|
+} // namespace WebKit
|
||||||
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..d84e2831aeada920eefc0cb62b865e304b2587f2
|
index 0000000000000000000000000000000000000000..5bba231872fef0330710ca6af3513bb3fc0f1f22
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp
|
||||||
@@ -0,0 +1,249 @@
|
@@ -0,0 +1,246 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (C) 2019 Microsoft Corporation.
|
+ * Copyright (C) 2019 Microsoft Corporation.
|
||||||
+ *
|
+ *
|
||||||
@ -7499,12 +7499,9 @@ index 0000000000000000000000000000000000000000..d84e2831aeada920eefc0cb62b865e30
|
|||||||
+#include "config.h"
|
+#include "config.h"
|
||||||
+#include "WebPageInspectorInputAgent.h"
|
+#include "WebPageInspectorInputAgent.h"
|
||||||
+
|
+
|
||||||
+#include "APINavigation.h"
|
|
||||||
+#include "NativeWebKeyboardEvent.h"
|
+#include "NativeWebKeyboardEvent.h"
|
||||||
+#include "NativeWebMouseEvent.h"
|
+#include "NativeWebMouseEvent.h"
|
||||||
+#include "WebPageProxy.h"
|
+#include "WebPageProxy.h"
|
||||||
+#include <JavaScriptCore/InspectorFrontendRouter.h>
|
|
||||||
+
|
|
||||||
+
|
+
|
||||||
+namespace WebKit {
|
+namespace WebKit {
|
||||||
+
|
+
|
||||||
@ -7577,143 +7574,143 @@ index 0000000000000000000000000000000000000000..d84e2831aeada920eefc0cb62b865e30
|
|||||||
+ m_mouseCallbacks = nullptr;
|
+ m_mouseCallbacks = nullptr;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void WebPageInspectorInputAgent::dispatchKeyEvent(const String& in_type, const int* opt_in_modifiers, const String* opt_in_text, const String* opt_in_unmodifiedText, const String* opt_in_code, const String* opt_in_key, const int* opt_in_windowsVirtualKeyCode, const int* opt_in_nativeVirtualKeyCode, const bool* opt_in_autoRepeat, const bool* opt_in_isKeypad, const bool* opt_in_isSystemKey, const JSON::Array* opt_in_mac_commands, Ref<Inspector::InputBackendDispatcherHandler::DispatchKeyEventCallback>&& callback)
|
+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)
|
||||||
+{
|
+{
|
||||||
+ WebKit::WebEvent::Type type;
|
+ WebKit::WebEvent::Type eventType;
|
||||||
+ if (in_type == "keyDown") {
|
+ if (type == "keyDown") {
|
||||||
+ type = WebKit::WebEvent::KeyDown;
|
+ eventType = WebKit::WebEvent::KeyDown;
|
||||||
+ } else if (in_type == "keyUp") {
|
+ } else if (type == "keyUp") {
|
||||||
+ type = WebKit::WebEvent::KeyUp;
|
+ eventType = WebKit::WebEvent::KeyUp;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ callback->sendFailure("Unsupported event type.");
|
+ callback->sendFailure("Unsupported event type.");
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ OptionSet<WebEvent::Modifier> modifiers;
|
+ OptionSet<WebEvent::Modifier> eventModifiers;
|
||||||
+ if (opt_in_modifiers)
|
+ if (modifiers)
|
||||||
+ modifiers = modifiers.fromRaw(*opt_in_modifiers);
|
+ eventModifiers = eventModifiers.fromRaw(*modifiers);
|
||||||
+ String text;
|
+ String eventText;
|
||||||
+ if (opt_in_text)
|
+ if (text)
|
||||||
+ text = *opt_in_text;
|
+ eventText = *text;
|
||||||
+ String unmodifiedText;
|
+ String eventUnmodifiedText;
|
||||||
+ if (opt_in_unmodifiedText)
|
+ if (unmodifiedText)
|
||||||
+ unmodifiedText = *opt_in_unmodifiedText;
|
+ eventUnmodifiedText = *unmodifiedText;
|
||||||
+ String code;
|
+ String eventCode;
|
||||||
+ if (opt_in_code)
|
+ if (code)
|
||||||
+ code = *opt_in_code;
|
+ eventCode = *code;
|
||||||
+ String key;
|
+ String eventKey;
|
||||||
+ if (opt_in_key)
|
+ if (key)
|
||||||
+ key = *opt_in_key;
|
+ eventKey = *key;
|
||||||
+ int windowsVirtualKeyCode = 0;
|
+ int eventWindowsVirtualKeyCode = 0;
|
||||||
+ if (opt_in_windowsVirtualKeyCode)
|
+ if (windowsVirtualKeyCode)
|
||||||
+ windowsVirtualKeyCode = *opt_in_windowsVirtualKeyCode;
|
+ eventWindowsVirtualKeyCode = *windowsVirtualKeyCode;
|
||||||
+ int nativeVirtualKeyCode = 0;
|
+ int eventNativeVirtualKeyCode = 0;
|
||||||
+ if (opt_in_nativeVirtualKeyCode)
|
+ if (nativeVirtualKeyCode)
|
||||||
+ nativeVirtualKeyCode = *opt_in_nativeVirtualKeyCode;
|
+ eventNativeVirtualKeyCode = *nativeVirtualKeyCode;
|
||||||
+ Vector<String> commands;
|
+ Vector<String> eventCommands;
|
||||||
+ if (opt_in_mac_commands) {
|
+ if (commands) {
|
||||||
+ for (const auto& value : *opt_in_mac_commands) {
|
+ for (const auto& value : *commands) {
|
||||||
+ String command;
|
+ String command;
|
||||||
+ if (!value->asString(command)) {
|
+ if (!value->asString(command)) {
|
||||||
+ callback->sendFailure("Command must be string");
|
+ callback->sendFailure("Command must be string");
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ commands.append(command);
|
+ eventCommands.append(command);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ bool isAutoRepeat = false;
|
+ bool eventIsAutoRepeat = false;
|
||||||
+ if (opt_in_autoRepeat)
|
+ if (autoRepeat)
|
||||||
+ isAutoRepeat = *opt_in_autoRepeat;
|
+ eventIsAutoRepeat = *autoRepeat;
|
||||||
+ bool isKeypad = false;
|
+ bool eventIsKeypad = false;
|
||||||
+ if (opt_in_isKeypad)
|
+ if (isKeypad)
|
||||||
+ isKeypad = *opt_in_isKeypad;
|
+ eventIsKeypad = *isKeypad;
|
||||||
+ bool isSystemKey = false;
|
+ bool eventIsSystemKey = false;
|
||||||
+ if (opt_in_isSystemKey)
|
+ if (isSystemKey)
|
||||||
+ isSystemKey = *opt_in_isSystemKey;
|
+ eventIsSystemKey = *isSystemKey;
|
||||||
+ WallTime timestamp = WallTime::now();
|
+ WallTime timestamp = WallTime::now();
|
||||||
+
|
+
|
||||||
+ m_keyboardCallbacks->append(WTFMove(callback));
|
+ m_keyboardCallbacks->append(WTFMove(callback));
|
||||||
+ platformDispatchKeyEvent(
|
+ platformDispatchKeyEvent(
|
||||||
+ type,
|
+ eventType,
|
||||||
+ text,
|
+ eventText,
|
||||||
+ unmodifiedText,
|
+ eventUnmodifiedText,
|
||||||
+ key,
|
+ eventKey,
|
||||||
+ code,
|
+ eventCode,
|
||||||
+ windowsVirtualKeyCode,
|
+ eventWindowsVirtualKeyCode,
|
||||||
+ nativeVirtualKeyCode,
|
+ eventNativeVirtualKeyCode,
|
||||||
+ isAutoRepeat,
|
+ eventIsAutoRepeat,
|
||||||
+ isKeypad,
|
+ eventIsKeypad,
|
||||||
+ isSystemKey,
|
+ eventIsSystemKey,
|
||||||
+ modifiers,
|
+ eventModifiers,
|
||||||
+ commands,
|
+ eventCommands,
|
||||||
+ timestamp);
|
+ timestamp);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void WebPageInspectorInputAgent::dispatchMouseEvent(const String& in_type, int in_x, int in_y, const int* opt_in_modifiers, const String* opt_in_button, const int* opt_in_buttons, const int* opt_in_clickCount, const int* opt_in_deltaX, const int* opt_in_deltaY, Ref<DispatchMouseEventCallback>&& callback)
|
+void WebPageInspectorInputAgent::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)
|
||||||
+{
|
+{
|
||||||
+ WebEvent::Type type = WebEvent::NoType;
|
+ WebEvent::Type eventType = WebEvent::NoType;
|
||||||
+ if (in_type == "down")
|
+ if (type == "down")
|
||||||
+ type = WebEvent::MouseDown;
|
+ eventType = WebEvent::MouseDown;
|
||||||
+ else if (in_type == "up")
|
+ else if (type == "up")
|
||||||
+ type = WebEvent::MouseUp;
|
+ eventType = WebEvent::MouseUp;
|
||||||
+ else if (in_type == "move")
|
+ else if (type == "move")
|
||||||
+ type = WebEvent::MouseMove;
|
+ eventType = WebEvent::MouseMove;
|
||||||
+ else {
|
+ else {
|
||||||
+ callback->sendFailure("Unsupported event type");
|
+ callback->sendFailure("Unsupported event type");
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ OptionSet<WebEvent::Modifier> modifiers;
|
+ OptionSet<WebEvent::Modifier> eventModifiers;
|
||||||
+ if (opt_in_modifiers)
|
+ if (modifiers)
|
||||||
+ modifiers = modifiers.fromRaw(*opt_in_modifiers);
|
+ eventModifiers = eventModifiers.fromRaw(*modifiers);
|
||||||
+
|
+
|
||||||
+ WebMouseEvent::Button button = WebMouseEvent::NoButton;
|
+ WebMouseEvent::Button eventButton = WebMouseEvent::NoButton;
|
||||||
+ if (opt_in_button) {
|
+ if (button) {
|
||||||
+ if (*opt_in_button == "left")
|
+ if (*button == "left")
|
||||||
+ button = WebMouseEvent::LeftButton;
|
+ eventButton = WebMouseEvent::LeftButton;
|
||||||
+ else if (*opt_in_button == "middle")
|
+ else if (*button == "middle")
|
||||||
+ button = WebMouseEvent::MiddleButton;
|
+ eventButton = WebMouseEvent::MiddleButton;
|
||||||
+ else if (*opt_in_button == "right")
|
+ else if (*button == "right")
|
||||||
+ button = WebMouseEvent::RightButton;
|
+ eventButton = WebMouseEvent::RightButton;
|
||||||
+ else if (*opt_in_button == "none")
|
+ else if (*button == "none")
|
||||||
+ button = WebMouseEvent::NoButton;
|
+ eventButton = WebMouseEvent::NoButton;
|
||||||
+ else {
|
+ else {
|
||||||
+ callback->sendFailure("Unsupported button");
|
+ callback->sendFailure("Unsupported eventButton");
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ unsigned short buttons = 0;
|
+ unsigned short eventButtons = 0;
|
||||||
+ if (opt_in_buttons)
|
+ if (buttons)
|
||||||
+ buttons = *opt_in_buttons;
|
+ eventButtons = *buttons;
|
||||||
+
|
+
|
||||||
+ int clickCount = 0;
|
+ int eventClickCount = 0;
|
||||||
+ if (opt_in_clickCount)
|
+ if (clickCount)
|
||||||
+ clickCount = *opt_in_clickCount;
|
+ eventClickCount = *clickCount;
|
||||||
+ int deltaX = 0;
|
+ int eventDeltaX = 0;
|
||||||
+ if (opt_in_deltaX)
|
+ if (deltaX)
|
||||||
+ deltaX = *opt_in_deltaX;
|
+ eventDeltaX = *deltaX;
|
||||||
+ int deltaY = 0;
|
+ int eventDeltaY = 0;
|
||||||
+ if (opt_in_deltaY)
|
+ if (deltaY)
|
||||||
+ deltaY = *opt_in_deltaY;
|
+ eventDeltaY = *deltaY;
|
||||||
+ m_mouseCallbacks->append(WTFMove(callback));
|
+ m_mouseCallbacks->append(WTFMove(callback));
|
||||||
+#if PLATFORM(WPE)
|
+#if PLATFORM(WPE)
|
||||||
+ platformDispatchMouseEvent(type, in_x, in_y, button, modifiers);
|
+ platformDispatchMouseEvent(eventType, x, y, eventButton, eventModifiers);
|
||||||
+#elif PLATFORM(MAC)
|
+#elif PLATFORM(MAC)
|
||||||
+ platformDispatchMouseEvent(in_type, in_x, in_y, opt_in_modifiers, opt_in_button, opt_in_clickCount);
|
+ platformDispatchMouseEvent(type, x, y, modifiers, button, clickCount);
|
||||||
+#elif PLATFORM(GTK)
|
+#elif PLATFORM(GTK)
|
||||||
+ WallTime timestamp = WallTime::now();
|
+ WallTime timestamp = WallTime::now();
|
||||||
+ NativeWebMouseEvent event(
|
+ NativeWebMouseEvent event(
|
||||||
+ type,
|
+ eventType,
|
||||||
+ button,
|
+ eventButton,
|
||||||
+ buttons,
|
+ eventButtons,
|
||||||
+ {in_x, in_y},
|
+ {x, y},
|
||||||
+ WebCore::IntPoint(),
|
+ WebCore::IntPoint(),
|
||||||
+ deltaX,
|
+ eventDeltaX,
|
||||||
+ deltaY,
|
+ eventDeltaY,
|
||||||
+ 0,
|
+ 0,
|
||||||
+ clickCount,
|
+ eventClickCount,
|
||||||
+ modifiers,
|
+ eventModifiers,
|
||||||
+ timestamp);
|
+ timestamp);
|
||||||
+ m_page.handleMouseEvent(event);
|
+ m_page.handleMouseEvent(event);
|
||||||
+#endif
|
+#endif
|
||||||
@ -7722,7 +7719,7 @@ index 0000000000000000000000000000000000000000..d84e2831aeada920eefc0cb62b865e30
|
|||||||
+} // namespace WebKit
|
+} // namespace WebKit
|
||||||
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..a5b8a858b918332c272660b5d4de05be9f3123e3
|
index 0000000000000000000000000000000000000000..76290475097e756e3d932d22be4d8c797be4aa0c
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
+++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h
|
||||||
@@ -0,0 +1,84 @@
|
@@ -0,0 +1,84 @@
|
||||||
@ -7786,8 +7783,8 @@ index 0000000000000000000000000000000000000000..a5b8a858b918332c272660b5d4de05be
|
|||||||
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
+ void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
|
||||||
+
|
+
|
||||||
+ // Protocol handler
|
+ // Protocol handler
|
||||||
+ void dispatchKeyEvent(const String& in_type, const int* opt_in_modifiers, const String* opt_in_text, const String* opt_in_unmodifiedText, const String* opt_in_code, const String* opt_in_key, const int* opt_in_windowsVirtualKeyCode, const int* opt_in_nativeVirtualKeyCode, const bool* opt_in_autoRepeat, const bool* opt_in_isKeypad, const bool* opt_in_isSystemKey, const JSON::Array*, Ref<DispatchKeyEventCallback>&& callback) override;
|
+ void 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*, Ref<DispatchKeyEventCallback>&& callback) override;
|
||||||
+ void dispatchMouseEvent(const String& in_type, int in_x, int in_y, const int* opt_in_modifiers, const String* opt_in_button, const int* opt_in_buttons, const int* opt_in_clickCount, const int* opt_in_deltaX, const int* opt_in_deltaY, Ref<DispatchMouseEventCallback>&& callback) override;
|
+ 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;
|
||||||
+
|
+
|
||||||
+private:
|
+private:
|
||||||
+ 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);
|
+ 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);
|
||||||
|
Loading…
Reference in New Issue
Block a user