mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 08:00:45 +00:00
This effectively reverts da26941b50
.
When the user double-clicks a word on screen, they are interacting with
the rendered text, which has e.g. whitespace collapsing applied. If we
acquire word boundaries from the raw text, the resulting selection is
not right.
We still have issues with acquiring the right selection via APIs such as
`document.getSelection`. The offsets computed here are effectively then
applied to the raw text. But this issue is present all over EventHandler
and this patch at least makes the selection visually accurate.
11 lines
334 B
HTML
11 lines
334 B
HTML
<!DOCTYPE html>
|
|
<script src="include.js"></script>
|
|
<p id="text">Lorem ipsum dolor sit amet</p>
|
|
<script>
|
|
test(() => {
|
|
internals.doubleclick(85, 20);
|
|
|
|
const selection = document.getSelection().getRangeAt(0);
|
|
println(`Selected range: ${selection.startOffset} - ${selection.endOffset}`);
|
|
});
|
|
</script>
|