Bug 212339

Summary: [Clipboard API] Support reading "image/png" on ClipboardItem
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
For EWS
none
For EWS
none
For EWS
thorton: review+
Patch for landing none

Description Wenson Hsieh 2020-05-24 23:02:52 PDT
Support reading "image/png" on ClipboardItem
Comment 1 Radar WebKit Bug Importer 2020-05-24 23:03:18 PDT
<rdar://problem/63588957>
Comment 2 Wenson Hsieh 2020-05-25 12:26:27 PDT Comment hidden (obsolete)
Comment 3 Wenson Hsieh 2020-05-25 12:26:47 PDT Comment hidden (obsolete)
Comment 4 Wenson Hsieh 2020-05-25 12:40:54 PDT
Created attachment 400216 [details]
For EWS
Comment 5 Tim Horton 2020-05-27 11:38:52 PDT
Comment on attachment 400216 [details]
For EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=400216&action=review

> Source/WebCore/Modules/async-clipboard/mac/ClipboardImageReaderMac.mm:41
> +        if (auto bitmapData = retainPtr([image TIFFRepresentation])) {
> +            auto bitmapRepresentation = adoptNS([[NSBitmapImageRep alloc] initWithData:bitmapData.get()]);
> +            m_result = Blob::create(SharedBuffer::create([bitmapRepresentation representationUsingType:NSBitmapImageFileTypePNG properties:@{ }]), m_mimeType);

I provided a potential alternative to this double-encode offline.
Comment 6 Wenson Hsieh 2020-05-27 11:40:12 PDT
Comment on attachment 400216 [details]
For EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=400216&action=review

>> Source/WebCore/Modules/async-clipboard/mac/ClipboardImageReaderMac.mm:41
>> +            m_result = Blob::create(SharedBuffer::create([bitmapRepresentation representationUsingType:NSBitmapImageFileTypePNG properties:@{ }]), m_mimeType);
> 
> I provided a potential alternative to this double-encode offline.

👍🏻 Giving it a try, thanks!
Comment 7 Wenson Hsieh 2020-05-27 12:19:13 PDT
Created attachment 400365 [details]
Patch for landing
Comment 8 EWS 2020-05-27 12:50:46 PDT
Committed r262209: <https://trac.webkit.org/changeset/262209>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400365 [details].