Closed
Bug 45824
Opened 25 years ago
Closed 22 years ago
Initiating drag of image that is not also a link to desktop is very hard
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)
Tracking
()
RESOLVED
FIXED
People
(Reporter: lordpixel, Assigned: sfraser_bugs)
References
Details
Attachments
(1 file, 1 obsolete file)
7.18 KB,
patch
|
Brade
:
review+
|
Details | Diff | Splinter Review |
Steps to reproduce: 1. goto http://www.palm.com 2. Try to drag the round palm logo image to the desktop. Try several more times :-) On MacOS with the Jul 17/18 nightly its very hard to initiate that drag. It maybe works 1 time in 5. (cc: pinkerton for Drag and Drop)
Comment 1•25 years ago
|
||
again, this is another dupe of a bug that someone has, but not sure who
Reporter | ||
Comment 2•25 years ago
|
||
Mike - did you mean this bug? http://bugzilla.mozilla.org/show_bug.cgi?id=42046 It looks similar but 42046 is specific to composer.
Comment 4•25 years ago
|
||
qa -> eli. again, is this a dupe of another bug you already filed?
QA Contact: jrgm → elig
Comment 5•25 years ago
|
||
I thought that I wrote a bug about this, but I can't find it. Confirming.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 6•25 years ago
|
||
i don't know if we even support that yet. brade?
Assignee: pinkerton → brade
Comment 7•25 years ago
|
||
bouncing this bug back to pinkerton since it has to do with initiation of a drag. I'm not sure we'll be able to fix this for 6.0. To be able to drag images more reliably, I find that I have to click and hold for a moment before I move the mouse for the drag. :-( Pink--any way you can make this work any better?
Assignee: brade → pinkerton
Updated•25 years ago
|
Assignee: pinkerton → mcafee
Component: XP Toolkit/Widgets → XP Apps
Comment 8•25 years ago
|
||
since everything else works fine, this has to be in the JS, which is out of my department. --> mcafee since he's virtual gramps for triage.
Comment 9•25 years ago
|
||
Kevin--any chance you could help us out with this bug? I'll be going on a 6 week leave soon and may not be able to get to this before I go. I think this could be fixed by checking explicitly if we're in an image (after we check if it's a link). Thanks!
Summary: Initiating the drag of an image that is not also a link to the desktop is very hard → Initiating drag of image that is not also a link to desktop is very hard
Reporter | ||
Comment 10•24 years ago
|
||
OK, here's the relevant function from navigatorDD.js: var contentAreaDNDObserver = { 265 onDragStart: function (aEvent) 266 { 267 var htmlstring = null; 268 var textstring = null; 269 var isLink = false; 270 var domselection = window._content.getSelection(); 271 if (domselection && !domselection.isCollapsed && 272 domselection.containsNode(aEvent.target,false)) 273 { 274 // the window has a selection so we should grab that rather than looking for specific elements 275 htmlstring = domselection.toString("text/html", 128+256, 0); 276 textstring = domselection.toString("text/plain", 0, 0); 277 } 278 else 279 { 280 switch (aEvent.target.localName) 281 { 282 case 'AREA': 283 case 'IMG': 284 var imgsrc = aEvent.target.getAttribute("src"); 285 var baseurl = window._content.location.href; 286 // need to do some stuff with the window._content.location (path?) 287 // to get base URL for image. 288 289 textstring = imgsrc; 290 htmlstring = "<img src=\"" + textstring + "\">"; 291 if ((linkNode = this.findEnclosingLink(aEvent.target))) { 292 htmlstring = '<a href="' + linkNode.href + '">' + htmlstring + '</a>'; 293 textstring = linkNode.href; 294 } 295 break; 296 case 'A': 297 isLink = true; 298 if (aEvent.target.href) 299 { 300 textstring = aEvent.target.getAttribute("href"); 301 htmlstring = "<a href=\"" + textstring + "\">" + textstring + "</a>"; 302 } 303 else if (aEvent.target.name) 304 { 305 textstring = aEvent.target.getAttribute("name"); 306 htmlstring = "<a name=\"" + textstring + "\">" + textstring + "</a>" 307 } 308 break; 309 default: 310 case '#text': 311 case 'LI': 312 case 'OL': 313 case 'DD': 314 var node = enclosingLink(aEvent.target); 315 textstring = ""; 316 //select node now! 317 if (node) 318 textstring = node.href; 319 if (textstring != "") 320 { 321 htmlstring = "<a href=\"" + textstring + "\">" + textstring + "</a>"; 322 var parent = node.parentNode; 323 if (parent) 324 { 325 var nodelist = parent.childNodes; 326 var index; 327 for (index = 0; index<nodelist.length; index++) 328 { 329 if (nodelist.item(index) == node) 330 break; 331 } 332 if (index >= nodelist.length) 333 throw Components.results.NS_ERROR_FAILURE; 334 if (domselection) 335 { 336 domselection.collapse(parent,index); 337 domselection.extend(parent,index+1); 338 } 339 } 340 } 341 else 342 throw Components.results.NS_ERROR_FAILURE; 343 break; 344 } 345 } 346 347 var flavourList = { }; 348 flavourList["text/html"] = { width: 2, data: htmlstring }; 349 if (isLink) 350 flavourList["text/x-moz-url"] = { width: 2, data: textstring + " " + "( TEMP TITLE )" }; 351 flavourList["text/unicode"] = { width: 2, data: textstring }; 352 return flavourList; 353 }, How this actually behaves in practise is utterly wacko to me, but maybe someone can explain it: If you drag an image that isn't a link: You execute lines 275 and 276. i.e. its treat as a selection not as part of the img case If you drag a plain link: You'll execute lines 314 thru 343, i.e. its treat as the 'default:' case *not* as the <a> the link case. If you drag an image that is a link: You'll execute lines 284 thrue 293, including the 'if' i.e. its recognised as an img and then as a link. If your drag some ordinary text, you'll execute lines 275 and 276 (i.e. you have a selection). Of these 4 cases only the last 2 seem right. The first two seem a little wacko to me. I think part of the reason its difficult to drag unlinked images is that it must be needing you to create a selection first - its not ever managing to use the img case. As to why links get handled by the default case and not the <a> case I really don't know. I guess because its actually near impossible for the rag to start on an <a> as these are invisible? Perhaps the drag in fact always starts on some content of the <a> thus the default case is invoked?
Comment 12•24 years ago
|
||
nav triage team: Although nice to have, don't think we have enough time to fix for beta1, marking nsbeta1-
Keywords: nsbeta1-
OS: All
Comment 13•24 years ago
|
||
Marking nsbeta1- bugs as future to get off the radar
Target Milestone: --- → Future
Comment 15•23 years ago
|
||
-> default assignee
Assignee: pchen → trudelle
QA Contact: tpreston → sairuh
Target Milestone: Future → ---
Updated•23 years ago
|
Target Milestone: --- → Future
Comment 16•22 years ago
|
||
I've been hating this bug since the pre-1.0 release - and in every version I've used (3 so far) on any Mac I've used, I still can't download an image to the desktop by dragging, no matter how many times I try.
Comment 17•22 years ago
|
||
->d'n'd
Assignee: trudelle → blaker
Component: XP Apps → XP Apps: Drag and Drop
QA Contact: sairuh → pmac
Assignee | ||
Comment 18•22 years ago
|
||
This patch makes it easiser to drag images, and also appends image source URL data to the drag for platforms that want it to allow drgging files to the file system. The main fix for image draggability was to deal with the case in which the image is selected (which is easy to do by clicking it); I look at the selection endpoints to determine if just an image is in the selection, and, in that case, fall through to the code that handles a drag of the unselected image.
Comment 20•22 years ago
|
||
Comment on attachment 110631 [details] [diff] [review] nsContentAreaDragDrop fixes I don't understand this: + trans->SetTransferData(kFilePromiseURLMime, imageUrlPrimitive, imageURL.Length() * sizeof(PRUnichar)); + }http://www.mozilla.org/ Is the mozilla url a bad paste? The rest looks fine to me; should pink or jfrancis also review?
Assignee | ||
Comment 21•22 years ago
|
||
Whoops; it was a bad drag and drop ;) Seems that if you stop in gdb while debugging D&D, when you continue, the drop goes into the wrong window.
Status: NEW → ASSIGNED
Assignee | ||
Updated•22 years ago
|
Target Milestone: Future → ---
Assignee | ||
Comment 22•22 years ago
|
||
This patch fixes an issue in the previous patch when selection focus is before selection anchor (the user selected backwards).
Attachment #110631 -
Attachment is obsolete: true
Comment 23•22 years ago
|
||
Comment on attachment 110810 [details] [diff] [review] nsContentAreaDragDrop.cpp patch r=brade
Attachment #110810 -
Flags: review+
Assignee | ||
Comment 24•22 years ago
|
||
This was checked in along with the fixes in bug 193053.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•