Changeset 249456 in webkit
- Timestamp:
- Sep 3, 2019 10:15:38 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r249455 r249456 1 2019-09-03 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [macCatalyst] Unable to upload non-image files using drag and drop 4 https://bugs.webkit.org/show_bug.cgi?id=201438 5 6 Reviewed by Tim Horton. 7 8 On recent builds of macOS 10.15, NSItemProviders that are produced when dropping files from Finder into a 9 macCatalyst app no longer contain `kUTTypeFileURL` as a registered type identifier. This means that the current 10 heuristic for figuring out whether or not an item provider can be represented as a file upload is broken, since 11 it thinks all dropped content is inline data. 12 13 On iOS, we treat an NSItemProvider as an "uploaded" file as long as it hasn't been explicitly marked as inline 14 data, such as a dragged selection from a native text field. However, on macCatalyst, all item providers return 15 preferredPresentationStyle of UIPreferredPresentationStyleUnspecified, regardless of the source, so this check 16 is useless on macCatalyst since it would consider all dropped content as a file upload (text selections, plain 17 URLs, etc.). 18 19 Luckily, NSItemProvider's -suggestedName is now populated in recent macOS builds, which means we have a much 20 stronger (and more robust) hint that a dropped item provider is actually a file. For the time being, use this 21 instead of always returning `NO`. 22 23 * platform/ios/WebItemProviderPasteboard.mm: 24 (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]): 25 26 Make a minor tweak to move the UIPreferredPresentationStyleInline check to shared code, such that when 27 <rdar://55002929> is fixed, our code will automatically correctly treat inline item providers that have been 28 explicitly marked as such. 29 1 30 2019-09-03 Antti Koivisto <antti@apple.com> 2 31 -
trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm
r246892 r249456 384 384 return YES; 385 385 386 if ([_itemProvider preferredPresentationStyle] == UIPreferredPresentationStyleInline) 387 return NO; 388 386 389 #if PLATFORM(MACCATALYST) 387 return NO; 390 // On macCatalyst, -preferredPresentationStyle always returns UIPreferredPresentationStyleUnspecified, 391 // even when the preferredPresentationStyle is set to something other than unspecified using the setter. 392 // This means we're unable to avoid exposing item providers that have been marked as inline data as files 393 // to the page -- see <rdar://55002929> for more details. In the meantime, only expose item providers as 394 // files if they have explicitly been given a suggested file name. 395 return [_itemProvider suggestedName].length; 388 396 #else 389 return [_itemProvider preferredPresentationStyle] != UIPreferredPresentationStyleInline;397 return YES; 390 398 #endif 391 399 }
Note: See TracChangeset
for help on using the changeset viewer.