diff --git a/browser_patches/webkit/BUILD_NUMBER b/browser_patches/webkit/BUILD_NUMBER index 993ce2181c..a946cfab80 100644 --- a/browser_patches/webkit/BUILD_NUMBER +++ b/browser_patches/webkit/BUILD_NUMBER @@ -1,2 +1,2 @@ -1534 -Changed: dkolesa@igalia.com Thu Aug 19 03:58:22 AM CEST 2021 +1535 +Changed: joel.einbinder@gmail.com Tue 24 Aug 2021 12:05:10 PM PDT diff --git a/browser_patches/webkit/patches/bootstrap.diff b/browser_patches/webkit/patches/bootstrap.diff index 3576db5539..420d0ae4d3 100644 --- a/browser_patches/webkit/patches/bootstrap.diff +++ b/browser_patches/webkit/patches/bootstrap.diff @@ -697,10 +697,10 @@ index 0000000000000000000000000000000000000000..347a01b3fdd1a8277cb4104558e8bbfa +} diff --git a/Source/JavaScriptCore/inspector/protocol/Input.json b/Source/JavaScriptCore/inspector/protocol/Input.json new file mode 100644 -index 0000000000000000000000000000000000000000..587287d52fde2735cbae34a27a0f673b7e38e1a7 +index 0000000000000000000000000000000000000000..b9ab57a2b5739ed997231399b4bd4042a0cb0935 --- /dev/null +++ b/Source/JavaScriptCore/inspector/protocol/Input.json -@@ -0,0 +1,188 @@ +@@ -0,0 +1,223 @@ +{ + "domain": "Input", + "availability": ["web"], @@ -865,6 +865,41 @@ index 0000000000000000000000000000000000000000..587287d52fde2735cbae34a27a0f673b + ] + }, + { ++ "name": "dispatchWheelEvent", ++ "description": "Dispatches a wheel event to the page.", ++ "async": true, ++ "parameters": [ ++ { ++ "name": "x", ++ "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.", ++ "type": "integer" ++ }, ++ { ++ "name": "y", ++ "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.", ++ "type": "integer" ++ }, ++ { ++ "name": "modifiers", ++ "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", ++ "optional": true, ++ "type": "integer" ++ }, ++ { ++ "name": "deltaX", ++ "description": "X delta in CSS pixels for mouse wheel event (default: 0).", ++ "optional": true, ++ "type": "integer" ++ }, ++ { ++ "name": "deltaY", ++ "description": "Y delta in CSS pixels for mouse wheel event (default: 0).", ++ "optional": true, ++ "type": "integer" ++ } ++ ] ++ }, ++ { + "name": "dispatchTapEvent", + "description": "Dispatches a tap event to the page.", + "async": true, @@ -10046,6 +10081,20 @@ index 001558dd58f4d85f360d5711caa03db33889011e..1e0898f985f1d13036d31e3e284258a3 #if USE(APPKIT) NSEvent* nativeEvent() const { return m_nativeEvent.get(); } #elif PLATFORM(GTK) +diff --git a/Source/WebKit/Shared/NativeWebWheelEvent.h b/Source/WebKit/Shared/NativeWebWheelEvent.h +index f48dc00755b6847f2c13e5f7dac652c2a91f66ea..eb9c890c52f47913a8dc7950d6d3fa1e037e5aca 100644 +--- a/Source/WebKit/Shared/NativeWebWheelEvent.h ++++ b/Source/WebKit/Shared/NativeWebWheelEvent.h +@@ -67,7 +67,8 @@ public: + #elif PLATFORM(WIN) + NativeWebWheelEvent(HWND, UINT message, WPARAM, LPARAM); + #endif +- ++ NativeWebWheelEvent(const WebWheelEvent & webWheelEvent) ++ : WebWheelEvent(webWheelEvent) { } + #if USE(APPKIT) + NSEvent* nativeEvent() const { return m_nativeEvent.get(); } + #elif PLATFORM(GTK) diff --git a/Source/WebKit/Shared/SandboxExtension.h b/Source/WebKit/Shared/SandboxExtension.h index c359eeaa440586fa61d3bc31def069ffcfa6e771..311cc74c62bdda4d147c221f85b3e55ed4ee481c 100644 --- a/Source/WebKit/Shared/SandboxExtension.h @@ -16891,10 +16940,10 @@ index 0000000000000000000000000000000000000000..b3bb4880a866ee6132b8b26acf8dad81 +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..61d1f18d8b7ba5eda1ec1e3c7fd59f3dd90f546d +index 0000000000000000000000000000000000000000..64a07aecf03b294abdafec044b235c84f6fe9016 --- /dev/null +++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.cpp -@@ -0,0 +1,288 @@ +@@ -0,0 +1,329 @@ +/* + * Copyright (C) 2019 Microsoft Corporation. + * @@ -16925,6 +16974,8 @@ index 0000000000000000000000000000000000000000..61d1f18d8b7ba5eda1ec1e3c7fd59f3d + +#include "NativeWebKeyboardEvent.h" +#include "NativeWebMouseEvent.h" ++#include "NativeWebWheelEvent.h" ++#include "WebWheelEvent.h" +#include "WebPageProxy.h" +#include +#include @@ -16971,6 +17022,9 @@ index 0000000000000000000000000000000000000000..61d1f18d8b7ba5eda1ec1e3c7fd59f3d +class WebPageInspectorInputAgent::MouseCallbacks : public CallbackList { +}; + ++class WebPageInspectorInputAgent::WheelCallbacks : public CallbackList { ++}; ++ +WebPageInspectorInputAgent::WebPageInspectorInputAgent(Inspector::BackendDispatcher& backendDispatcher, WebPageProxy& page) + : InspectorAgentBase("Input"_s) + , m_backendDispatcher(InputBackendDispatcher::create(backendDispatcher, this)) @@ -16991,16 +17045,23 @@ index 0000000000000000000000000000000000000000..61d1f18d8b7ba5eda1ec1e3c7fd59f3d + m_mouseCallbacks->sendSuccess(); +} + ++void WebPageInspectorInputAgent::didProcessAllPendingWheelEvents() ++{ ++ m_wheelCallbacks->sendSuccess(); ++} ++ +void WebPageInspectorInputAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) +{ + m_keyboardCallbacks = makeUnique(); + m_mouseCallbacks = makeUnique(); ++ m_wheelCallbacks = makeUnique(); +} + +void WebPageInspectorInputAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason) +{ + m_keyboardCallbacks = nullptr; + m_mouseCallbacks = nullptr; ++ m_wheelCallbacks = nullptr; +} + +static String keyIdentifierForKey(const String& key) @@ -17182,13 +17243,42 @@ index 0000000000000000000000000000000000000000..61d1f18d8b7ba5eda1ec1e3c7fd59f3d + callback->sendSuccess(); + }); +} ++ ++void WebPageInspectorInputAgent::dispatchWheelEvent(int x, int y, std::optional&& modifiers, std::optional&& deltaX, std::optional&& deltaY, Ref&& callback) ++{ ++ OptionSet eventModifiers; ++ if (modifiers) ++ eventModifiers = eventModifiers.fromRaw(*modifiers); ++ ++ float eventDeltaX = 0.0f; ++ if (deltaX) ++ eventDeltaX = *deltaX; ++ float eventDeltaY = 0.0f; ++ if (deltaY) ++ eventDeltaY = *deltaY; ++ m_wheelCallbacks->append(WTFMove(callback)); ++ ++ // Convert css coordinates to view coordinates (dip). ++ double totalScale = m_page.pageScaleFactor() * m_page.viewScaleFactor(); ++ x = clampToInteger(roundf(x * totalScale)); ++ y = clampToInteger(roundf(y * totalScale)); ++ ++ WallTime timestamp = WallTime::now(); ++ WebCore::FloatSize delta = {eventDeltaX, eventDeltaY}; ++ WebCore::FloatSize wheelTicks = delta; ++ wheelTicks.scale(1.0f / WebCore::Scrollbar::pixelsPerLineStep()); ++ WebWheelEvent webEvent(WebEvent::Wheel, {x, y}, {x, y}, delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, eventModifiers, timestamp); ++ NativeWebWheelEvent event(webEvent); ++ m_page.handleWheelEvent(event); ++} ++ +} // namespace WebKit diff --git a/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h new file mode 100644 -index 0000000000000000000000000000000000000000..fb4855b939efdd36acd011a41244a579152bf574 +index 0000000000000000000000000000000000000000..48c9ccc420c1b4ae3259e1d5ba17fd8fbea24b96 --- /dev/null +++ b/Source/WebKit/UIProcess/WebPageInspectorInputAgent.h -@@ -0,0 +1,82 @@ +@@ -0,0 +1,86 @@ +/* + * Copyright (C) 2019 Microsoft Corporation. + * @@ -17244,6 +17334,7 @@ index 0000000000000000000000000000000000000000..fb4855b939efdd36acd011a41244a579 + + void didProcessAllPendingKeyboardEvents(); + void didProcessAllPendingMouseEvents(); ++ void didProcessAllPendingWheelEvents(); + + void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override; + void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override; @@ -17252,6 +17343,7 @@ index 0000000000000000000000000000000000000000..fb4855b939efdd36acd011a41244a579 + void dispatchKeyEvent(const String& type, std::optional&& modifiers, const String& text, const String& unmodifiedText, const String& code, const String& key, std::optional&& windowsVirtualKeyCode, std::optional&& nativeVirtualKeyCode, std::optional&& autoRepeat, std::optional&& isKeypad, std::optional&& isSystemKey, RefPtr&&, Ref&& callback) override; + void dispatchMouseEvent(const String& type, int x, int y, std::optional&& modifiers, const String& button, std::optional&& buttons, std::optional&& clickCount, std::optional&& deltaX, std::optional&& deltaY, Ref&& callback) override; + void dispatchTapEvent(int x, int y, std::optional&& modifiers, Ref&& callback) override; ++ void dispatchWheelEvent(int x, int y, std::optional&& modifiers, std::optional&& deltaX, std::optional&& deltaY, Ref&& callback) override; + +private: + 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 modifiers, Vector& commands, WallTime timestamp); @@ -17268,6 +17360,8 @@ index 0000000000000000000000000000000000000000..fb4855b939efdd36acd011a41244a579 + std::unique_ptr m_keyboardCallbacks; + class MouseCallbacks; + std::unique_ptr m_mouseCallbacks; ++ class WheelCallbacks; ++ std::unique_ptr m_wheelCallbacks; +}; + +} // namespace WebKit