Bug 215493 - Web Inspector: use `WI.DropZoneView` instead of `handleFileDrop`
Summary: Web Inspector: use `WI.DropZoneView` instead of `handleFileDrop`
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
: 215492 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-08-13 23:33 PDT by Devin Rousso
Modified: 2020-08-20 23:54 PDT (History)
4 users (show)

See Also:


Attachments
Patch (13.42 KB, patch)
2020-08-13 23:36 PDT, Devin Rousso
joepeck: review+
Details | Formatted Diff | Diff
Patch (13.42 KB, patch)
2020-08-14 14:33 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2020-08-13 23:33:21 PDT
`WI.DropZoneView` shows UI to indicate that something can be dropped, whereas `handleFileDrop` is invisible
Comment 1 Devin Rousso 2020-08-13 23:36:59 PDT
Created attachment 406573 [details]
Patch
Comment 2 Joseph Pecoraro 2020-08-14 10:49:21 PDT
Comment on attachment 406573 [details]
Patch

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

r=me

> Source/WebInspectorUI/UserInterface/Views/AuditTabContentView.js:104
> +        WI.FileUtilities.readJSON(files, (result) => WI.auditManager.processJSON(result))

Style: Semicolon.

> Source/WebInspectorUI/UserInterface/Views/GraphicsTabContentView.js:154
> +        WI.FileUtilities.readJSON(files, (result) => WI.canvasManager.processJSON(result))

Style: Semicolon.

> Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js:135
> +    dropZoneShouldAppearForDragEvent(dropZone, event)
> +    {
> +        return event.dataTransfer.types.includes("Files");
> +    }

Given so many of these are the same, maybe could make an alternate convenience delegate to make this pattern simpler:

    dropZoneShouldAppearForDragEventWithFiles()
    {
        return true;
    }

And `WI.DropZoneView` could check this delegate first. Probably unimportant.

> Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js:388
> +        WI.FileUtilities.readJSON(files, (result) => WI.timelineManager.processJSON(result))

Style: Semicolon.
Comment 3 Devin Rousso 2020-08-14 14:29:07 PDT
Comment on attachment 406573 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/AuditTabContentView.js:104
>> +        WI.FileUtilities.readJSON(files, (result) => WI.auditManager.processJSON(result))
> 
> Style: Semicolon.

... crap

>> Source/WebInspectorUI/UserInterface/Views/GraphicsTabContentView.js:154
>> +        WI.FileUtilities.readJSON(files, (result) => WI.canvasManager.processJSON(result))
> 
> Style: Semicolon.

crap

>> Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js:388
>> +        WI.FileUtilities.readJSON(files, (result) => WI.timelineManager.processJSON(result))
> 
> Style: Semicolon.

CRAP
Comment 4 Devin Rousso 2020-08-14 14:31:45 PDT
Comment on attachment 406573 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js:135
>> +    }
> 
> Given so many of these are the same, maybe could make an alternate convenience delegate to make this pattern simpler:
> 
>     dropZoneShouldAppearForDragEventWithFiles()
>     {
>         return true;
>     }
> 
> And `WI.DropZoneView` could check this delegate first. Probably unimportant.

Eh, sure, but I think we've covered most (if not all) of the bases with this patch already, so meh. I kinda like the verbosity/explicitness :)
Comment 5 Devin Rousso 2020-08-14 14:33:08 PDT
Created attachment 406621 [details]
Patch
Comment 6 EWS 2020-08-14 15:00:58 PDT
Committed r265707: <https://trac.webkit.org/changeset/265707>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 406621 [details].
Comment 7 Radar WebKit Bug Importer 2020-08-14 15:01:21 PDT
<rdar://problem/67099902>
Comment 8 Greg Marriott 2020-08-20 23:54:31 PDT
*** Bug 215492 has been marked as a duplicate of this bug. ***