Open
Bug 819373
Opened 12 years ago
Updated 2 years ago
Handle drag and drop of a download link
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect, P5)
Core
DOM: Copy & Paste and Drag & Drop
Tracking
()
NEW
People
(Reporter: evilpie, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: dev-doc-needed)
Attachments
(1 file)
7.87 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
When you drag a link we the download attribute onto the desktop, we want to download this instead of just creating a link to the file. Bug 570164 is quite similar.
Reporter | ||
Updated•12 years ago
|
Reporter | ||
Comment 1•12 years ago
|
||
I think this might actually be pretty easy. We already support something called x-moz-file-promise. And we even have documentation for it :) https://developer.mozilla.org/en-US/docs/DragDrop/Recommended_Drag_Types#Dragging_files_to_an_operating_system_folder
Reporter | ||
Comment 2•11 years ago
|
||
You can drag and drop files in Firefox on Linux, which makes this kind of painful to test and implement for me. But this should be relatively easy.
Reporter | ||
Comment 3•11 years ago
|
||
*You can't
Comment 4•11 years ago
|
||
Well, at least image dnd from file system works on linux.
Comment 5•11 years ago
|
||
Only text and urls are supported for dropping on gtk currently.
Reporter | ||
Comment 6•11 years ago
|
||
Now that I got drag and drop working on linux, I could actually implement this. I still have to iron out some of the details, but this works.
Comment 7•11 years ago
|
||
Comment on attachment 813271 [details] [diff] [review] WIP patch >+ static void GetDownloadLink(nsIContent *aContent, nsIURI *aLinkURI, Clearly bogus return value. And needs to document aLinkURI, no? And maybe call it IsDownloadLink? >+++ b/content/base/src/nsContentAreaDragDrop.cpp Someone familiar with this code should review it, please. >+++ b/content/base/src/nsContentUtils.cpp >+ // Check if there is an download attribute. s/an/a/ >+ if (!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::download, aFileName)) Curlies around if body, please. >+++ b/widget/gtk/nsDragService.cpp Changes here are ok, but not obviously related...
Attachment #813271 -
Flags: review?(neil)
Attachment #813271 -
Flags: review?(bzbarsky)
Attachment #813271 -
Flags: review+
Reporter | ||
Updated•11 years ago
|
Keywords: dev-doc-needed
Reporter | ||
Comment 8•11 years ago
|
||
Arguably having to pass the aLinkURI is a pretty bad API, but I am not sure how abstract that between the two cases. Maybe we should always use href?
Comment 9•11 years ago
|
||
Comment on attachment 813271 [details] [diff] [review] WIP patch >+ if (!nsContentUtils::GetDownloadLink(aDragNode, hrefURI, fileName)) { >+ if (!mImage) >+ return NS_OK; This is very ugly, and possibly prone to error if someone needs to tweak the logic. I tried to think of several approaches, but you probably don't want to accidentally download an image linked to a download that doesn't specify a file name, in which case I ended up with this approach: if (mIsAnchor && nsContentUtils::GetDownloadLink(...)) { // this is a download, so promise to download it } else if (mImage) { // promise the image } if (!fileName.IsEmpty()) { // we found something to download } Note that you don't now need the outer if (mImage || mIsAnchor) test. >+ if (fileName.IsEmpty()) { >+ nsAutoCString fileNameC; >+ imgUrl->GetFileName(fileNameC); Which URL is this? I don't see a relevant one handy. You might want the file from mUrlString, but I suppose you'd have to use string manipulation to extract it. >diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp [Unnecessary change?]
Reporter | ||
Updated•10 years ago
|
Assignee: evilpies → nobody
Comment 10•10 years ago
|
||
Could we not just duplicate what was used in Chromium to finish this?
Comment 11•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 13•6 years ago
|
||
No assignee, updating the status.
Comment 14•6 years ago
|
||
No assignee, updating the status.
Updated•3 years ago
|
Component: DOM: Core & HTML → DOM: Drag & Drop
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•