mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibWeb: Defer mouse events from TextNode to Label
A label's format is: <label>Label text</label> So, a TextNode is created as a child of the Label node, and EventHandler will send events to the TextNode. This changes TextNode to accept mouse events if its parent is a Label, and to forward those events upward.
This commit is contained in:
parent
d8106dda73
commit
e1b5613142
Notes:
sideshowbarker
2024-07-18 20:49:55 +09:00
Author: https://github.com/trflynn89
Commit: e1b5613142
Pull-request: https://github.com/SerenityOS/serenity/pull/6105
5 changed files with 41 additions and 8 deletions
|
@ -45,7 +45,7 @@ Label::~Label()
|
|||
{
|
||||
}
|
||||
|
||||
void Label::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned)
|
||||
void Label::handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button)
|
||||
{
|
||||
if (button != GUI::MouseButton::Left)
|
||||
return;
|
||||
|
@ -56,7 +56,7 @@ void Label::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned
|
|||
m_tracking_mouse = true;
|
||||
}
|
||||
|
||||
void Label::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
|
||||
void Label::handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint& position, unsigned button)
|
||||
{
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Left)
|
||||
return;
|
||||
|
@ -75,7 +75,7 @@ void Label::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, u
|
|||
m_tracking_mouse = false;
|
||||
}
|
||||
|
||||
void Label::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned, unsigned)
|
||||
void Label::handle_mousemove_on_label(Badge<TextNode>, const Gfx::IntPoint& position, unsigned)
|
||||
{
|
||||
if (!m_tracking_mouse)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue