User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 4.0.20506) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 4.0.20506) If I try to copy an image from a webpage and paste it into Gmail it does not work. If I copy the image in IE or Chrome, paste works - I can even paste the copied image into an instance of Gmail opened in Firefox. A little investigation shows that Firefox adds the following formats to the clipboard when copying an image: * application/x-moz-nativeimage * DeviceIndependentBitmap IE7 adds the following formats: * UntrustedDragDrop * FileDrop * UniformResourceLocatorW * DeviceIndependentBitmap * HTML Format and Chrome adds the following formats: * HTML Format * UniformResourceLocatorW * Bitmap * DeviceIndependentBitmap * Format17 A little test shows that the element needed to get Gmail paste working is the "HTML Format". Chrome adds the following under the "HTML Format" when copying an image: Version:0.9 StartHTML:0000000105 EndHTML:0000000336 StartFragment:0000000143 EndFragment:0000000298 <html> <body> <!--StartFragment--> <img src="http://icanhascheezburger.files.wordpress.com/2010/03/funny-pictures-c at-pretends-to-be-a-book1.jpg" alt="funny pictures of cats with captions"/> <!--EndFragment--> </body> </html> Reproducible: Always Steps to Reproduce: 1. Copy image in firefox 2. Use gmail to write a mail and try to paste the image into the mail (nothing happens) 3. Copy image in IE or Chrome 4. Try to paste the image into the mail (now it works)
We provide all of these on drag operations, but not on the clipboard.
Slight modification to the steps to reproduce. 1. Copy the image in Firefox by right clicking and selecting "Copy Image" 2. Use gmail to write a mail and try to paste the image into the compose box. Reproducible: Always Actual Results: Nothing happens Expected Results: Image shows up. If you select the image by highlighting and copying it does supply the needed CF_HTML format. If you right click and select Copy Image it does not.
Created attachment 555006 [details] [diff] [review] Patch for "copy image" menu item not providing CF_HTML format
By the way I can clean-up the naming of the ID etc, I just wanted to make sure that this strategy is good for the fix first.
Note this task will also fix Bug 460969
The patch doesn't seem to be complete... all it does is change the name of a command, without implementing it anywhere that I can see?
> The patch doesn't seem to be complete... The patch is that one small change only on purpose. You can find the existing command here: mozilla-central\dom\base\nsGlobalWindowCommands.cpp Inside the function: nsClipboardImageCommands::DoClipboardCommand In particular this command will copy both the image HTML Format and image data. The old one would copy only the image data. The problem with only the image data is that it won't paste properly in various other programs that support only HTML Format.
review feedback ping as per Comment 8.
Pushed to mozilla-inbound: http://hg.mozilla.org/integration/mozilla-inbound/rev/52d9d7bbfad1
This fix is causing some Windows programs that normally paste bitmap data to instead paste a URL. SuMo threads: Copy and Paste of Images NOT working. https://support.mozilla.org/en-US/questions/926093 Firefox 12 won't allow Corel PhotoPaint X5 to paste 'New From Clipboard' https://support.mozilla.org/en-US/questions/926113 The fix adds Text, Unicode Text, and HTML formats to the Bitmap format. Can the fix be fine-tuned to ONLY add the HTML format?
Yes, please see the fix already posted in bug 749527 which does that.