mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Run page activation behavior when skipping context menu events
We partially supported this feature, but not enough for the chrome's context menu to open. We now propagate the event back to the chrome.
This commit is contained in:
parent
f6407276f7
commit
c4750f6eec
Notes:
sideshowbarker
2024-07-17 10:08:28 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/c4750f6eec Pull-request: https://github.com/SerenityOS/serenity/pull/24111
@ -270,10 +270,15 @@ bool EventHandler::handle_mouseup(CSSPixelPoint position, CSSPixelPoint screen_p
|
||||
|
||||
bool run_activation_behavior = false;
|
||||
if (node.ptr() == m_mousedown_target) {
|
||||
if (button == GUI::MouseButton::Primary)
|
||||
if (button == GUI::MouseButton::Primary) {
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::click, screen_position, page_offset, client_offset, offset, {}, 1, button, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
else if (button == GUI::MouseButton::Secondary && !(modifiers & Mod_Shift)) // Allow the user to bypass custom context menus by holding shift, like Firefox.
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::contextmenu, screen_position, page_offset, client_offset, offset, {}, 1, button, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
} else if (button == GUI::MouseButton::Secondary) {
|
||||
// Allow the user to bypass custom context menus by holding shift, like Firefox.
|
||||
if ((modifiers & Mod_Shift) == 0)
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::contextmenu, screen_position, page_offset, client_offset, offset, {}, 1, button, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
else
|
||||
run_activation_behavior = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_activation_behavior) {
|
||||
|
Loading…
Reference in New Issue
Block a user