Bug 205758 - Add support for DragEvent
Summary: Add support for DragEvent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://html.spec.whatwg.org/multipag...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-03 16:15 PST by Chris Dumez
Modified: 2020-01-06 11:31 PST (History)
20 users (show)

See Also:


Attachments
WIP Patch (25.96 KB, patch)
2020-01-03 16:21 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (28.39 KB, patch)
2020-01-03 16:28 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (30.31 KB, patch)
2020-01-03 16:49 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (30.95 KB, patch)
2020-01-03 17:04 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (34.33 KB, patch)
2020-01-03 17:42 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (53.06 KB, patch)
2020-01-03 18:11 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (56.21 KB, patch)
2020-01-03 19:15 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (56.27 KB, patch)
2020-01-03 20:31 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-01-03 16:15:40 PST
Add support for DragEvent:
- https://html.spec.whatwg.org/multipage/dnd.html#the-dragevent-interface

Both Blink and Gecko support it. In WebKit, no DragEvent and we added the dataTransfer attribute to MouseEvent instead.
Comment 1 Chris Dumez 2020-01-03 16:21:15 PST
Created attachment 386726 [details]
WIP Patch
Comment 2 Chris Dumez 2020-01-03 16:28:20 PST
Created attachment 386728 [details]
WIP Patch
Comment 3 Chris Dumez 2020-01-03 16:49:53 PST
Created attachment 386731 [details]
WIP Patch
Comment 4 Chris Dumez 2020-01-03 17:04:11 PST
Created attachment 386733 [details]
WIP Patch
Comment 5 Chris Dumez 2020-01-03 17:42:09 PST
Created attachment 386736 [details]
WIP Patch
Comment 6 Chris Dumez 2020-01-03 18:11:49 PST
Created attachment 386739 [details]
Patch
Comment 7 Chris Dumez 2020-01-03 19:15:30 PST
Created attachment 386745 [details]
Patch
Comment 8 Darin Adler 2020-01-03 19:29:22 PST
Comment on attachment 386745 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=386745&action=review

> Source/WebCore/dom/DragEvent.h:47
> +    static Ref<DragEvent> create(const AtomString& eventType, DragEventInit&& init)
> +    {
> +        return adoptRef(*new DragEvent(eventType, WTFMove(init)));
> +    }

There's no good reason for this function body to be in the header; inlining this at the call site isn’t really valuable since it’s going to call a constructor, which is not inlined. Instead we can let the constructor get inlined in the create function. And so the create function can be in the .cpp file. Nice to have a little less code in the header, I think.

> Source/WebCore/dom/DragEvent.h:52
> +    static Ref<DragEvent> createForBindings()
> +    {
> +        return adoptRef(*new DragEvent);
> +    }

Ditto.

> Source/WebCore/dom/DragEvent.idl:33
> +    DataTransfer? dataTransfer = null;

Is the "= null" really required?

> Source/WebCore/page/EventHandler.cpp:2255
> +    // FIXME: Use DragEvent::create which takes PlatformMouseEvent.

Is this FIXME valuable? Does the suggestec change need to be made? Would it improve things?

> LayoutTests/fast/events/constructors/mouse-event-constructor.html:30
> +shouldBe("new MouseEvent('eventType').dataTransfer", "undefined");

More than just "should be undefined". The property shouldn’t even be present! Might be better to check that. Something ike this:

    shouldBeFalse("dataTransfer in (new MouseEvent('eventType'))")
Comment 9 Chris Dumez 2020-01-03 20:31:54 PST
Created attachment 386749 [details]
Patch
Comment 10 WebKit Commit Bot 2020-01-03 23:05:33 PST
Comment on attachment 386749 [details]
Patch

Clearing flags on attachment: 386749

Committed r254029: <https://trac.webkit.org/changeset/254029>
Comment 11 WebKit Commit Bot 2020-01-03 23:05:35 PST
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2020-01-03 23:06:20 PST
<rdar://problem/58314184>
Comment 13 Simon Fraser (smfr) 2020-01-04 10:15:36 PST
Build fix in bug 205765.