mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibWeb: Skip anchor activation behavior if the click event was cancelled
This commit is contained in:
parent
cc411b328c
commit
a2bc97a9c2
Notes:
sideshowbarker
2024-07-17 21:11:12 +09:00
Author: https://github.com/Igoorx
Commit: a2bc97a9c2
Pull-request: https://github.com/SerenityOS/serenity/pull/13589
1 changed files with 51 additions and 48 deletions
|
@ -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()));
|
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mouseup, offset.x(), offset.y(), position.x(), position.y()));
|
||||||
handled_event = true;
|
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
|
// FIXME: This is ad-hoc and incorrect. The reason this exists is
|
||||||
// because we are missing browsing context navigation:
|
// 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));
|
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()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue