1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibVT: Don't commit to opening a hyperlink until mouseup

It felt too rushed to open links when simply mousedown'ing on them.
Improve this by implementing basic "click" semantics instead.

This patch also introduces the ability to prevent link opening if you
want to force selection instead. Hold shift and we will not open links.
This commit is contained in:
Andreas Kling 2020-05-10 15:57:45 +02:00
parent c6f098c5a9
commit ab7de41c7b
2 changed files with 50 additions and 11 deletions

View file

@ -94,6 +94,7 @@ private:
virtual void keydown_event(GUI::KeyEvent&) override;
virtual void keyup_event(GUI::KeyEvent&) override;
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void mouseup_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
virtual void mousewheel_event(GUI::MouseEvent&) override;
virtual void doubleclick_event(GUI::MouseEvent&) override;
@ -133,6 +134,8 @@ private:
String m_hovered_href;
String m_hovered_href_id;
String m_active_href_id;
// Snapshot of m_hovered_href when opening a context menu for a hyperlink.
String m_context_menu_href;