Bug 195284 - [iOS] Improve our file picker
Summary: [iOS] Improve our file picker
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on: 195955
Blocks:
  Show dependency treegraph
 
Reported: 2019-03-04 10:11 PST by Chris Dumez
Modified: 2019-03-19 11:27 PDT (History)
7 users (show)

See Also:


Attachments
Patch (14.13 KB, patch)
2019-03-04 10:26 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (14.76 KB, patch)
2019-03-04 11:43 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 2019-03-04 10:11:55 PST
Improve our file picker on iOS.
Comment 1 Chris Dumez 2019-03-04 10:12:09 PST
<rdar://problem/45655856>
Comment 2 Chris Dumez 2019-03-04 10:26:21 PST
Created attachment 363523 [details]
Patch
Comment 3 Tim Horton 2019-03-04 10:45:48 PST
Comment on attachment 363523 [details]
Patch

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

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:321
> +        if (auto UTI = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (CFStringRef)mimeType, NULL)))

Can this use UTIUtilities' UTIFromMIMEType?
Comment 4 Wenson Hsieh 2019-03-04 10:46:34 PST
Comment on attachment 363523 [details]
Patch

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

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:60
> +static bool arrayContainsUTIThatConformsTo(NSArray* utis, CFStringRef conformToUTI)

Nit - This type should be NSArray<NSString *> *.

"utis" is also a bit of a strange variable name...perhaps "typeIdentifiers" or just "types"?

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:62
> +    for (id uti in utis) {

NSString *

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:63
> +        if (UTTypeConformsTo((CFStringRef)uti, conformToUTI))

(__bridge CFStringRef)

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:322
> +            [mediaTypes addObject:(NSString *)UTI.get()];

(__bridge NSString *)

> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:363
> +    NSArray *documentTypes = mediaTypes.count ? mediaTypes : @[@"public.item"];

Nit - This isn't new code, but maybe consider using the kUTTypeItem constant instead of @"public.item"?
Comment 5 Chris Dumez 2019-03-04 11:43:12 PST
Created attachment 363532 [details]
Patch
Comment 6 WebKit Commit Bot 2019-03-04 12:21:06 PST
Comment on attachment 363532 [details]
Patch

Clearing flags on attachment: 363532

Committed r242369: <https://trac.webkit.org/changeset/242369>
Comment 7 WebKit Commit Bot 2019-03-04 12:21:07 PST
All reviewed patches have been landed.  Closing bug.