From 237a5bedd259e606027f36e2b758f4bafde9048b Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Tue, 14 Jun 2022 19:39:33 +0200 Subject: [PATCH] LibWeb: Dispatch `dblclick` UI Events on double click --- Userland/Libraries/LibWeb/Page/EventHandler.cpp | 3 ++- Userland/Libraries/LibWeb/UIEvents/EventNames.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 585cf6e748..ecdfdd9cf7 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -542,7 +542,8 @@ bool EventHandler::handle_doubleclick(Gfx::IntPoint const& position, unsigned bu if (!node || !layout_node) return false; - // FIXME: Dispatch 'dblclick' events. + auto offset = compute_mouse_event_offset(position, *layout_node); + node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(UIEvents::EventNames::dblclick, offset.x(), offset.y(), position.x(), position.y(), button)); // FIXME: Select word diff --git a/Userland/Libraries/LibWeb/UIEvents/EventNames.h b/Userland/Libraries/LibWeb/UIEvents/EventNames.h index 9c71ef4ab2..773543d0de 100644 --- a/Userland/Libraries/LibWeb/UIEvents/EventNames.h +++ b/Userland/Libraries/LibWeb/UIEvents/EventNames.h @@ -15,6 +15,7 @@ namespace Web::UIEvents::EventNames { #define ENUMERATE_UI_EVENTS \ __ENUMERATE_UI_EVENT(click) \ + __ENUMERATE_UI_EVENT(dblclick) \ __ENUMERATE_UI_EVENT(keydown) \ __ENUMERATE_UI_EVENT(keyup) \ __ENUMERATE_UI_EVENT(mousedown) \