Bug 191182 - [GTK] Text offset calculation breaks with certain emojicons
Summary: [GTK] Text offset calculation breaks with certain emojicons
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2018-11-02 01:32 PDT by Milan Crha
Modified: 2018-11-02 01:34 PDT (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Milan Crha 2018-11-02 01:32:31 PDT
Moving this from a downstream bug report:

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.
Comment 1 Milan Crha 2018-11-02 01:34:32 PDT
I forgot to mention, I can reproduce it with webkit2gtk3 2.22.3 too.