Bug 214578 - user selection via paste/drop loses characters translating to RTF/RTFD & attributed string output across iframe
Summary: user selection via paste/drop loses characters translating to RTF/RTFD & attr...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari Technology Preview
Hardware: iPhone / iPad iOS 13
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-20 16:20 PDT by Dan Hite
Modified: 2020-07-20 19:37 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Hite 2020-07-20 16:20:53 PDT
Hello hard working webkit devs!

webkit serializes user selected html to many UTI forms upon a copy or drop and this simple test case shows two kinds of character loss...

data:text/html,<pre>RTF%20U%20<iframe%20srcdoc="pity%20the%20<b>fool"></iframe>%0AMIA%20space%20and%20last%20letter

is a complete miniature webpage to replicate the bug, as I have, on both ipadOS 13.6 safari 13 and on 14beta2 (iirc 14 ~preview 109)

in case ^ that url is hard for you to read, here's the two lines of .html source ...

<pre>RTF U <iframe srcdoc="pity the <b>fool"></iframe>
MIA space and last letter

simply select all the page (ie from RTF through letter) and either "copy" or
drag it to files app or a shelf app like gladys, for convenience of examining the UTI thunks that webkit output

the files app makes an .rtfd that is buggy (webkit's fault), as you can easily see by using quicklook
and within the copy pasteboard (eg looking via gladys) both the rtfd , rtf, and attributed string forms all have the bug, ie ...

RTF Upity the foo
MIA space and last letter

instead of ...

RTF U pity the fool
MIA space and last letter

so both the space character outside preceding the iframe, and the last character within the iframe, got omitted from the serialization

naturally the webpage itself is displaying properly; also just selecting within the iframe seems fine, it's crossing it that messes up

it's a very cool feature that you empower user's to drag/copy across iframe content, so I listed this as "normal" severity since user's are losing data in a non-obvious way--for example, if the last characters in the iframe were $100 now the saved data concludes with $10, and they might not notice the bug, oops, or perhaps I've attempted to say: "I want to bathe in your pool" and somehow the result doesn't quite feel the same ;)

note that the safari serialization to html, com.apple.webarchive, or, if chosen via share menu, pdf output, all work properly

apparently this is a common edge case where the serializer code chokes up splicing in the contents of an iframe within a user selection

regards,
Dan
Comment 1 Alexey Proskuryakov 2020-07-20 19:36:48 PDT
Thank you for the report. May be a WebKit issue indeed, although RTF generation relies on a system framework. Either way, we need to take the first look.
Comment 2 Radar WebKit Bug Importer 2020-07-20 19:37:00 PDT
<rdar://problem/65861613>