REGRESSION (r238635): Dragging a text selection within WKWebView causes the selection...
[WebKit-https.git] / Tools / TestWebKitAPI / cocoa / DragAndDropSimulator.h
index f3b1288..4fe0b84 100644 (file)
 #import <WebKit/_WKInputDelegate.h>
 #import <wtf/BlockPtr.h>
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 #import "UIKitSPI.h"
 #import <UIKit/NSItemProvider+UIKitAdditions.h>
 #endif
 
+#if PLATFORM(IOS_FAMILY)
+
 typedef NS_ENUM(NSInteger, DragAndDropPhase) {
     DragAndDropPhaseCancelled = 0,
     DragAndDropPhaseBeginning = 1,
@@ -45,8 +47,6 @@ typedef NS_ENUM(NSInteger, DragAndDropPhase) {
     DragAndDropPhasePerformingDrop = 4
 };
 
-#if PLATFORM(IOS)
-
 typedef NSDictionary<NSNumber *, NSValue *> *ProgressToCGPointValueMap;
 
 @interface MockDragDropSession : NSObject <UIDragDropSession> {
@@ -71,28 +71,32 @@ typedef NSDictionary<NSNumber *, NSValue *> *ProgressToCGPointValueMap;
 - (UIDragInteraction *)dragInteraction;
 @end
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(IOS_FAMILY)
 
 @interface DragAndDropSimulator : NSObject<WKUIDelegatePrivate, _WKInputDelegate>
 
-- (instancetype)initWithWebView:(TestWKWebView *)webView;
+- (instancetype)initWithWebViewFrame:(CGRect)frame;
+- (instancetype)initWithWebViewFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration;
 // The start location, end location, and locations of additional item requests are all in window coordinates.
 - (void)runFrom:(CGPoint)startLocation to:(CGPoint)endLocation;
+- (void)endDataTransfer;
+- (void)clearExternalDragInformation;
 @property (nonatomic, readonly) NSArray<_WKAttachment *> *insertedAttachments;
 @property (nonatomic, readonly) NSArray<_WKAttachment *> *removedAttachments;
-@property (nonatomic, readonly) DragAndDropPhase phase;
+@property (nonatomic, readonly) TestWKWebView *webView;
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
 
+- (instancetype)initWithWebView:(TestWKWebView *)webView;
 - (void)runFrom:(CGPoint)startLocation to:(CGPoint)endLocation additionalItemRequestLocations:(ProgressToCGPointValueMap)additionalItemRequestLocations;
-- (void)waitForInputSession;
-- (void)endDataTransfer;
+- (void)ensureInputSession;
 
+@property (nonatomic, readonly) DragAndDropPhase phase;
 @property (nonatomic) BOOL allowsFocusToStartInputSession;
 @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;
@@ -103,8 +107,25 @@ typedef NSDictionary<NSNumber *, NSValue *> *ProgressToCGPointValueMap;
 @property (nonatomic, readonly) NSArray *finalSelectionRects;
 @property (nonatomic, readonly) CGRect lastKnownDragCaretRect;
 @property (nonatomic, readonly) NSArray<UITargetedDragPreview *> *liftPreviews;
+@property (nonatomic, readonly) BOOL suppressedSelectionCommandsDuringDrop;
+
+#endif // PLATFORM(IOS_FAMILY)
+
+#if PLATFORM(MAC)
+
+@property (nonatomic, readonly) id <NSDraggingInfo> draggingInfo;
+@property (nonatomic, readonly) NSPoint initialDragImageLocationInView;
+@property (nonatomic, readonly) NSDragOperation currentDragOperation;
+@property (nonatomic, strong) NSPasteboard *externalDragPasteboard;
+@property (nonatomic, strong) NSImage *externalDragImage;
+@property (nonatomic, readonly) NSArray<NSURL *> *externalPromisedFiles;
+@property (nonatomic, copy) dispatch_block_t willEndDraggingHandler;
+
+- (void)writePromisedFiles:(NSArray<NSURL *> *)fileURLs;
+- (void)writeFiles:(NSArray<NSURL *> *)fileURLs;
+- (NSArray<NSURL *> *)receivePromisedFiles;
 
-#endif // PLATFORM(IOS)
+#endif // PLATFORM(MAC)
 
 @end