mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:27:35 +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
5 changed files with 41 additions and 8 deletions
|
@ -41,12 +41,11 @@ public:
|
|||
const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockBox::dom_node()); }
|
||||
HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockBox::dom_node()); }
|
||||
|
||||
private:
|
||||
virtual bool wants_mouse_events() const override { return true; }
|
||||
virtual void handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers) override;
|
||||
virtual void handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers) override;
|
||||
virtual void handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned modifiers) override;
|
||||
void handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
|
||||
void handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
|
||||
void handle_mousemove_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
|
||||
|
||||
private:
|
||||
static Label* label_for_control_node(LabelableNode&);
|
||||
LabelableNode* control_node();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue