1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibWeb: Remove navigate() in EventHandler::handle_mouseup()

Before this change `navigate()` was always invoked twice when a link
is clicked:
- From `activation_behavior` callback of `HTMLAnchorElement` during
  event dispatch.
- Directly from `handle_mouseup`.
This commit is contained in:
Aliaksandr Kalenik 2023-11-18 14:46:24 +01:00 committed by Andreas Kling
parent 4f2a0a3d56
commit 7b3559f1c2

View file

@ -284,9 +284,7 @@ bool EventHandler::handle_mouseup(CSSPixelPoint position, CSSPixelPoint screen_p
auto href = link->href();
auto url = document->parse_url(href);
dbgln("Web::EventHandler: Clicking on a link to {}", url);
if (button == GUI::MouseButton::Primary) {
MUST(document->navigable()->navigate({ .url = url, .source_document = document }));
} else if (button == GUI::MouseButton::Middle) {
if (button == GUI::MouseButton::Middle) {
if (auto* page = m_browsing_context->page())
page->client().page_did_middle_click_link(url, link->target(), modifiers);
} else if (button == GUI::MouseButton::Secondary) {