1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:07: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:
Timothy Flynn 2021-04-03 21:48:05 -04:00 committed by Andreas Kling
parent d8106dda73
commit e1b5613142
5 changed files with 41 additions and 8 deletions

View file

@ -48,6 +48,10 @@ public:
private:
virtual bool is_text_node() const final { return true; }
virtual bool wants_mouse_events() const override;
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 split_into_lines_by_rules(InlineFormattingContext&, LayoutMode, bool do_collapse, bool do_wrap_lines, bool do_wrap_breaks);
void paint_cursor_if_needed(PaintContext&, const LineBoxFragment&) const;