Bug 25690

Summary: Drop event is never fired when dragover's target element is removed even if the event was canceled by its ancestor
Product: WebKit Reporter: noel gordon <noel.gordon>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: arv, dcheng, dglazkov, rniwa, sam, tony, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 525.x (Safari 3.1)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Drag Drop Test Case
none
Drop on the moving numbers, no drop event results
none
Reduction none

Description noel gordon 2009-05-11 06:41:40 PDT
Create a <div> with text inside it, attach drag drop listeners.  Dynamically update the <div> text (using .innerHTML, for example) while dragging Text or URLs over the <div>.

1) Release the mouse button while dragging over the dynamic text; a drop event should be generated.

2) Press the escape key (to cancel the drag) while dragging over the dynamic text; a dragleave event should be generated.

Safari 4 Beta (5528.16), FAILS
 1) mouse button release: no drop event is generated.  
 2) escape key: no dragleave event is generated.

Safari 3.1.2 (5525.2.0.1), FAILS
 1) mouse button release: no drop event is generated.  
 2) escape key: no dragleave event is generated.

IE7 (7.0.60001.18000) Vista SP1, OK
 1) mouse button release: drop event generated.  
 2) escape key: dragleave event generated.

IE6 (6.0.2900.5512.xpsp_sp3) XP SP3, OK
 1) mouse button release: drop event generated.  
 2) escape key: dragleave event generated.
Comment 1 noel gordon 2009-05-11 06:47:59 PDT
Created attachment 30187 [details]
Drag Drop Test Case
Comment 2 noel gordon 2009-05-11 06:50:33 PDT
Comment on attachment 30187 [details]
Drag Drop Test Case

Try dropping on events count numbers.
Comment 3 Mark Rowe (bdash) 2009-05-11 19:06:07 PDT
*** Bug 25691 has been marked as a duplicate of this bug. ***
Comment 4 Julie Parent 2009-07-01 10:22:20 PDT
Adding arv, who is working on another drag/drop fix that seems to fix this too.
Comment 5 Ryosuke Niwa 2013-02-03 13:55:09 PST
It seems like this bug has been fixed?
Comment 6 noel gordon 2013-02-03 21:05:23 PST
Nope.  Load test case in Tools/Scripts/run-safari --release  and drop on the moving numbers, screenshot attached.
Comment 7 noel gordon 2013-02-03 21:07:07 PST
Created attachment 186295 [details]
Drop on the moving numbers, no drop event results
Comment 8 Ryosuke Niwa 2013-02-03 21:45:41 PST
(In reply to comment #7)
> Created an attachment (id=186295) [details]
> Drop on the moving numbers, no drop event results

How do we know it's failing?
Comment 9 noel gordon 2013-02-03 21:47:45 PST
No drop event.
Comment 10 Ryosuke Niwa 2013-02-03 21:51:01 PST
(In reply to comment #9)
> No drop event.

drag_drop_count says 7.
Comment 11 noel gordon 2013-02-03 21:56:27 PST
That was from tests where I dropped the data _not_ on from the moving text.
Comment 12 Ryosuke Niwa 2013-02-03 21:58:47 PST
(In reply to comment #11)
> That was from tests where I dropped the data _not_ on from the moving text.

I'm not sure what the bug is then. Could you please create a better reduction where it can clearly show PASS or FAIL? All the description on this bug so far has been extremely vague.
Comment 13 noel gordon 2013-02-03 22:06:00 PST
Drop text in the blue box: a drop event is generated, except if you drop on the updating text, like the numbers shown for drag_event_count for example.

Expected: a drop event should be generated no matter where you drop in the blue box.
Comment 14 Ryosuke Niwa 2013-02-03 22:27:52 PST
Created attachment 186308 [details]
Reduction

Thanks for the clarification.
Comment 15 Radar WebKit Bug Importer 2013-02-03 22:31:23 PST
<rdar://problem/13142049>
Comment 16 noel gordon 2013-02-03 22:58:32 PST
(In reply to comment #14)
> 
> Thanks for the clarification.

Thanks for the reduction.  Minor nit.

  <div ondragover="event.dataTransfer.dropEvent='copy';return false"
          ondrop="alert('PASS');" ondragenter="this.innerHTML+='|';">

ondragenter should also return false.
Comment 17 Ryosuke Niwa 2013-02-03 23:36:54 PST
(In reply to comment #16)
> (In reply to comment #14)
> > 
> > Thanks for the clarification.
> 
> Thanks for the reduction.  Minor nit.
> 
>   <div ondragover="event.dataTransfer.dropEvent='copy';return false"
>           ondrop="alert('PASS');" ondragenter="this.innerHTML+='|';">
> 
> ondragenter should also return false.

Not in WebKit.
Comment 18 noel gordon 2013-02-04 03:59:40 PST
(In reply to comment #17)

> > ondragenter should also return false.
> 
> Not in WebKit.

Really?  It's required by HTML5.  The standard _does not_ say that a dragenter event must be followed by a dragover event, but it does say that their default actions must be cancelled to permit a subsequent drop event.

So the event sequence dragenter -> {dragleave|drop} is permitted per spec, but the drop should be generated only if the default action of dragenter event was cancelled.
Comment 19 Daniel Cheng 2013-02-04 11:09:34 PST
(In reply to comment #18)
> (In reply to comment #17)
> 
> > > ondragenter should also return false.
> > 
> > Not in WebKit.
> 
> Really?  It's required by HTML5.  The standard _does not_ say that a dragenter event must be followed by a dragover event, but it does say that their default actions must be cancelled to permit a subsequent drop event.
> 
> So the event sequence dragenter -> {dragleave|drop} is permitted per spec, but the drop should be generated only if the default action of dragenter event was cancelled.

I've spent a considerable amount of time trying to get the D&D event handling to follow the HTML spec (especially wrt cancelling the dragenter/dragover events), and it's rather tricky (often times, it only fails for one specific type of element).

I'll try to take a look at this in the next few weeks, but I have quite a lot of other things on my plate atm.