[Webkit-unassigned] [Bug 218519] Can't paste image data (like image/png) from the clipboard in WebKit browsers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 12 04:48:05 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=218519

--- Comment #22 from Miikka <miikka.veijonen at gmail.com> ---
(In reply to 荒野無燈 from comment #18)
> Created attachment 433288 [details]
> fix: fallback to readBufferFromClipboard if readFilePathsFromClipboard get
> no files, this fix makes ctrl + v paste image under GTK  works
> 
> in Source/WebCore/dom/DataTransfer.cpp 
> DataTransfer::filesFromPasteboardAndItemList
> 
> ```cpp
>  WebCorePasteboardFileReader reader(context);
>  m_pasteboard->read(reader);
>  files = WTFMove(reader.files);
> ```
> 
> it only calls `void Pasteboard::read(PasteboardFileReader& reader,
> std::optional<size_t>)`, 
> 
> and `Pasteboard::read(PasteboardWebContentReader& reader,
> WebContentReadingPolicy policy, std::optional<size_t>)` got no chances, so
> the image data dit not got read.
> 
> this patch is a workaround to fixup the problem (tested under webkitgtk
> 2.32.0 and 2.32.1).
> 
> by patching `void Pasteboard::read(PasteboardFileReader& reader,
> std::optional<size_t>)`,  and call
> `WebCorePasteboardFileReader::readBuffer`, we can make
> `DataTransferItem::getAsFile()` get the image file data.

Thanks. I applied the patch you linked (https://bugs.webkit.org/attachment.cgi?id=433288&action=diff) against webkitgtk 2.32.2 and the compiled it and then compiled Epiphany 40.2 against that webkitgtk build but pasting image data from the clipboard still does not work for me.

Is this https://bugs.webkit.org/attachment.cgi?id=433288&action=diff enough or should I apply something else too? Waht do you mean with this: "by patching `void Pasteboard::read(PasteboardFileReader& reader, std::optional<size_t>)`,  and call `WebCorePasteboardFileReader::readBuffer`, we can make `DataTransferItem::getAsFile()` get the image file data."?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210712/0106e2fc/attachment-0001.htm>


More information about the webkit-unassigned mailing list