LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
22.36k stars 994 forks source link

LibWeb: Make replaceData create new surrogate pairs #2524

Closed milotier closed 1 day ago

milotier commented 2 days ago

When inserting a new utf-16 surrogate next to an existing surrogate with replaceData, the surrogates would not get merged correctly into a single code point. This is because internally the text data is stored as utf-8, and the two surrogates would be converted separately. This has now been fixed by first recreating the whole string in utf-16 and then converting it back to utf-8.

It's not the most efficient solution, but this fixes at least 6 WPT subtests.

I've tried to follow all the contribution guidelines, but this is my first pull request here, so tell me if I've done anything wrong/unidiomatic.

milotier commented 2 days ago

I've implemented your suggestions.

tcl3 commented 2 days ago

I've implemented your suggestions.

Nice! Feel free to "Resolve conversation" when you've dealt with feedback.