NEW 191182
[GTK] Text offset calculation breaks with certain emojicons
https://bugs.webkit.org/show_bug.cgi?id=191182
Summary [GTK] Text offset calculation breaks with certain emojicons
Milan Crha
Reported 2018-11-02 01:32:31 PDT
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
Milan Crha
Comment 1 2018-11-02 01:34:32 PDT
I forgot to mention, I can reproduce it with webkit2gtk3 2.22.3 too.
Note You need to log in before you can comment on or make changes to this bug.