mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibWeb: Dispatch a click event after mousedown+mouseup on same target
This commit is contained in:
parent
6c31f6c073
commit
fbd58f9615
2 changed files with 7 additions and 0 deletions
|
@ -169,6 +169,10 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button
|
||||||
auto offset = compute_mouse_event_offset(position, *result.layout_node);
|
auto offset = compute_mouse_event_offset(position, *result.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(UIEvents::EventNames::mouseup, offset.x(), offset.y(), position.x(), position.y()));
|
||||||
handled_event = true;
|
handled_event = true;
|
||||||
|
|
||||||
|
if (node.ptr() == m_mousedown_target) {
|
||||||
|
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::click, offset.x(), offset.y(), position.x(), position.y()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button == GUI::MouseButton::Primary)
|
if (button == GUI::MouseButton::Primary)
|
||||||
|
@ -220,6 +224,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
||||||
page->set_focused_browsing_context({}, m_browsing_context);
|
page->set_focused_browsing_context({}, m_browsing_context);
|
||||||
|
|
||||||
auto offset = compute_mouse_event_offset(position, *result.layout_node);
|
auto offset = compute_mouse_event_offset(position, *result.layout_node);
|
||||||
|
m_mousedown_target = node;
|
||||||
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mousedown, offset.x(), offset.y(), position.x(), position.y()));
|
node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mousedown, offset.x(), offset.y(), position.x(), position.y()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ private:
|
||||||
WeakPtr<Layout::Node> m_mouse_event_tracking_layout_node;
|
WeakPtr<Layout::Node> m_mouse_event_tracking_layout_node;
|
||||||
|
|
||||||
NonnullOwnPtr<EditEventHandler> m_edit_event_handler;
|
NonnullOwnPtr<EditEventHandler> m_edit_event_handler;
|
||||||
|
|
||||||
|
WeakPtr<DOM::EventTarget> m_mousedown_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue