mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibWeb: Dispatch click events using the correct button/buttons
We were generating click events always using the primary mouse button instead of the provided button, and with the buttons field set to that provided button.
This commit is contained in:
parent
ae01904369
commit
dd5a0361f2
Notes:
github-actions[bot]
2024-09-29 17:31:17 +00:00
Author: https://github.com/trflynn89
Commit: dd5a0361f2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1564
3 changed files with 36 additions and 4 deletions
|
@ -297,13 +297,13 @@ EventResult EventHandler::handle_mouseup(CSSPixelPoint viewport_position, CSSPix
|
|||
bool run_activation_behavior = false;
|
||||
if (node.ptr() == m_mousedown_target) {
|
||||
if (button == UIEvents::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());
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::click, screen_position, page_offset, client_offset, offset, {}, button, buttons, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
} else if (button == UIEvents::MouseButton::Middle) {
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::auxclick, screen_position, page_offset, client_offset, offset, {}, 1, button, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::auxclick, screen_position, page_offset, client_offset, offset, {}, button, buttons, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
} else if (button == UIEvents::MouseButton::Secondary) {
|
||||
// Allow the user to bypass custom context menus by holding shift, like Firefox.
|
||||
if ((modifiers & UIEvents::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());
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::contextmenu, screen_position, page_offset, client_offset, offset, {}, button, buttons, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
else
|
||||
run_activation_behavior = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue