LibWeb: Specialize hit testing for text cursor purposes

The text cursor follows slightly different "intuitive" rules than the
regular hit testing. Clicking past the right edge of a text box should
still "hit" the text box, and place the cursor at its end, for example.

We solve this by adding a HitTestType enum that is passed to hit_test()
and determines whether past-the-edge candidates are considered.
This commit is contained in:
Andreas Kling 2020-08-05 16:55:56 +02:00
commit e2b4fef6c7
Notes: sideshowbarker 2024-07-19 04:16:22 +09:00
11 changed files with 38 additions and 27 deletions

View file

@ -55,7 +55,7 @@ public:
float absolute_y() const { return absolute_rect().y(); }
Gfx::FloatPoint absolute_position() const { return absolute_rect().location(); }
virtual HitTestResult hit_test(const Gfx::IntPoint& absolute_position) const override;
virtual HitTestResult hit_test(const Gfx::IntPoint&, HitTestType) const override;
virtual void set_needs_display() override;
bool is_body() const;