RESOLVED INVALID 204581
[GTK] Double-click doesn't update document::Selection
https://bugs.webkit.org/show_bug.cgi?id=204581
Summary [GTK] Double-click doesn't update document::Selection
Milan Crha
Reported 2019-11-25 07:56:45 PST
When I double-click a word in editable content it's visually properly highlighted as selected, but the JavaScript's document.getSelection() is not updated - it claims the baseNode and extentNode are the same, with the same base/extentOffset, the place where the mouse cursor was when I double-clicked within the word. Changing selection by drag properly updates the Selection object. Neither triple-click updates the Selection object.
Attachments
Milan Crha
Comment 1 2020-02-18 05:35:12 PST
I made some testing here and what I wrote above is not accurate. The base/extent pair (node and offset) reference the place where had been clicked, while anchor/focus pair reference what is actually selected. These two are equal in many cases, only not here (maybe in other places too, I just faced this one). I see I made a mistake, the WebKit exposes base/extent pairs, while these are not part of the standard [1], thus I'm going to change my code. I though the base/extent is what should be used, due to Selection::setBaseAndExtent() method, whose name confused me. [1] https://w3c.github.io/selection-api/#selection-interface
Note You need to log in before you can comment on or make changes to this bug.