From 22d06a4ff01dd1faf8fa4a21f1f658d68cf80636 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 5 Aug 2023 17:24:03 +0100 Subject: [PATCH] LibWeb: Set scroll step size to a value consistent with Qt/Ladybird This probably should not be hardcoded, but for now having a consistent value makes things feel nice. --- Userland/Libraries/LibWeb/Page/EventHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 24f5cbedac..0ea1aff1b0 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -146,6 +146,8 @@ Painting::PaintableBox const* EventHandler::paint_root() const bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, unsigned buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y) { + constexpr int scroll_step_size = 24; + if (m_browsing_context->active_document()) m_browsing_context->active_document()->update_layout(); @@ -181,7 +183,7 @@ bool EventHandler::handle_mousewheel(CSSPixelPoint position, unsigned button, un if (node->dispatch_event(UIEvents::WheelEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::wheel, offset.x(), offset.y(), position.x(), position.y(), wheel_delta_x, wheel_delta_y, buttons, button).release_value_but_fixme_should_propagate_errors())) { if (auto* page = m_browsing_context->page()) { if (m_browsing_context == &page->top_level_browsing_context()) - page->client().page_did_request_scroll(wheel_delta_x * 20, wheel_delta_y * 20); + page->client().page_did_request_scroll(wheel_delta_x * scroll_step_size, wheel_delta_y * scroll_step_size); } }