Bug 191182
Summary: | [GTK] Text offset calculation breaks with certain emojicons | ||
---|---|---|---|
Product: | WebKit | Reporter: | Milan Crha <mcrha> |
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | bugs-noreply |
Priority: | P2 | ||
Version: | Other | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Milan Crha
Moving this from a downstream bug report:
https://gitlab.gnome.org/GNOME/evolution/issues/206
It contains more details, I'll summarize it here:
Evolution uses webkit_dom_range_get_end_offset() and webkit_dom_character_data_delete_data() with other offset-related WebKitDOMCharacterData functions to replace emoticons written by a user to either images or Unicode letters or "normalized appearance" (like from ":)" to ":-)"). Just have in Edit->Preferences->Composer Preferences checked [x] Automatically insert emoticons and [x] Use Unicode characters for emoticons, then create a new message in Plain Text mode and type:
:) ;) :)
The first two will be replaced, but the third not ("☺ 😉 :)").
I figured out that the webkit_dom_range_get_end_offset() returns wrong value when the text contains a wink Unicode letter, it says that the end is one letter after the text (character) length. When I workaround it and clamp it, then the replacement of the typed ":)" at the end is made also off-by-one, thus it makes it "☺ 😉)☺" instead of "☺ 😉 ☺", which makes me believe the WebKitDOMCharacterData functions are affected the same way.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Milan Crha
I forgot to mention, I can reproduce it with webkit2gtk3 2.22.3 too.