Last Comment Bug 229327 - Drag and Drop of graphic places URL in composer (rather than a <img src....)
: Drag and Drop of graphic places URL in composer (rather than a <img src....)
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget: Gtk (show other bugs)
: Trunk
: x86 Linux
: -- normal with 1 vote (vote)
: mozilla1.9beta5
Assigned To: Michael Ventnor
:
Mentors:
: 419444 (view as bug list)
Depends on: 428876
Blocks:
  Show dependency treegraph
 
Reported: 2003-12-24 06:22 PST by Craig Miller
Modified: 2008-04-13 20:55 PDT (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (4.48 KB, patch)
2008-03-03 03:00 PST, Michael Ventnor
no flags Details | Diff | Splinter Review
Patch 2 (5.09 KB, patch)
2008-03-04 00:45 PST, Michael Ventnor
roc: review+
roc: superreview+
mbeltzner: approval1.9+
Details | Diff | Splinter Review

Description Craig Miller 2003-12-24 06:22:27 PST
User-Agent:       Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.5) Gecko/20030929
Build Identifier: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.5) Gecko/20030929

Drag and Drop of a image (JPG or PNG) places
"file:///home/cvmiller/Screenshot.png" rather than the image in the
Composer.This is using Mandrake 9.1 PPC (Gnome & Nautilus).

This has been broken in every version of Mozilla that I have tried (which goes
back a long way). I am unaware that this feature has ever worked.



Reproducible: Always

Steps to Reproduce:
1.Open New Composer Window
2.Open a Nautilus Window
3.Drag and drop a graphic file (JPG, PNG, GIF) from the Nautilus Window to the
Composer Window

Actual Results:  
the string "file:///home/cvmiller/Screenshot.png" is inserted into the Composer
Window

Expected Results:  
The image should be inserted into the Composer window (just like it does for
other platforms, such as Windows and Mac)
Comment 1 Kathleen Brade 2004-02-13 11:42:47 PST
This works on MacOSX mozilla so I'm guessing this is a linux issue.  I'm
guessing it works if you drag an image from a browser window into the Composer
window.  The bug is probably specific to dragging from the OS into Composer.

icky workaround:  cut the url from Composer, insert > image, paste url into
dialog, click radio button for no alt text (or add it), click insert.

alternative icky workaround: load image in browser, drag from browser into composer

If someone can confirm that the bug is indeed specific to OS dragging I
recommend that this bug be reassigned to XP Apps: Drag and Drop

cc glazman in case this bug affects his efforts
Comment 2 Andreas Kunz 2004-03-16 13:52:38 PST
Also works on WinXP.
Comment 3 Craig Miller 2004-03-17 05:02:52 PST
Clearification: This bug is only in LINUX. I am requesting that the behavior in
Linux be similar to that of Windows and MacOS.
Comment 4 Gervase Markham [:gerv] 2005-09-27 02:10:50 PDT
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
Comment 5 Craig Miller 2005-09-28 17:45:06 PDT
Thanks to all, but the bug remains in Mozilla 1.7.6 composer, it is specific to 
the Linux OS (both with Gnome, and KDE). It isn't hard to reproduce (follow 
instructions in original post). It is a problem with both x86 and PPC linux.

I have reproduced this problem with the latest version of seamonkey (1.0 alpha) 
under Linux (x86) and Gnome.

As a side note, I have performed the same test with Nvu (1.0) and it properly 
handles the images (displaying the image rather than the path to the image).

Comment 6 jigar shah 2007-02-13 04:54:18 PST
Its reproducible even on TB 1.5.0.9. Same problem is there with firefox 2.0.0.1 on Linux. I think its GTK+ problem. 
Comment 7 Michael Ventnor 2008-03-03 03:00:13 PST
Created attachment 307007 [details] [diff] [review]
Patch

This works, and does the exact same thing that Cocoa does to generate an nsILocalFile, albeit I've learned some very strange things about GTK's drag stuff in this case. Maybe its because I request plain text, but newlines (both \n and \r) are added at the end. It also gives off a file:// URL rather than a path so I had to fix that up too.

Still, a huge boost to editor consumers on Linux!
Comment 8 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2008-03-03 14:15:48 PST
+                        const char* castedText =

"castedText"? ew. "text" please.

+                                    reinterpret_cast<char*>(mTargetDragData);

static_cast

Use StripChar to get rid of the newlines.

+                            nsCOMPtr<nsISupports> genericDataWrapper;
+                            genericDataWrapper = do_QueryInterface(file);

Why do you need this? This doesn't really do anything.

The documentation for SetTransferData says

    * @param  aData the data, some variant of class in nsISupportsPrimitives.idl,
    *         or an nsIFlavorDataProvider (see above)

But it seems we actually and use nsIFile here, so please change the documentation to mention that.
Comment 9 Michael Ventnor 2008-03-03 17:17:51 PST
(In reply to comment #8)
> +                        const char* castedText =
> 
> "castedText"? ew. "text" please.
> 
> +                                    reinterpret_cast<char*>(mTargetDragData);
> 
> static_cast

You can blame Chris Blizzard's conventions for that ;-)

> +                            nsCOMPtr<nsISupports> genericDataWrapper;
> +                            genericDataWrapper = do_QueryInterface(file);
> 
> Why do you need this? This doesn't really do anything.
> 
> The documentation for SetTransferData says
> 
>     * @param  aData the data, some variant of class in
> nsISupportsPrimitives.idl,
>     *         or an nsIFlavorDataProvider (see above)
> 
> But it seems we actually and use nsIFile here, so please change the
> documentation to mention that.
> 

I don't really understand this comment. What exactly should I mention in the documentation?
Comment 10 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2008-03-03 18:21:24 PST
That aData can be an nsIFile.
Comment 11 Michael Ventnor 2008-03-04 00:45:16 PST
Created attachment 307179 [details] [diff] [review]
Patch 2

Address review.
Comment 12 Michael Ventnor 2008-03-04 01:58:10 PST
Comment on attachment 307179 [details] [diff] [review]
Patch 2

A very small patch to enable platform parity and provide a non-trivial functionality increase to users of editor.
Comment 13 Craig Miller 2008-03-04 06:48:51 PST
Hey this is _great_ news! Thanks to all who worked on this, finally bringing parity to Linux.

Will this patch be accepted upstream (so the masses will have this feature)?

Craig...
Comment 14 Mike Beltzner [:beltzner, not reading bugmail] 2008-03-05 08:30:37 PST
Comment on attachment 307179 [details] [diff] [review]
Patch 2

a1.9=beltzner
Comment 15 Reed Loden [:reed] (use needinfo?) 2008-03-08 01:57:12 PST
Checking in widget/src/gtk2/nsDragService.cpp;
/cvsroot/mozilla/widget/src/gtk2/nsDragService.cpp,v  <--  nsDragService.cpp
new revision: 1.22; previous revision: 1.21
done
Checking in widget/public/nsITransferable.idl;
/cvsroot/mozilla/widget/public/nsITransferable.idl,v  <--  nsITransferable.idl
new revision: 1.13; previous revision: 1.12
done
Comment 16 jigar shah 2008-03-09 19:47:28 PDT
*** Bug 419444 has been marked as a duplicate of this bug. ***
Comment 17 Justin Dolske [:Dolske] 2008-04-13 20:55:02 PDT
This patch broke the ability to drag'n'drop multiple files in to a mozilla window. My problem in bug 428876 goes away when I back out this patch locally.

Note You need to log in before you can comment on or make changes to this bug.