Bug 215493

Summary: Web Inspector: use `WI.DropZoneView` instead of `handleFileDrop`
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: hi, inspector-bugzilla-changes, joepeck, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
joepeck: review+
Patch none

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. ***