mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
LibWeb: Bring MouseEvent a bit closer to spec
This commit is contained in:
parent
a2bc97a9c2
commit
1b94b4c593
6 changed files with 75 additions and 18 deletions
|
@ -191,12 +191,12 @@ bool EventHandler::handle_mouseup(Gfx::IntPoint const& position, unsigned button
|
|||
return false;
|
||||
}
|
||||
auto offset = compute_mouse_event_offset(position, paintable->layout_node());
|
||||
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mouseup, offset.x(), offset.y(), position.x(), position.y()));
|
||||
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(UIEvents::EventNames::mouseup, offset.x(), offset.y(), position.x(), position.y(), button));
|
||||
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()));
|
||||
run_activation_behavior = node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(UIEvents::EventNames::click, offset.x(), offset.y(), position.x(), position.y(), button));
|
||||
}
|
||||
|
||||
if (run_activation_behavior) {
|
||||
|
@ -308,7 +308,7 @@ bool EventHandler::handle_mousedown(Gfx::IntPoint const& position, unsigned butt
|
|||
|
||||
m_mousedown_target = node;
|
||||
auto offset = compute_mouse_event_offset(position, paintable->layout_node());
|
||||
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mousedown, offset.x(), offset.y(), position.x(), position.y()));
|
||||
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(UIEvents::EventNames::mousedown, offset.x(), offset.y(), position.x(), position.y(), button));
|
||||
}
|
||||
|
||||
// NOTE: Dispatching an event may have disturbed the world.
|
||||
|
@ -416,7 +416,7 @@ bool EventHandler::handle_mousemove(Gfx::IntPoint const& position, unsigned butt
|
|||
}
|
||||
|
||||
auto offset = compute_mouse_event_offset(position, paintable->layout_node());
|
||||
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mousemove, offset.x(), offset.y(), position.x(), position.y()));
|
||||
node->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(UIEvents::EventNames::mousemove, offset.x(), offset.y(), position.x(), position.y()));
|
||||
// NOTE: Dispatching an event may have disturbed the world.
|
||||
if (!paint_root() || paint_root() != node->document().paint_box())
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue