Closed Bug 555176 Opened 15 years ago Closed 13 years ago

Provide the same formats we do on drag when copying images

Categories

(Firefox :: Menus, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 12

People

(Reporter: rfaber, Assigned: bbondy)

References

Details

Attachments

(1 file)

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)
Component: General → XUL
QA Contact: general → xptoolkit.widgets
Component: XUL → Widget: Win32
QA Contact: xptoolkit.widgets → win32
We provide all of these on drag operations, but not on the clipboard.
Severity: minor → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Not enough formats when copying images to Windows clipboard → Investigate providing the same formats we do on drag when copying images
Assignee: nobody → netzen
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.
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.
Review ping
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.
Status: NEW → ASSIGNED
Attachment #555006 - Flags: review?(vladimir) → review?(jmathies)
Attachment #555006 - Flags: review?(jmathies) → review+
Target Milestone: --- → mozilla12
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: Widget: Win32 → Menus
Product: Core → Firefox
QA Contact: win32 → menus
Summary: Investigate providing the same formats we do on drag when copying images → Provide the same formats we do on drag when copying images
Target Milestone: mozilla12 → ---
OS: Windows Vista → All
Target Milestone: --- → Firefox 12
Depends on: 749527
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.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: