Bug 206798 - Tighten up some of the drag state machine logic
Summary: Tighten up some of the drag state machine logic
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-25 07:52 PST by Darin Adler
Modified: 2020-01-26 03:50 PST (History)
3 users (show)

See Also:


Attachments
Patch (5.81 KB, patch)
2020-01-25 07:57 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (9.46 KB, patch)
2020-01-25 16:57 PST, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (9.46 KB, patch)
2020-01-25 17:04 PST, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2020-01-25 07:52:26 PST
Tighten up some of the drag state machine logic
Comment 1 Darin Adler 2020-01-25 07:57:08 PST
Created attachment 388774 [details]
Patch
Comment 2 Darin Adler 2020-01-25 07:58:44 PST
There’s a chance this fixes a drag-related crash we’ve been seeing, but I haven’t been able to reproduce the crash, fully understand it, or make a test case.
Comment 3 Wenson Hsieh 2020-01-25 12:36:38 PST
Comment on attachment 388774 [details]
Patch

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

Thanks for the patch! r=me with the build fix.

> Source/WebCore/page/EventHandler.cpp:3651
> +    if (dragState().source && dragState().dataTransfer() && dragState().shouldDispatchEvents) {

`dragState().dataTransfer()` => `dragState().dataTransfer`

I wonder if it might be nice to pull the (source && dataTransfer && shouldDispatchEvents) check into either a helper function or method on DragState, since we have it in two places here.
Comment 4 Darin Adler 2020-01-25 16:57:24 PST Comment hidden (obsolete)
Comment 5 Darin Adler 2020-01-25 16:58:06 PST
Comment on attachment 388774 [details]
Patch

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

>> Source/WebCore/page/EventHandler.cpp:3651
>> +    if (dragState().source && dragState().dataTransfer() && dragState().shouldDispatchEvents) {
> 
> `dragState().dataTransfer()` => `dragState().dataTransfer`
> 
> I wonder if it might be nice to pull the (source && dataTransfer && shouldDispatchEvents) check into either a helper function or method on DragState, since we have it in two places here.

Sure, did that. Uploaded a new patch with the changes.
Comment 6 Darin Adler 2020-01-25 17:04:07 PST
Created attachment 388793 [details]
Patch
Comment 7 Darin Adler 2020-01-25 18:43:40 PST
Comment on attachment 388793 [details]
Patch

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

> Source/WebCore/page/EventHandler.h:429
> +    static bool shouldDispatchEventsToDragSourceElement();

Just realized this can just be a free function; doesn’t have to be a class member.
Comment 8 Darin Adler 2020-01-25 18:50:23 PST
Comment on attachment 388793 [details]
Patch

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

>> Source/WebCore/page/EventHandler.h:429
>> +    static bool shouldDispatchEventsToDragSourceElement();
> 
> Just realized this can just be a free function; doesn’t have to be a class member.

No that's wrong. It does need to be a member function so it can have access to dragState().
Comment 9 Darin Adler 2020-01-25 22:33:48 PST
Committed r255128: <https://trac.webkit.org/changeset/255128>
Comment 10 David Kilzer (:ddkilzer) 2020-01-26 03:50:30 PST
<rdar://problem/58837212>