diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-04-03 21:48:05 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-04 16:13:25 +0200 |
commit | e1b5613142b7658d1975e30295eb1a3b3180e3ea (patch) | |
tree | d5989a653ff3839387255f2c344ee90345876dd4 /Userland/Libraries/LibWeb/Layout/Label.cpp | |
parent | d8106dda73324c4619b661a21d4dfe42ff83bf2f (diff) | |
download | serenity-e1b5613142b7658d1975e30295eb1a3b3180e3ea.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/Label.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Label.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp index 47cc0b1219..6de2615ad4 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.cpp +++ b/Userland/Libraries/LibWeb/Layout/Label.cpp @@ -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; |