mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
LibWeb: Dispatch mouseout and mouseover events
This commit is contained in:
parent
ed24d8f2b5
commit
4ae2eaead1
Notes:
sideshowbarker
2024-07-17 03:03:15 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 4ae2eaead1
Pull-request: https://github.com/SerenityOS/serenity/pull/23706
1 changed files with 12 additions and 0 deletions
|
@ -1298,6 +1298,12 @@ void Document::set_hovered_node(Node* node)
|
|||
else
|
||||
invalidate_style();
|
||||
|
||||
// https://w3c.github.io/uievents/#mouseout
|
||||
if (old_hovered_node && old_hovered_node != m_hovered_node) {
|
||||
auto event = UIEvents::MouseEvent::create(realm(), UIEvents::EventNames::mouseout);
|
||||
old_hovered_node->dispatch_event(event);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/uievents/#mouseleave
|
||||
if (old_hovered_node && (!m_hovered_node || !m_hovered_node->is_descendant_of(*old_hovered_node))) {
|
||||
// FIXME: Check if we need to dispatch these events in a specific order.
|
||||
|
@ -1307,6 +1313,12 @@ void Document::set_hovered_node(Node* node)
|
|||
}
|
||||
}
|
||||
|
||||
// https://w3c.github.io/uievents/#mouseover
|
||||
if (m_hovered_node && m_hovered_node != old_hovered_node) {
|
||||
auto event = UIEvents::MouseEvent::create(realm(), UIEvents::EventNames::mouseover);
|
||||
m_hovered_node->dispatch_event(event);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/uievents/#mouseenter
|
||||
if (m_hovered_node && (!old_hovered_node || !m_hovered_node->is_ancestor_of(*old_hovered_node))) {
|
||||
// FIXME: Check if we need to dispatch these events in a specific order.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue