[iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Nov 2018 06:17:44 +0000 (06:17 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Nov 2018 06:17:44 +0000 (06:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191819

Reviewed by Dan Bernstein.

Replace UIItemProvider (and related classes) with NSItemProvider.

Source/WebCore:

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::registerItemToPasteboard):
* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderDataRegistrar registerItemProvider:]):
(-[WebItemProviderWritableObjectRegistrar initWithObject:]):
(-[WebItemProviderWritableObjectRegistrar representingObject]):
(-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
(-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
(-[WebItemProviderRegistrationInfoList itemProvider]):
(-[WebItemProviderPasteboard pasteboardTypes]):
(-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
(-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
(allLoadableClasses):
(classForTypeIdentifier):
(-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
(-[WebItemProviderPasteboard numberOfFiles]):
(-[WebItemProviderPasteboard itemProviderAtIndex:]):
(-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):
* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsURL const):

Source/WebCore/PAL:

* pal/spi/ios/UIKitSPI.h:

Source/WebKit:

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
(-[WKContentView dropInteraction:performDrop:]):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(platformCopyPNG):
* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(-[NSItemProvider registerDataRepresentationForTypeIdentifier:withData:]):

Replace usages of this deprecated method with `-registerDataRepresentationForTypeIdentifier:visibility:loadHandler:`.

(checkEstimatedSize):
(checkSuggestedNameAndEstimatedSize):
(TestWebKitAPI::TEST):
(-[UIItemProvider registerDataRepresentationForTypeIdentifier:withData:]): Deleted.
* TestWebKitAPI/cocoa/DragAndDropSimulator.h:
* TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
(-[MockDragDropSession canLoadObjectsOfClass:]):
(-[MockDragDropSession canLoadObjectsOfClasses:]):
(-[MockDropSession initWithProviders:location:window:allowMove:]):
(-[MockDropSession canCreateItemsOfClass:]):
(-[DragAndDropSimulator _advanceProgress]):
(-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):
(-[DragAndDropSimulator _webView:adjustedDataInteractionItemProvidersForItemProvider:representingObjects:additionalData:]):
* TestWebKitAPI/ios/UIKitSPI.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238360 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h
Source/WebCore/platform/ios/PlatformPasteboardIOS.mm
Source/WebCore/platform/ios/WebItemProviderPasteboard.h
Source/WebCore/platform/ios/WebItemProviderPasteboard.mm
Source/WebCore/platform/mac/DragDataMac.mm
Source/WebKit/ChangeLog
Source/WebKit/Platform/spi/ios/UIKitSPI.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm
Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm
Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h
Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm
Tools/TestWebKitAPI/ios/UIKitSPI.h

index fdd3f6d..5dbf7bc 100644 (file)
@@ -1,3 +1,34 @@
+2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
+        https://bugs.webkit.org/show_bug.cgi?id=191819
+
+        Reviewed by Dan Bernstein.
+
+        Replace UIItemProvider (and related classes) with NSItemProvider.
+
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::registerItemToPasteboard):
+        * platform/ios/WebItemProviderPasteboard.h:
+        * platform/ios/WebItemProviderPasteboard.mm:
+        (-[WebItemProviderDataRegistrar registerItemProvider:]):
+        (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
+        (-[WebItemProviderWritableObjectRegistrar representingObject]):
+        (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
+        (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
+        (-[WebItemProviderRegistrationInfoList itemProvider]):
+        (-[WebItemProviderPasteboard pasteboardTypes]):
+        (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
+        (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
+        (allLoadableClasses):
+        (classForTypeIdentifier):
+        (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
+        (-[WebItemProviderPasteboard numberOfFiles]):
+        (-[WebItemProviderPasteboard itemProviderAtIndex:]):
+        (-[WebItemProviderPasteboard enumerateItemProvidersWithBlock:]):
+        * platform/mac/DragDataMac.mm:
+        (WebCore::DragData::containsURL const):
+
 2018-11-17  Ross Kirsling  <ross.kirsling@sony.com>
 
         Remove superfluous LayoutUnit initializations
index a1c517f..0edee5c 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
+        https://bugs.webkit.org/show_bug.cgi?id=191819
+
+        Reviewed by Dan Bernstein.
+
+        Replace UIItemProvider (and related classes) with NSItemProvider.
+
+        * pal/spi/ios/UIKitSPI.h:
+
 2018-11-16  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Reduce the use of WKSI library calls: CFNetwork
index 1a87af5..def7dfb 100644 (file)
@@ -39,11 +39,9 @@ WTF_EXTERN_C_END
 #import <UIKit/UIViewController_Private.h>
 
 #if ENABLE(DATA_INTERACTION)
-#import <UIKit/NSAttributedString+UIItemProvider.h>
-#import <UIKit/NSString+UIItemProvider.h>
+#import <UIKit/NSItemProvider+UIKitAdditions.h>
+#import <UIKit/NSItemProvider+UIKitAdditions_Private.h>
 #import <UIKit/NSURL+UIItemProvider.h>
-#import <UIKit/UIImage+UIItemProvider.h>
-#import <UIKit/UIItemProvider_Private.h>
 #endif
 
 @interface UIApplication ()
@@ -117,43 +115,4 @@ NS_ASSUME_NONNULL_END
 @end
 #endif
 
-#if ENABLE(DATA_INTERACTION)
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface UIItemProvider : NSItemProvider
-@end
-
-#define UIItemProviderRepresentationOptionsVisibilityAll NSItemProviderRepresentationVisibilityAll
-
-@protocol UIItemProviderReading <NSItemProviderReading>
-
-@required
-- (nullable instancetype)initWithItemProviderData:(NSData *)data typeIdentifier:(NSString *)typeIdentifier error:(NSError **)outError;
-
-@end
-
-@protocol UIItemProviderWriting <NSItemProviderWriting>
-
-@required
-- (NSProgress * _Nullable)loadDataWithTypeIdentifier:(NSString *)typeIdentifier forItemProviderCompletionHandler:(void (^)(NSData * _Nullable, NSError * _Nullable))completionHandler;
-
-@end
-
-@interface NSAttributedString () <UIItemProviderReading, UIItemProviderWriting>
-@end
-
-@interface NSString () <UIItemProviderReading, UIItemProviderWriting>
-@end
-
-@interface NSURL () <UIItemProviderReading, UIItemProviderWriting>
-@end
-
-@interface UIImage () <UIItemProviderReading, UIItemProviderWriting>
-@end
-
-NS_ASSUME_NONNULL_END
-
-#endif
-
 #endif
index c7547e2..d720b82 100644 (file)
@@ -292,7 +292,7 @@ static void registerItemToPasteboard(WebItemProviderRegistrationInfoList *repres
     }];
     [pasteboard setItems:@[ itemDictionary.get() ]];
 #else
-    if (UIItemProvider *itemProvider = representationsToRegister.itemProvider)
+    if (NSItemProvider *itemProvider = representationsToRegister.itemProvider)
         [pasteboard setItemProviders:@[ itemProvider ]];
     else
         [pasteboard setItemProviders:@[ ]];
index b43ea4e..1f1af86 100644 (file)
 
 #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
 
-// UIItemProviders are not implemented for iOS apps for Mac, because they were depricated last year.
-// We need to switch over to NSItemProviders everywhere. This should just be a temporary fix.
-#if defined(TARGET_OS_IOSMAC) && TARGET_OS_IOSMAC
-
-#define UIItemProvider NSItemProvider
-#define UIItemProviderReading NSItemProviderReading
-#define UIItemProviderWriting NSItemProviderWriting
-#define UIItemProviderRepresentationOptionsVisibilityAll NSItemProviderRepresentationVisibilityAll
-
-#endif
-
-@class UIItemProvider;
-@protocol UIItemProviderWriting;
-
 struct CGSize;
 
 typedef NS_ENUM(NSInteger, WebPreferredPresentationStyle) {
@@ -77,13 +63,13 @@ typedef void(^WebItemProviderFileCallback)(NSURL * _Nullable, NSError * _Nullabl
  */
 WEBCORE_EXPORT @interface WebItemProviderRegistrationInfoList : NSObject
 
-- (void)addRepresentingObject:(id <UIItemProviderWriting>)object;
+- (void)addRepresentingObject:(id <NSItemProviderWriting>)object;
 - (void)addData:(NSData *)data forType:(NSString *)typeIdentifier;
 - (void)addPromisedType:(NSString *)typeIdentifier fileCallback:(void(^)(WebItemProviderFileCallback))callback;
 
 @property (nonatomic) CGSize preferredPresentationSize;
 @property (nonatomic, copy) NSString *suggestedName;
-@property (nonatomic, readonly, nullable) UIItemProvider *itemProvider;
+@property (nonatomic, readonly, nullable) __kindof NSItemProvider *itemProvider;
 
 @property (nonatomic) WebPreferredPresentationStyle preferredPresentationStyle;
 @property (nonatomic, copy) NSData *teamData;
@@ -114,7 +100,7 @@ WEBCORE_EXPORT @interface WebItemProviderPasteboard : NSObject<AbstractPasteboar
 - (void)incrementPendingOperationCount;
 - (void)decrementPendingOperationCount;
 
-- (void)enumerateItemProvidersWithBlock:(void (^)(UIItemProvider *itemProvider, NSUInteger index, BOOL *stop))block;
+- (void)enumerateItemProvidersWithBlock:(void (^)(__kindof NSItemProvider *itemProvider, NSUInteger index, BOOL *stop))block;
 
 // The given completion block is always dispatched on the main thread.
 - (void)doAfterLoadingProvidedContentIntoFileURLs:(WebItemProviderFileLoadBlock)action;
index db3cf9c..7f6462b 100644 (file)
@@ -45,7 +45,6 @@
 SOFT_LINK_FRAMEWORK(UIKit)
 SOFT_LINK_CLASS(UIKit, UIColor)
 SOFT_LINK_CLASS(UIKit, UIImage)
-SOFT_LINK_CLASS(UIKit, UIItemProvider)
 
 typedef void(^ItemProviderDataLoadCompletionHandler)(NSData *, NSError *);
 typedef void(^ItemProviderFileLoadCompletionHandler)(NSURL *, BOOL, NSError *);
@@ -97,7 +96,7 @@ using WebCore::PasteboardCustomData;
 
 - (void)registerItemProvider:(NSItemProvider *)itemProvider
 {
-    [itemProvider registerDataRepresentationForTypeIdentifier:self.typeIdentifier visibility:UIItemProviderRepresentationOptionsVisibilityAll loadHandler:[itemData = _data] (ItemProviderDataLoadCompletionHandler completionHandler) -> NSProgress * {
+    [itemProvider registerDataRepresentationForTypeIdentifier:self.typeIdentifier visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[itemData = _data] (ItemProviderDataLoadCompletionHandler completionHandler) -> NSProgress * {
         completionHandler(itemData.get(), nil);
         return nil;
     }];
@@ -111,15 +110,15 @@ using WebCore::PasteboardCustomData;
 @end
 
 @interface WebItemProviderWritableObjectRegistrar : NSObject <WebItemProviderRegistrar>
-- (instancetype)initWithObject:(id <UIItemProviderWriting>)representingObject;
-@property (nonatomic, readonly) id <UIItemProviderWriting> representingObject;
+- (instancetype)initWithObject:(id <NSItemProviderWriting>)representingObject;
+@property (nonatomic, readonly) id <NSItemProviderWriting> representingObject;
 @end
 
 @implementation WebItemProviderWritableObjectRegistrar {
-    RetainPtr<id <UIItemProviderWriting>> _representingObject;
+    RetainPtr<id <NSItemProviderWriting>> _representingObject;
 }
 
-- (instancetype)initWithObject:(id <UIItemProviderWriting>)representingObject
+- (instancetype)initWithObject:(id <NSItemProviderWriting>)representingObject
 {
     if (!(self = [super init]))
         return nil;
@@ -128,7 +127,7 @@ using WebCore::PasteboardCustomData;
     return self;
 }
 
-- (id <UIItemProviderWriting>)representingObject
+- (id <NSItemProviderWriting>)representingObject
 {
     return _representingObject.get();
 }
@@ -140,7 +139,7 @@ using WebCore::PasteboardCustomData;
 
 - (void)registerItemProvider:(NSItemProvider *)itemProvider
 {
-    [itemProvider registerObject:self.representingObject visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    [itemProvider registerObject:self.representingObject visibility:NSItemProviderRepresentationVisibilityAll];
 }
 
 - (NSString *)description
@@ -224,9 +223,9 @@ using WebCore::PasteboardCustomData;
     [_representations addObject:representation.get()];
 }
 
-- (void)addRepresentingObject:(id <UIItemProviderWriting>)object
+- (void)addRepresentingObject:(id <NSItemProviderWriting>)object
 {
-    ASSERT([object conformsToProtocol:@protocol(UIItemProviderWriting)]);
+    ASSERT([object conformsToProtocol:@protocol(NSItemProviderWriting)]);
     auto representation = adoptNS([[WebItemProviderWritableObjectRegistrar alloc] initWithObject:object]);
     [_representations addObject:representation.get()];
 }
@@ -273,17 +272,15 @@ static UIPreferredPresentationStyle uiPreferredPresentationStyle(WebPreferredPre
 }
 #endif
 
-- (UIItemProvider *)itemProvider
+- (NSItemProvider *)itemProvider
 {
     if (!self.numberOfItems)
         return nil;
 
-    auto itemProvider = adoptNS([allocUIItemProviderInstance() init]);
+    auto itemProvider = adoptNS([NSItemProvider new]);
     for (id <WebItemProviderRegistrar> representation in _representations.get())
         [representation registerItemProvider:itemProvider.get()];
     [itemProvider setSuggestedName:self.suggestedName];
-    // UIItemProviders are not implemented for iOS apps for Mac, because they were depricated last year.
-    // We need to switch over to NSItemProviders everywhere. This should just be a temporary fix.
 #if !PLATFORM(IOSMAC)
     [itemProvider setPreferredPresentationSize:self.preferredPresentationSize];
     [itemProvider setPreferredPresentationStyle:uiPreferredPresentationStyle(self.preferredPresentationStyle)];
@@ -454,7 +451,7 @@ static UIPreferredPresentationStyle uiPreferredPresentationStyle(WebPreferredPre
 {
     NSMutableSet<NSString *> *allTypes = [NSMutableSet set];
     NSMutableArray<NSString *> *allTypesInOrder = [NSMutableArray array];
-    for (UIItemProvider *provider in _itemProviders.get()) {
+    for (NSItemProvider *provider in _itemProviders.get()) {
         for (NSString *typeIdentifier in provider.registeredTypeIdentifiers) {
             if ([allTypes containsObject:typeIdentifier])
                 continue;
@@ -501,7 +498,7 @@ static UIPreferredPresentationStyle uiPreferredPresentationStyle(WebPreferredPre
         if (!UTTypeConformsTo((CFStringRef)loadedType, (CFStringRef)typeIdentifier))
             continue;
 
-        // We've already loaded data relevant for this UTI type onto disk, so there's no need to ask the UIItemProvider for the same data again.
+        // We've already loaded data relevant for this UTI type onto disk, so there's no need to ask the NSItemProvider for the same data again.
         if (NSData *result = [NSData dataWithContentsOfURL:[loadResult fileURLForType:loadedType] options:NSDataReadingMappedIfSafe error:nil])
             return result;
     }
@@ -521,7 +518,7 @@ static UIPreferredPresentationStyle uiPreferredPresentationStyle(WebPreferredPre
     auto values = adoptNS([[NSMutableArray alloc] init]);
     RetainPtr<WebItemProviderPasteboard> retainedSelf = self;
     [itemSet enumerateIndexesUsingBlock:[retainedSelf, pasteboardType, values] (NSUInteger index, BOOL *) {
-        UIItemProvider *provider = [retainedSelf itemProviderAtIndex:index];
+        NSItemProvider *provider = [retainedSelf itemProviderAtIndex:index];
         if (!provider)
             return;
 
@@ -531,7 +528,7 @@ static UIPreferredPresentationStyle uiPreferredPresentationStyle(WebPreferredPre
     return values.autorelease();
 }
 
-static NSArray<Class<UIItemProviderReading>> *allLoadableClasses()
+static NSArray<Class<NSItemProviderReading>> *allLoadableClasses()
 {
     return @[ [getUIColorClass() class], [getUIImageClass() class], [NSURL class], [NSString class], [NSAttributedString class] ];
 }
@@ -540,8 +537,8 @@ static Class classForTypeIdentifier(NSString *typeIdentifier, NSString *&outType
 {
     outTypeIdentifierToLoad = typeIdentifier;
 
-    // First, try to load a platform UIItemProviderReading-conformant object as-is.
-    for (Class<UIItemProviderReading> loadableClass in allLoadableClasses()) {
+    // First, try to load a platform NSItemProviderReading-conformant object as-is.
+    for (Class<NSItemProviderReading> loadableClass in allLoadableClasses()) {
         if ([[loadableClass readableTypeIdentifiersForItemProvider] containsObject:(NSString *)typeIdentifier])
             return loadableClass;
     }
@@ -565,7 +562,7 @@ static Class classForTypeIdentifier(NSString *typeIdentifier, NSString *&outType
     auto values = adoptNS([[NSMutableArray alloc] init]);
     RetainPtr<WebItemProviderPasteboard> retainedSelf = self;
     [itemSet enumerateIndexesUsingBlock:[retainedSelf, pasteboardType, values] (NSUInteger index, BOOL *) {
-        UIItemProvider *provider = [retainedSelf itemProviderAtIndex:index];
+        NSItemProvider *provider = [retainedSelf itemProviderAtIndex:index];
         if (!provider)
             return;
 
@@ -645,7 +642,7 @@ static BOOL typeConformsToTypes(NSString *type, NSArray *conformsToTypes)
 {
     NSArray *supportedFileTypes = Pasteboard::supportedFileUploadPasteboardTypes();
     NSInteger numberOfFiles = 0;
-    for (UIItemProvider *itemProvider in _itemProviders.get()) {
+    for (NSItemProvider *itemProvider in _itemProviders.get()) {
         if (itemProvider.preferredPresentationStyle == UIPreferredPresentationStyleInline)
             continue;
 
@@ -793,7 +790,7 @@ static NSURL *linkTemporaryItemProviderFilesToDropStagingDirectory(NSURL *url, N
     dispatch_group_notify(fileLoadingGroup.get(), dispatch_get_main_queue(), itemLoadCompletion);
 }
 
-- (UIItemProvider *)itemProviderAtIndex:(NSUInteger)index
+- (NSItemProvider *)itemProviderAtIndex:(NSUInteger)index
 {
     return index < [_itemProviders count] ? [_itemProviders objectAtIndex:index] : nil;
 }
@@ -813,7 +810,7 @@ static NSURL *linkTemporaryItemProviderFilesToDropStagingDirectory(NSURL *url, N
     _pendingOperationCount--;
 }
 
-- (void)enumerateItemProvidersWithBlock:(void (^)(UIItemProvider *itemProvider, NSUInteger index, BOOL *stop))block
+- (void)enumerateItemProvidersWithBlock:(void (^)(__kindof NSItemProvider *itemProvider, NSUInteger index, BOOL *stop))block
 {
     [_itemProviders enumerateObjectsUsingBlock:block];
 }
index e0efe7b..15ac061 100644 (file)
@@ -274,7 +274,7 @@ bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
 
     auto urlString = platformStrategies()->pasteboardStrategy()->stringForType(urlPasteboardType(), m_pasteboardName);
     if (urlString.isEmpty()) {
-        // On iOS, we don't get access to the contents of UIItemProviders until we perform the drag operation.
+        // On iOS, we don't get access to the contents of NSItemProviders until we perform the drag operation.
         // Thus, we consider DragData to contain an URL if it contains the `public.url` UTI type. Later down the
         // road, when we perform the drag operation, we can then check if the URL's protocol is http or https,
         // and if it isn't, we bail out of page navigation.
index 8f5bc05..bd834ff 100644 (file)
@@ -1,3 +1,17 @@
+2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
+        https://bugs.webkit.org/show_bug.cgi?id=191819
+
+        Reviewed by Dan Bernstein.
+
+        Replace UIItemProvider (and related classes) with NSItemProvider.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
+        (-[WKContentView dropInteraction:performDrop:]):
+
 2018-11-17  Ross Kirsling  <ross.kirsling@sony.com>
 
         Unreviewed WinCairo build fix for r238353.
index 9eefb97..27f25c1 100644 (file)
@@ -91,7 +91,6 @@
 
 #if ENABLE(DRAG_SUPPORT)
 #import <UIKit/NSItemProvider+UIKitAdditions_Private.h>
-#import <UIKit/UIItemProvider_Private.h>
 #endif
 
 #if ENABLE(DRAG_SUPPORT)
@@ -935,9 +934,6 @@ typedef enum {
 
 #if ENABLE(DRAG_SUPPORT)
 
-@interface UIItemProvider : NSItemProvider
-@end
-
 WTF_EXTERN_C_BEGIN
 
 NSTimeInterval _UIDragInteractionDefaultLiftDelay(void);
index 21d3177..d9b478e 100644 (file)
@@ -5304,18 +5304,17 @@ static UIDropOperation dropOperationForWebCoreDragOperation(DragOperation operat
     _dragDropInteractionState = { };
 }
 
-static NSArray<UIItemProvider *> *extractItemProvidersFromDragItems(NSArray<UIDragItem *> *dragItems)
+static NSArray<NSItemProvider *> *extractItemProvidersFromDragItems(NSArray<UIDragItem *> *dragItems)
 {
-    NSMutableArray<UIItemProvider *> *providers = [NSMutableArray array];
+    NSMutableArray<NSItemProvider *> *providers = [NSMutableArray array];
     for (UIDragItem *item in dragItems) {
-        RetainPtr<UIItemProvider> provider = item.itemProvider;
-        if (provider)
-            [providers addObject:provider.get()];
+        if (NSItemProvider *provider = item.itemProvider)
+            [providers addObject:provider];
     }
     return providers;
 }
 
-static NSArray<UIItemProvider *> *extractItemProvidersFromDropSession(id <UIDropSession> session)
+static NSArray<NSItemProvider *> *extractItemProvidersFromDropSession(id <UIDropSession> session)
 {
     return extractItemProvidersFromDragItems(session.items);
 }
@@ -5491,7 +5490,7 @@ static NSArray<UIItemProvider *> *extractItemProvidersFromDropSession(id <UIDrop
 
 - (NSArray<UIDragItem *> *)_itemsForBeginningOrAddingToSessionWithRegistrationList:(WebItemProviderRegistrationInfoList *)registrationList stagedDragSource:(const DragSourceState&)stagedDragSource
 {
-    UIItemProvider *defaultItemProvider = registrationList.itemProvider;
+    NSItemProvider *defaultItemProvider = registrationList.itemProvider;
     if (!defaultItemProvider)
         return @[ ];
 
@@ -5511,7 +5510,7 @@ static NSArray<UIItemProvider *> *extractItemProvidersFromDropSession(id <UIDrop
         adjustedItemProviders = @[ defaultItemProvider ];
 
     NSMutableArray *dragItems = [NSMutableArray arrayWithCapacity:adjustedItemProviders.count];
-    for (UIItemProvider *itemProvider in adjustedItemProviders) {
+    for (NSItemProvider *itemProvider in adjustedItemProviders) {
         auto item = adoptNS([[UIDragItem alloc] initWithItemProvider:itemProvider]);
         [item _setPrivateLocalContext:@(stagedDragSource.itemIdentifier)];
         [dragItems addObject:item.autorelease()];
@@ -5775,7 +5774,7 @@ static NSArray<UIItemProvider *> *extractItemProvidersFromDropSession(id <UIDrop
 
 - (void)dropInteraction:(UIDropInteraction *)interaction performDrop:(id <UIDropSession>)session
 {
-    NSArray <UIItemProvider *> *itemProviders = extractItemProvidersFromDropSession(session);
+    NSArray <NSItemProvider *> *itemProviders = extractItemProvidersFromDropSession(session);
     id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
     if ([uiDelegate respondsToSelector:@selector(_webView:performDataInteractionOperationWithItemProviders:)]) {
         if ([uiDelegate _webView:_webView performDataInteractionOperationWithItemProviders:itemProviders])
index 425ecdc..ea2a324 100644 (file)
@@ -1,3 +1,34 @@
+2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
+        https://bugs.webkit.org/show_bug.cgi?id=191819
+
+        Reviewed by Dan Bernstein.
+
+        Replace UIItemProvider (and related classes) with NSItemProvider.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+        (platformCopyPNG):
+        * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
+        (-[NSItemProvider registerDataRepresentationForTypeIdentifier:withData:]):
+
+        Replace usages of this deprecated method with `-registerDataRepresentationForTypeIdentifier:visibility:loadHandler:`.
+
+        (checkEstimatedSize):
+        (checkSuggestedNameAndEstimatedSize):
+        (TestWebKitAPI::TEST):
+        (-[UIItemProvider registerDataRepresentationForTypeIdentifier:withData:]): Deleted.
+        * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+        * TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
+        (-[MockDragDropSession canLoadObjectsOfClass:]):
+        (-[MockDragDropSession canLoadObjectsOfClasses:]):
+        (-[MockDropSession initWithProviders:location:window:allowMove:]):
+        (-[MockDropSession canCreateItemsOfClass:]):
+        (-[DragAndDropSimulator _advanceProgress]):
+        (-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):
+        (-[DragAndDropSimulator _webView:adjustedDataInteractionItemProvidersForItemProvider:representingObjects:additionalData:]):
+        * TestWebKitAPI/ios/UIKitSPI.h:
+
 2018-11-17  Chris Dumez  <cdumez@apple.com>
 
         ASSERTION FAILED: m_messageReceivers.contains(...) under ViewGestureController removeMessageReceiver
index 8f13b78..e2ce72a 100644 (file)
@@ -532,7 +532,7 @@ void platformCopyPNG()
     [pasteboard setData:testImageData() forType:NSPasteboardTypePNG];
 #elif PLATFORM(IOS_FAMILY)
     UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
-    auto item = adoptNS([[UIItemProvider alloc] init]);
+    auto item = adoptNS([[NSItemProvider alloc] init]);
     [item setPreferredPresentationStyle:UIPreferredPresentationStyleAttachment];
     [item registerData:testImageData() type:(__bridge NSString *)kUTTypePNG];
     pasteboard.itemProviders = @[ item.get() ];
index b903edc..b879c0f 100644 (file)
 
 typedef void (^FileLoadCompletionBlock)(NSURL *, BOOL, NSError *);
 typedef void (^DataLoadCompletionBlock)(NSData *, NSError *);
-typedef void (^UIItemProviderDataLoadCompletionBlock)(NSData *, NSError *);
+typedef void (^NSItemProviderDataLoadCompletionBlock)(NSData *, NSError *);
 
 #if !USE(APPLE_INTERNAL_SDK)
 
-@interface UIItemProviderRepresentationOptions : NSObject
+@interface NSItemProviderRepresentationOptions : NSObject
 @end
 
 #endif
 
-@interface UIItemProvider()
-+ (UIItemProvider *)itemProviderWithURL:(NSURL *)url title:(NSString *)title;
-- (void) registerDataRepresentationForTypeIdentifier:(NSString *)typeIdentifier options:(UIItemProviderRepresentationOptions*)options loadHandler:(NSProgress * (^)(void (^UIItemProviderDataLoadCompletionBlock)(NSData *item, NSError *error))) loadHandler;
+@interface NSItemProvider ()
++ (NSItemProvider *)itemProviderWithURL:(NSURL *)url title:(NSString *)title;
 @end
 
 static NSString *InjectedBundlePasteboardDataType = @"org.webkit.data";
@@ -72,12 +71,12 @@ static NSData *testZIPArchive()
     return [NSData dataWithContentsOfURL:zipFileURL];
 }
 
-@implementation UIItemProvider (DragAndDropTests)
+@implementation NSItemProvider (DragAndDropTests)
 
 - (void)registerDataRepresentationForTypeIdentifier:(NSString *)typeIdentifier withData:(NSData *)data
 {
     RetainPtr<NSData> retainedData = data;
-    [self registerDataRepresentationForTypeIdentifier:typeIdentifier visibility:UIItemProviderRepresentationOptionsVisibilityAll loadHandler: [retainedData] (DataLoadCompletionBlock block) -> NSProgress * {
+    [self registerDataRepresentationForTypeIdentifier:typeIdentifier visibility:NSItemProviderRepresentationVisibilityAll loadHandler: [retainedData] (DataLoadCompletionBlock block) -> NSProgress * {
         block(retainedData.get(), nil);
         return [NSProgress discreteProgressWithTotalUnitCount:100];
     }];
@@ -146,14 +145,14 @@ static void checkTypeIdentifierIsRegisteredAtIndex(DragAndDropSimulator *simulat
 
 static void checkEstimatedSize(DragAndDropSimulator *simulator, CGSize estimatedSize)
 {
-    UIItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
+    NSItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
     EXPECT_EQ(estimatedSize.width, sourceItemProvider.preferredPresentationSize.width);
     EXPECT_EQ(estimatedSize.height, sourceItemProvider.preferredPresentationSize.height);
 }
 
 static void checkSuggestedNameAndEstimatedSize(DragAndDropSimulator *simulator, NSString *suggestedName, CGSize estimatedSize)
 {
-    UIItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
+    NSItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
     EXPECT_WK_STREQ(suggestedName.UTF8String, sourceItemProvider.suggestedName.UTF8String);
     EXPECT_EQ(estimatedSize.width, sourceItemProvider.preferredPresentationSize.width);
     EXPECT_EQ(estimatedSize.height, sourceItemProvider.preferredPresentationSize.height);
@@ -494,7 +493,7 @@ TEST(DragAndDropTests, LinkToInput)
     EXPECT_WK_STREQ("https://www.apple.com/", [webView editorValue].UTF8String);
 
     __block bool doneLoadingURL = false;
-    UIItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
+    NSItemProvider *sourceItemProvider = [simulator sourceItemProviders].firstObject;
     [sourceItemProvider loadObjectOfClass:[NSURL class] completionHandler:^(id object, NSError *error) {
         NSURL *url = object;
         EXPECT_WK_STREQ("Hello world", url._title.UTF8String ?: "");
@@ -599,8 +598,8 @@ TEST(DragAndDropTests, ExternalSourcePlainTextToIFrame)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"contenteditable-in-iframe"];
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [itemProvider registerObject:@"Hello world" visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [itemProvider registerObject:@"Hello world" visibility:NSItemProviderRepresentationVisibilityAll];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
     [simulator setExternalItemProviders:@[ itemProvider.get() ]];
@@ -618,7 +617,7 @@ TEST(DragAndDropTests, ExternalSourceInlineTextToFileInput)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
     [simulatedItemProvider setPreferredPresentationStyle:UIPreferredPresentationStyleInline];
     [simulatedItemProvider registerObject:@"This item provider requested inline presentation style." visibility:NSItemProviderRepresentationVisibilityAll];
 
@@ -634,7 +633,7 @@ TEST(DragAndDropTests, ExternalSourceJSONToFileInput)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedJSONItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedJSONItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *jsonData = [@"{ \"foo\": \"bar\",  \"bar\": \"baz\" }" dataUsingEncoding:NSUTF8StringEncoding];
     [simulatedJSONItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJSON withData:jsonData];
 
@@ -650,7 +649,7 @@ TEST(DragAndDropTests, ExternalSourceImageToFileInput)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedImageItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedImageItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *imageData = UIImageJPEGRepresentation(testIconImage(), 0.5);
     [simulatedImageItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG withData:imageData];
 
@@ -667,7 +666,7 @@ TEST(DragAndDropTests, ExternalSourceHTMLToUploadArea)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *htmlData = [@"<body contenteditable></body>" dataUsingEncoding:NSUTF8StringEncoding];
     [simulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:htmlData];
     [simulatedHTMLItemProvider setSuggestedName:@"index.html"];
@@ -687,7 +686,7 @@ TEST(DragAndDropTests, ExternalSourceMoveOperationNotAllowed)
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
     [webView stringByEvaluatingJavaScript:@"upload.dropEffect = 'move'"];
 
-    auto simulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *htmlData = [@"<body contenteditable></body>" dataUsingEncoding:NSUTF8StringEncoding];
     [simulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:htmlData];
 
@@ -704,11 +703,11 @@ TEST(DragAndDropTests, ExternalSourceZIPArchiveAndURLToSingleFileInput)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto archiveProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto archiveProvider = adoptNS([[NSItemProvider alloc] init]);
     [archiveProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeZipArchive withData:testZIPArchive()];
 
-    auto urlProvider = adoptNS([[UIItemProvider alloc] init]);
-    [urlProvider registerObject:[NSURL URLWithString:@"https://webkit.org"] visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto urlProvider = adoptNS([[NSItemProvider alloc] init]);
+    [urlProvider registerObject:[NSURL URLWithString:@"https://webkit.org"] visibility:NSItemProviderRepresentationVisibilityAll];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
     [simulator setExternalItemProviders:@[ archiveProvider.get(), urlProvider.get() ]];
@@ -723,7 +722,7 @@ TEST(DragAndDropTests, ExternalSourceZIPArchiveToUploadArea)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeZipArchive withData:testZIPArchive()];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
@@ -739,11 +738,11 @@ TEST(DragAndDropTests, ExternalSourceImageAndHTMLToSingleFileInput)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedImageItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedImageItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *imageData = UIImageJPEGRepresentation(testIconImage(), 0.5);
     [simulatedImageItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG withData:imageData];
 
-    auto simulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *htmlData = [@"<body contenteditable></body>" dataUsingEncoding:NSUTF8StringEncoding];
     [simulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:htmlData];
 
@@ -761,11 +760,11 @@ TEST(DragAndDropTests, ExternalSourceImageAndHTMLToMultipleFileInput)
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
     [webView stringByEvaluatingJavaScript:@"input.setAttribute('multiple', '')"];
 
-    auto simulatedImageItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedImageItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *imageData = UIImageJPEGRepresentation(testIconImage(), 0.5);
     [simulatedImageItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG withData:imageData];
 
-    auto simulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *htmlData = [@"<body contenteditable></body>" dataUsingEncoding:NSUTF8StringEncoding];
     [simulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:htmlData];
 
@@ -782,15 +781,15 @@ TEST(DragAndDropTests, ExternalSourceImageAndHTMLToUploadArea)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedImageItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedImageItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *imageData = UIImageJPEGRepresentation(testIconImage(), 0.5);
     [simulatedImageItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG withData:imageData];
 
-    auto firstSimulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto firstSimulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *firstHTMLData = [@"<body contenteditable></body>" dataUsingEncoding:NSUTF8StringEncoding];
     [firstSimulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:firstHTMLData];
 
-    auto secondSimulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto secondSimulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *secondHTMLData = [@"<html><body>hello world</body></html>" dataUsingEncoding:NSUTF8StringEncoding];
     [secondSimulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:secondHTMLData];
 
@@ -810,7 +809,7 @@ TEST(DragAndDropTests, ExternalSourceHTMLToContentEditable)
     [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *htmlData = [@"<h1>This is a test</h1>" dataUsingEncoding:NSUTF8StringEncoding];
     [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:htmlData];
     [simulator setExternalItemProviders:@[ itemProvider.get() ]];
@@ -830,7 +829,7 @@ TEST(DragAndDropTests, ExternalSourceBoldSystemAttributedStringToContentEditable
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
     NSDictionary *textAttributes = @{ NSFontAttributeName: [UIFont boldSystemFontOfSize:20] };
     NSAttributedString *richText = [[NSAttributedString alloc] initWithString:@"This is a test" attributes:textAttributes];
-    auto itemProvider = adoptNS([[UIItemProvider alloc] initWithObject:richText]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] initWithObject:richText]);
     [simulator setExternalItemProviders:@[ itemProvider.get() ]];
     [simulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
 
@@ -846,7 +845,7 @@ TEST(DragAndDropTests, ExternalSourceColoredAttributedStringToContentEditable)
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
     NSDictionary *textAttributes = @{ NSForegroundColorAttributeName: [UIColor redColor] };
     NSAttributedString *richText = [[NSAttributedString alloc] initWithString:@"This is a test" attributes:textAttributes];
-    auto itemProvider = adoptNS([[UIItemProvider alloc] initWithObject:richText]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] initWithObject:richText]);
     [simulator setExternalItemProviders:@[ itemProvider.get() ]];
     [simulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
 
@@ -861,12 +860,12 @@ TEST(DragAndDropTests, ExternalSourceMultipleURLsToContentEditable)
     [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    auto firstItem = adoptNS([[UIItemProvider alloc] init]);
-    [firstItem registerObject:[NSURL URLWithString:@"https://www.apple.com/iphone/"] visibility:UIItemProviderRepresentationOptionsVisibilityAll];
-    auto secondItem = adoptNS([[UIItemProvider alloc] init]);
-    [secondItem registerObject:[NSURL URLWithString:@"https://www.apple.com/mac/"] visibility:UIItemProviderRepresentationOptionsVisibilityAll];
-    auto thirdItem = adoptNS([[UIItemProvider alloc] init]);
-    [thirdItem registerObject:[NSURL URLWithString:@"https://webkit.org/"] visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto firstItem = adoptNS([[NSItemProvider alloc] init]);
+    [firstItem registerObject:[NSURL URLWithString:@"https://www.apple.com/iphone/"] visibility:NSItemProviderRepresentationVisibilityAll];
+    auto secondItem = adoptNS([[NSItemProvider alloc] init]);
+    [secondItem registerObject:[NSURL URLWithString:@"https://www.apple.com/mac/"] visibility:NSItemProviderRepresentationVisibilityAll];
+    auto thirdItem = adoptNS([[NSItemProvider alloc] init]);
+    [thirdItem registerObject:[NSURL URLWithString:@"https://webkit.org/"] visibility:NSItemProviderRepresentationVisibilityAll];
     [simulator setExternalItemProviders:@[ firstItem.get(), secondItem.get(), thirdItem.get() ]];
     [simulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
 
@@ -895,9 +894,9 @@ TEST(DragAndDropTests, RespectsExternalSourceFidelityRankings)
     // fidelity order requested by the source, we'll end up assuming that the image is a higher fidelity representation
     // than the plain text, and erroneously insert the image. If we respect source fidelities, we'll insert text rather
     // than an image.
-    auto simulatedItemProviderWithTextFirst = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProviderWithTextFirst registerObject:@"Hello world" visibility:UIItemProviderRepresentationOptionsVisibilityAll];
-    [simulatedItemProviderWithTextFirst registerObject:testIconImage() visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto simulatedItemProviderWithTextFirst = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProviderWithTextFirst registerObject:@"Hello world" visibility:NSItemProviderRepresentationVisibilityAll];
+    [simulatedItemProviderWithTextFirst registerObject:testIconImage() visibility:NSItemProviderRepresentationVisibilityAll];
     [simulator setExternalItemProviders:@[ simulatedItemProviderWithTextFirst.get() ]];
 
     [simulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
@@ -906,9 +905,9 @@ TEST(DragAndDropTests, RespectsExternalSourceFidelityRankings)
     [webView stringByEvaluatingJavaScript:@"editor.innerHTML = ''"];
 
     // Now we register the item providers in reverse, and expect the image to be inserted instead of text.
-    auto simulatedItemProviderWithImageFirst = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProviderWithImageFirst registerObject:testIconImage() visibility:UIItemProviderRepresentationOptionsVisibilityAll];
-    [simulatedItemProviderWithImageFirst registerObject:@"Hello world" visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto simulatedItemProviderWithImageFirst = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProviderWithImageFirst registerObject:testIconImage() visibility:NSItemProviderRepresentationVisibilityAll];
+    [simulatedItemProviderWithImageFirst registerObject:@"Hello world" visibility:NSItemProviderRepresentationVisibilityAll];
     [simulator setExternalItemProviders:@[ simulatedItemProviderWithImageFirst.get() ]];
 
     [simulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
@@ -930,8 +929,8 @@ TEST(DragAndDropTests, ExternalSourceUTF8PlainTextOnly)
 
     NSString *textPayload = @"Ceci n'est pas une string";
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText options:nil loadHandler:^NSProgress *(UIItemProviderDataLoadCompletionBlock completionBlock)
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(NSItemProviderDataLoadCompletionBlock completionBlock)
     {
         completionBlock([textPayload dataUsingEncoding:NSUTF8StringEncoding], nil);
         return [NSProgress discreteProgressWithTotalUnitCount:100];
@@ -950,8 +949,8 @@ TEST(DragAndDropTests, ExternalSourceJPEGOnly)
     [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG options:nil loadHandler:^NSProgress *(UIItemProviderDataLoadCompletionBlock completionBlock)
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(NSItemProviderDataLoadCompletionBlock completionBlock)
     {
         completionBlock(UIImageJPEGRepresentation(testIconImage(), 0.5), nil);
         return [NSProgress discreteProgressWithTotalUnitCount:100];
@@ -970,8 +969,8 @@ TEST(DragAndDropTests, ExternalSourceTitledNSURL)
 
     NSURL *titledURL = [NSURL URLWithString:@"https://www.apple.com"];
     titledURL._title = @"Apple";
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProvider registerObject:titledURL visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProvider registerObject:titledURL visibility:NSItemProviderRepresentationVisibilityAll];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
     [simulator setExternalItemProviders:@[ simulatedItemProvider.get() ]];
@@ -988,7 +987,7 @@ TEST(DragAndDropTests, ExternalSourceFileURL)
     [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
 
     NSURL *URL = [NSURL URLWithString:@"file:///some/file/that/is/not/real"];
-    UIItemProvider *simulatedItemProvider = [UIItemProvider itemProviderWithURL:URL title:@""];
+    NSItemProvider *simulatedItemProvider = [NSItemProvider itemProviderWithURL:URL title:@""];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
     [simulator setExternalItemProviders:@[ simulatedItemProvider ]];
@@ -1003,11 +1002,11 @@ TEST(DragAndDropTests, ExternalSourceOverrideDropFileUpload)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"file-uploading"];
 
-    auto simulatedImageItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedImageItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *imageData = UIImageJPEGRepresentation(testIconImage(), 0.5);
     [simulatedImageItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG withData:imageData];
 
-    auto simulatedHTMLItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedHTMLItemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSData *firstHTMLData = [@"<body contenteditable></body>" dataUsingEncoding:NSUTF8StringEncoding];
     [simulatedHTMLItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:firstHTMLData];
     [simulatedHTMLItemProvider setPreferredPresentationStyle:UIPreferredPresentationStyleAttachment];
@@ -1131,10 +1130,10 @@ TEST(DragAndDropTests, ExternalSourceOverrideDropInsertURL)
         return allowedItems;
     }];
 
-    auto firstItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [firstItemProvider registerObject:@"This is a string." visibility:UIItemProviderRepresentationOptionsVisibilityAll];
-    auto secondItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [secondItemProvider registerObject:[NSURL URLWithString:@"https://webkit.org/"] visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    auto firstItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [firstItemProvider registerObject:@"This is a string." visibility:NSItemProviderRepresentationVisibilityAll];
+    auto secondItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [secondItemProvider registerObject:[NSURL URLWithString:@"https://webkit.org/"] visibility:NSItemProviderRepresentationVisibilityAll];
     [simulator setExternalItemProviders:@[ firstItemProvider.get(), secondItemProvider.get() ]];
     [simulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
 
@@ -1146,7 +1145,7 @@ TEST(DragAndDropTests, OverrideDrop)
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"simple"];
 
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
     [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:[@"<body></body>" dataUsingEncoding:NSUTF8StringEncoding]];
 
     __block bool finishedLoadingData = false;
@@ -1179,8 +1178,8 @@ TEST(DragAndDropTests, InjectedBundleOverridePerformTwoStepDrop)
     [webView loadTestPageNamed:@"autofocus-contenteditable"];
     [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
 
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText options:nil loadHandler:^NSProgress *(UIItemProviderDataLoadCompletionBlock completionBlock)
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(NSItemProviderDataLoadCompletionBlock completionBlock)
     {
         completionBlock([@"Hello world" dataUsingEncoding:NSUTF8StringEncoding], nil);
         return [NSProgress discreteProgressWithTotalUnitCount:100];
@@ -1202,8 +1201,8 @@ TEST(DragAndDropTests, InjectedBundleAllowPerformTwoStepDrop)
     [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
     [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
 
-    auto simulatedItemProvider = adoptNS([[UIItemProvider alloc] init]);
-    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText options:nil loadHandler:^NSProgress *(UIItemProviderDataLoadCompletionBlock completionBlock)
+    auto simulatedItemProvider = adoptNS([[NSItemProvider alloc] init]);
+    [simulatedItemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(NSItemProviderDataLoadCompletionBlock completionBlock)
     {
         completionBlock([@"Hello world" dataUsingEncoding:NSUTF8StringEncoding], nil);
         return [NSProgress discreteProgressWithTotalUnitCount:100];
@@ -1225,7 +1224,7 @@ TEST(DragAndDropTests, InjectedBundleImageElementData)
 
     __block RetainPtr<NSString> injectedString;
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    [simulator setConvertItemProvidersBlock:^NSArray *(UIItemProvider *itemProvider, NSArray *, NSDictionary *data)
+    [simulator setConvertItemProvidersBlock:^NSArray *(NSItemProvider *itemProvider, NSArray *, NSDictionary *data)
     {
         injectedString = adoptNS([[NSString alloc] initWithData:data[InjectedBundlePasteboardDataType] encoding:NSUTF8StringEncoding]);
         return @[ itemProvider ];
@@ -1245,7 +1244,7 @@ TEST(DragAndDropTests, InjectedBundleAttachmentElementData)
 
     __block RetainPtr<NSString> injectedString;
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    [simulator setConvertItemProvidersBlock:^NSArray *(UIItemProvider *itemProvider, NSArray *, NSDictionary *data)
+    [simulator setConvertItemProvidersBlock:^NSArray *(NSItemProvider *itemProvider, NSArray *, NSDictionary *data)
     {
         injectedString = adoptNS([[NSString alloc] initWithData:data[InjectedBundlePasteboardDataType] encoding:NSUTF8StringEncoding]);
         return @[ itemProvider ];
@@ -1291,7 +1290,7 @@ TEST(DragAndDropTests, CancelledLiftDoesNotCauseSubsequentDragsToFail)
     [webView synchronouslyLoadTestPageNamed:@"link-and-target-div"];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    [simulator setConvertItemProvidersBlock:^NSArray *(UIItemProvider *, NSArray *, NSDictionary *)
+    [simulator setConvertItemProvidersBlock:^NSArray *(NSItemProvider *, NSArray *, NSDictionary *)
     {
         return @[ ];
     }];
@@ -1302,7 +1301,7 @@ TEST(DragAndDropTests, CancelledLiftDoesNotCauseSubsequentDragsToFail)
     checkStringArraysAreEqual(@[@"dragstart", @"dragend"], [outputText componentsSeparatedByString:@" "]);
 
     [webView stringByEvaluatingJavaScript:@"output.innerHTML = ''"];
-    [simulator setConvertItemProvidersBlock:^NSArray *(UIItemProvider *itemProvider, NSArray *, NSDictionary *)
+    [simulator setConvertItemProvidersBlock:^NSArray *(NSItemProvider *itemProvider, NSArray *, NSDictionary *)
     {
         return @[ itemProvider ];
     }];
@@ -1423,15 +1422,15 @@ TEST(DragAndDropTests, WebItemProviderPasteboardLoading)
     static NSString *slowString = @"This data loads slowly";
 
     WebItemProviderPasteboard *pasteboard = [WebItemProviderPasteboard sharedInstance];
-    auto fastItem = adoptNS([[UIItemProvider alloc] init]);
-    [fastItem registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText options:nil loadHandler:^NSProgress *(UIItemProviderDataLoadCompletionBlock completionBlock)
+    auto fastItem = adoptNS([[NSItemProvider alloc] init]);
+    [fastItem registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(NSItemProviderDataLoadCompletionBlock completionBlock)
     {
         completionBlock([fastString dataUsingEncoding:NSUTF8StringEncoding], nil);
         return nil;
     }];
 
-    auto slowItem = adoptNS([[UIItemProvider alloc] init]);
-    [slowItem registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText options:nil loadHandler:^NSProgress *(UIItemProviderDataLoadCompletionBlock completionBlock)
+    auto slowItem = adoptNS([[NSItemProvider alloc] init]);
+    [slowItem registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(NSItemProviderDataLoadCompletionBlock completionBlock)
     {
         sleep(2_s);
         completionBlock([slowString dataUsingEncoding:NSUTF8StringEncoding], nil);
@@ -1545,7 +1544,7 @@ TEST(DragAndDropTests, DataTransferGetDataWhenDroppingImageAndMarkup)
     [webView synchronouslyLoadTestPageNamed:@"DataTransfer"];
 
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypePNG withData:testIconImageData()];
     NSString *markupString = @"<script>bar()</script><strong onmousedown=javascript:void(0)>HELLO WORLD</strong>";
     [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeHTML withData:[markupString dataUsingEncoding:NSUTF8StringEncoding]];
@@ -1631,13 +1630,13 @@ TEST(DragAndDropTests, DataTransferGetDataWhenDroppingImageWithFileURL)
     [webView synchronouslyLoadTestPageNamed:@"dump-datatransfer-types"];
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSURL *iconURL = [[NSBundle mainBundle] URLForResource:@"icon" withExtension:@"png" subdirectory:@"TestWebKitAPI.resources"];
     [itemProvider registerFileRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypePNG fileOptions:0 visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[protectedIconURL = retainPtr(iconURL)] (FileLoadCompletionBlock completionHandler) -> NSProgress * {
         completionHandler(protectedIconURL.get(), NO, nil);
         return nil;
     }];
-    [itemProvider registerObject:iconURL visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    [itemProvider registerObject:iconURL visibility:NSItemProviderRepresentationVisibilityAll];
     [simulator setExternalItemProviders:@[ itemProvider.get() ]];
 
     [simulator runFrom:CGPointMake(300, 375) to:CGPointMake(50, 375)];
@@ -1655,13 +1654,13 @@ TEST(DragAndDropTests, DataTransferGetDataWhenDroppingImageWithHTTPURL)
     [webView synchronouslyLoadTestPageNamed:@"dump-datatransfer-types"];
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeJPEG visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(DataLoadCompletionBlock completionHandler)
     {
         completionHandler(UIImageJPEGRepresentation(testIconImage(), 0.5), nil);
         return nil;
     }];
-    [itemProvider registerObject:[NSURL URLWithString:@"http://webkit.org"] visibility:UIItemProviderRepresentationOptionsVisibilityAll];
+    [itemProvider registerObject:[NSURL URLWithString:@"http://webkit.org"] visibility:NSItemProviderRepresentationVisibilityAll];
     [simulator setExternalItemProviders:@[ itemProvider.get() ]];
 
     [simulator runFrom:CGPointMake(300, 375) to:CGPointMake(50, 375)];
@@ -1678,7 +1677,7 @@ TEST(DragAndDropTests, DataTransferGetDataWhenDroppingRespectsPresentationStyle)
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
 
     runTestWithTemporaryTextFile(^(NSURL *fileURL) {
-        auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+        auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
         [itemProvider registerFileRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeUTF8PlainText fileOptions:0 visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[protectedFileURL = retainPtr(fileURL)] (FileLoadCompletionBlock completionHandler) -> NSProgress * {
             completionHandler(protectedFileURL.get(), NO, nil);
             return nil;
@@ -1731,7 +1730,7 @@ TEST(DragAndDropTests, DataTransferGetDataReadPlainAndRichText)
     [webView synchronouslyLoadTestPageNamed:@"DataTransfer"];
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     NSDictionary *textAttributes = @{ NSFontAttributeName: [UIFont boldSystemFontOfSize:20] };
     NSAttributedString *richText = [[NSAttributedString alloc] initWithString:@"WebKit" attributes:textAttributes];
     [itemProvider registerObject:richText visibility:NSItemProviderRepresentationVisibilityAll];
@@ -1755,7 +1754,7 @@ TEST(DragAndDropTests, DataTransferSuppressGetDataDueToPresenceOfTextFile)
     [webView synchronouslyLoadTestPageNamed:@"DataTransfer"];
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     [itemProvider registerObject:@"Hello world" visibility:NSItemProviderRepresentationVisibilityAll];
     [itemProvider setSuggestedName:@"hello.txt"];
 
@@ -1776,7 +1775,7 @@ TEST(DragAndDropTests, DataTransferGetDataCannotReadPrivateArbitraryTypes)
     [webView synchronouslyLoadTestPageNamed:@"dump-datatransfer-types"];
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
 
-    auto itemProvider = adoptNS([[UIItemProvider alloc] init]);
+    auto itemProvider = adoptNS([[NSItemProvider alloc] init]);
     [itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeMP3 visibility:NSItemProviderRepresentationVisibilityAll loadHandler:^NSProgress *(DataLoadCompletionBlock completionHandler)
     {
         completionHandler([@"this is a test" dataUsingEncoding:NSUTF8StringEncoding], nil);
index b912da3..a398f98 100644 (file)
@@ -96,7 +96,7 @@ typedef NSDictionary<NSNumber *, NSValue *> *ProgressToCGPointValueMap;
 @property (nonatomic) BOOL shouldEnsureUIApplication;
 @property (nonatomic) BOOL shouldAllowMoveOperation;
 @property (nonatomic) BlockPtr<BOOL(_WKActivatedElementInfo *)> showCustomActionSheetBlock;
-@property (nonatomic) BlockPtr<NSArray *(UIItemProvider *, NSArray *, NSDictionary *)> convertItemProvidersBlock;
+@property (nonatomic) BlockPtr<NSArray *(NSItemProvider *, NSArray *, NSDictionary *)> convertItemProvidersBlock;
 @property (nonatomic) BlockPtr<NSArray *(id <UIDropSession>)> overridePerformDropBlock;
 @property (nonatomic, strong) NSArray *externalItemProviders;
 @property (nonatomic) BlockPtr<NSUInteger(NSUInteger, id)> overrideDragUpdateBlock;
index 745547d..2b00c9f 100644 (file)
@@ -120,7 +120,7 @@ using namespace TestWebKitAPI;
     return YES;
 }
 
-- (BOOL)canLoadObjectsOfClass:(Class<UIItemProviderReading>)aClass
+- (BOOL)canLoadObjectsOfClass:(Class<NSItemProviderReading>)aClass
 {
     for (UIDragItem *item in self.items) {
         if ([item.itemProvider canLoadObjectOfClass:aClass])
@@ -129,9 +129,9 @@ using namespace TestWebKitAPI;
     return NO;
 }
 
-- (BOOL)canLoadObjectsOfClasses:(NSArray<Class<UIItemProviderReading>> *)classes
+- (BOOL)canLoadObjectsOfClasses:(NSArray<Class<NSItemProviderReading>> *)classes
 {
-    for (Class<UIItemProviderReading> aClass in classes) {
+    for (Class<NSItemProviderReading> aClass in classes) {
         BOOL canLoad = NO;
         for (UIDragItem *item in self.items)
             canLoad |= [item.itemProvider canLoadObjectOfClass:aClass];
@@ -171,10 +171,10 @@ using namespace TestWebKitAPI;
 
 @implementation MockDropSession
 
-- (instancetype)initWithProviders:(NSArray<UIItemProvider *> *)providers location:(CGPoint)locationInWindow window:(UIWindow *)window allowMove:(BOOL)allowMove
+- (instancetype)initWithProviders:(NSArray<NSItemProvider *> *)providers location:(CGPoint)locationInWindow window:(UIWindow *)window allowMove:(BOOL)allowMove
 {
     auto items = adoptNS([[NSMutableArray alloc] init]);
-    for (UIItemProvider *itemProvider in providers)
+    for (NSItemProvider *itemProvider in providers)
         [items addObject:[[[UIDragItem alloc] initWithItemProvider:itemProvider] autorelease]];
 
     return [super initWithItems:items.get() location:locationInWindow window:window allowMove:allowMove];
@@ -215,7 +215,7 @@ using namespace TestWebKitAPI;
     return NO;
 }
 
-- (BOOL)canCreateItemsOfClass:(Class<UIItemProviderReading>)aClass
+- (BOOL)canCreateItemsOfClass:(Class<NSItemProviderReading>)aClass
 {
     ASSERT_NOT_REACHED();
     return NO;
@@ -516,7 +516,7 @@ static NSArray *dragAndDropEventNames()
 
     switch (_phase) {
     case DragAndDropPhaseBeginning: {
-        NSMutableArray<UIItemProvider *> *itemProviders = [NSMutableArray array];
+        NSMutableArray<NSItemProvider *> *itemProviders = [NSMutableArray array];
         NSArray *items = [[_webView dragInteractionDelegate] dragInteraction:[_webView dragInteraction] itemsForBeginningSession:_dragSession.get()];
         if (!items.count) {
             _phase = DragAndDropPhaseCancelled;
@@ -650,7 +650,7 @@ static NSArray *dragAndDropEventNames()
 
 #pragma mark - WKUIDelegatePrivate
 
-- (void)_webView:(WKWebView *)webView dataInteractionOperationWasHandled:(BOOL)handled forSession:(id)session itemProviders:(NSArray<UIItemProvider *> *)itemProviders
+- (void)_webView:(WKWebView *)webView dataInteractionOperationWasHandled:(BOOL)handled forSession:(id)session itemProviders:(NSArray<NSItemProvider *> *)itemProviders
 {
     _suppressedSelectionCommandsDuringDrop = [_webView textInputContentView]._shouldSuppressSelectionCommands;
     _isDoneWithCurrentRun = true;
@@ -664,7 +664,7 @@ static NSArray *dragAndDropEventNames()
     return self.overrideDragUpdateBlock ? self.overrideDragUpdateBlock(operation, session) : operation;
 }
 
-- (NSArray *)_webView:(WKWebView *)webView adjustedDataInteractionItemProvidersForItemProvider:(UIItemProvider *)itemProvider representingObjects:(NSArray *)representingObjects additionalData:(NSDictionary *)additionalData
+- (NSArray *)_webView:(WKWebView *)webView adjustedDataInteractionItemProvidersForItemProvider:(NSItemProvider *)itemProvider representingObjects:(NSArray *)representingObjects additionalData:(NSDictionary *)additionalData
 {
     return self.convertItemProvidersBlock ? self.convertItemProvidersBlock(itemProvider, representingObjects, additionalData) : @[ itemProvider ];
 }
index f28d00e..daa29a0 100644 (file)
 @protocol UIDragSession;
 @class UIDragInteraction;
 @class UIDragItem;
-#import <UIKit/NSString+UIItemProvider.h>
-#import <UIKit/NSURL+UIItemProvider.h>
+#import <UIKit/NSItemProvider+UIKitAdditions_Private.h>
 #import <UIKit/UIDragInteraction_Private.h>
-#import <UIKit/UIImage+UIItemProvider.h>
-#import <UIKit/UIItemProvider.h>
-#import <UIKit/UIItemProvider_Private.h>
 #endif // ENABLE(DRAG_SUPPORT)
 
 #else
@@ -88,42 +84,10 @@ WTF_EXTERN_C_END
 - (BOOL)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token;
 @end
 
-#if ENABLE(DRAG_SUPPORT)
-
 @interface NSURL ()
 @property (nonatomic, copy, setter=_setTitle:) NSString *_title;
 @end
 
-#define UIItemProviderRepresentationOptionsVisibilityAll NSItemProviderRepresentationVisibilityAll
-
-@protocol UIItemProviderReading <NSItemProviderReading>
-
-@required
-- (instancetype)initWithItemProviderData:(NSData *)data typeIdentifier:(NSString *)typeIdentifier error:(NSError **)outError;
-
-@end
-
-@protocol UIItemProviderWriting <NSItemProviderWriting>
-
-@required
-- (NSProgress *)loadDataWithTypeIdentifier:(NSString *)typeIdentifier forItemProviderCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
-
-@end
-
-@interface NSAttributedString () <UIItemProviderReading, UIItemProviderWriting>
-@end
-@interface NSString () <UIItemProviderReading, UIItemProviderWriting>
-@end
-@interface NSURL () <UIItemProviderReading, UIItemProviderWriting>
-@end
-@interface UIImage () <UIItemProviderReading, UIItemProviderWriting>
-@end
-
-@interface UIItemProvider : NSItemProvider
-@end
-
-#endif
-
 @interface UIKeyboard : UIView
 @end