Support PNG when pasting images into Firefox
Categories
(Core :: Widget: Win32, defect, P2)
Tracking
()
People
(Reporter: rkraesig, Assigned: gstoll)
References
(Blocks 1 open bug, )
Details
Attachments
(1 file)
At present, when a pasted/dropped image is PNG and the paste/drop target within Firefox wants PNG, we unconditionally convert the pasted image(s) from PNG into BMP and back. Not only is this wasteful, it strips transparency information.
We should avoid doing this whenever possible.
| Reporter | ||
Updated•1 year ago
|
| Comment hidden (off-topic) |
As my issue is related to a single program (Paint.NET), preferring PNG to DIB will perfectly solve my concerns.
| Comment hidden (off-topic) |
| Comment hidden (off-topic) |
| Reporter | ||
Comment 5•1 year ago
|
||
This bug is not about DIB or DIBv5. If you have any comments appertaining thereto, they belong on bug 1866655 or on the now-meta-bug 460969, not here.
| Comment hidden (off-topic) |
Updated•9 months ago
|
| Assignee | ||
Comment 7•9 months ago
|
||
On Windows, for the image/png MIME type we should read the "PNG" format
from the clipboard. Note that this is not officially defined by Microsoft
but seems to be commonly in use. (by at least us and Paint.NET)
The new test passes on Windows (after this change), and also Mac and
Linux.
| Assignee | ||
Comment 10•9 months ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Long-standing S2 bug (it was only filed a few months ago but I doubt Firefox ever supported this) that caused images pasted into Firefox to lose their transparency
[Affects Firefox for Android]: no
[Suggested wording]: PNG images with transparency will keep their transparency when pasted into Firefox.
[Links (documentation, blog post, etc)]:
Comment 12•9 months ago
|
||
Backed out as requested by gstoll for causing Bug 1958434.
Comment 13•9 months ago
|
||
Backout merged to central: https://hg.mozilla.org/mozilla-central/rev/a494c411ee44
Comment 14•9 months ago
|
||
+ } else if (flavorStr.EqualsLiteral(kPNGImageMime)) {
+ // Fall back to DIBV5 format
+ dataFound = NS_SUCCEEDED(GetNativeDataOffClipboard(
+ aDataObject, anIndex, CF_DIBV5, flavorStr.get(), &data, &dataLen));
I do not know your code really well, but this code wouldn’t pass my review. Found PNG and dig for DIB?
| Assignee | ||
Comment 15•9 months ago
|
||
(In reply to mercury13 from comment #14)
+ } else if (flavorStr.EqualsLiteral(kPNGImageMime)) { + // Fall back to DIBV5 format + dataFound = NS_SUCCEEDED(GetNativeDataOffClipboard( + aDataObject, anIndex, CF_DIBV5, flavorStr.get(), &data, &dataLen));I do not know your code really well, but this code wouldn’t pass my review. Found PNG and dig for DIB?
This was essentially the old behavior before this fix. Although it's definitely possible this is what caused the regression, which I'll take a look at next week.
Comment 16•9 months ago
|
||
This was essentially the old behavior before this fix. Although it's definitely possible this is what caused the regression, which I'll take a look at next week.
No, that’s from https://hg.mozilla.org/mozilla-central/rev/77a9e19339e4 pushed on Apr 2 and quickly reverted.
| Assignee | ||
Comment 17•9 months ago
|
||
My point is that this is basically equivalent to this line which set the format to CF_DIBV5 if the flavorStr was kPNGImageMime, which was the behavior before this change.
Comment 18•9 months ago
|
||
Another strange line. Format JPEG → set DIB, probably “JPEG is not supported”.
Format JPEG or PNG → set DIB, what?
Comment 19•9 months ago
|
||
SORRY, that’s actually OK, used to be JPEG and PNG not supported, and now some special bhv for PNG.
| Assignee | ||
Comment 20•9 months ago
|
||
Unfortunately after reapplying my change locally I'm having trouble reproducing bug 1958434
Comment 21•9 months ago
|
||
Comment 22•9 months ago
|
||
| bugherder | ||
| Assignee | ||
Comment 23•9 months ago
|
||
In case this becomes a problem in the future, https://bug460969.bmoattachments.org/attachment.cgi?id=9053448 is a good testcase for this.
Updated•8 months ago
|
Description
•