Bug 327414
| Summary: | [GTK][WPE] Input method delete-surrounding that splits a character leaves a selection behind or puts the caret inside it | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Simon Pena <spena> |
| Component: | WPE WebKit | Assignee: | Fujii Hironori <fujii> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | bugs-noreply, cgarcia, fujii |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=327412 | ||
Simon Pena
When a delete-surrounding range ends inside a character or a grapheme cluster:
- After "a👨👩👦", a ZWJ sequence, delete-surrounding(-2, 2) deletes nothing and leaves the last emoji of the sequence selected. The next character typed replaces it.
- After "a😀b", delete-surrounding(-2, 0), a caret move, puts the caret between the two halves of the emoji's surrogate pair.
WebPage::deleteSurrounding() sets the selection to the requested range and deletes it. When the delete does nothing, the selection is not restored.
Expected: a range that splits a character never leaves a selection behind, and a caret move never lands inside a character. Either do nothing and keep the caret where it was, or round the range to whole characters.
Found with API tests while looking at bug 327412.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Simon Pena
In a password field, the same split delete corrupts the text instead of doing nothing. API test, with the caret after "a😀" and delete-surrounding(-1, 1):
- <input>: "a😀", nothing deleted.
- <textarea>: "a😀", nothing deleted.
- <input type="password">: "a\ud83d", the low half of the surrogate pair is deleted and a lone high surrogate is left in the value.
Also seen on Android with wpe-android, where the keyboard is not told the text of password fields and sends a delete of 1 after an emoji.
Fujii Hironori
Pull request: https://github.com/WebKit/WebKit/pull/78276
EWS
Committed 324679@main (458b3214334b): <https://commits.webkit.org/324679@main>
Reviewed commits have been landed. Closing PR #78276 and removing active labels.