Bug 204581
| Summary: | [GTK] Double-click doesn't update document::Selection | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Milan Crha <mcrha> |
| Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | bugs-noreply |
| Priority: | P2 | ||
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Milan Crha
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Milan Crha
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