LibWeb: Improve caret positioning behavior inside fragments

When clicking on a glyph or starting a selection on it, we would use the
glyph's offset/index as the position which represents the left side of
the glyph, or the position between the glyph and the glyph before it.

Instead of looking at which glyph is under the mouse pointer, look at
which glyph boundary is closer. Now, if you click to the right of a
glyph (but still on that glyph), it correctly selects the next glyph's
offset as the position.
This commit is contained in:
Jelle Raaijmakers 2025-06-12 13:04:58 +02:00 committed by Jelle Raaijmakers
commit dbbdf2cebc
Notes: github-actions[bot] 2025-06-13 13:09:58 +00:00
4 changed files with 18 additions and 22 deletions

View file

@ -1,5 +1,5 @@
<#text>
index: 1
index: 2
<BODY>
---
<#text>
@ -7,7 +7,7 @@ index: 1
<B id="b1">
---
<#text>
index: 1
index: 2
<DIV id="d1">
---
<#text>

View file

@ -1 +1 @@
192
193