1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 00:37:34 +00:00

LibWeb: Skip anchor activation behavior if the click event was cancelled

This commit is contained in:
Igor Pissolati 2022-04-08 21:48:00 -03:00 committed by Andreas Kling
parent cc411b328c
commit a2bc97a9c2

View file

@ -194,6 +194,12 @@ bool EventHandler::handle_mouseup(Gfx::IntPoint const& position, unsigned button
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mouseup, offset.x(), offset.y(), position.x(), position.y()));
handled_event = true;
bool run_activation_behavior = true;
if (node.ptr() == m_mousedown_target && button == GUI::MouseButton::Primary) {
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::click, offset.x(), offset.y(), position.x(), position.y()));
}
if (run_activation_behavior) {
// FIXME: This is ad-hoc and incorrect. The reason this exists is
// because we are missing browsing context navigation:
//
@ -241,9 +247,6 @@ bool EventHandler::handle_mouseup(Gfx::IntPoint const& position, unsigned button
page->client().page_did_request_context_menu(m_browsing_context.to_top_level_position(position));
}
}
if (node.ptr() == m_mousedown_target && button == GUI::MouseButton::Primary) {
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::click, offset.x(), offset.y(), position.x(), position.y()));
}
}
}