Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
[WebKit-https.git] / Source / WebKit / UIProcess / ios / WKContentViewInteraction.h
1 /*
2  * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #if PLATFORM(IOS_FAMILY)
27
28 #import "WKContentView.h"
29
30 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
31 #import "WKShareSheet.h"
32 #endif
33
34 #import "DragDropInteractionState.h"
35 #import "EditorState.h"
36 #import "FocusedElementInformation.h"
37 #import "GestureTypes.h"
38 #import "InteractionInformationAtPosition.h"
39 #import "TextCheckingController.h"
40 #import "UIKitSPI.h"
41 #import "WKActionSheetAssistant.h"
42 #import "WKAirPlayRoutePicker.h"
43 #import "WKFileUploadPanel.h"
44 #import "WKFormPeripheral.h"
45 #import "WKKeyboardScrollingAnimator.h"
46 #import "WKShareSheet.h"
47 #import "WKSyntheticTapGestureRecognizer.h"
48 #import "_WKFormInputSession.h"
49 #import <UIKit/UIView.h>
50 #import <WebCore/Color.h>
51 #import <WebCore/FloatQuad.h>
52 #import <wtf/BlockPtr.h>
53 #import <wtf/CompletionHandler.h>
54 #import <wtf/Forward.h>
55 #import <wtf/OptionSet.h>
56 #import <wtf/Vector.h>
57 #import <wtf/WeakObjCPtr.h>
58 #import <wtf/text/WTFString.h>
59
60 #if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WKInteractionPreviewAdditions.h>)
61 #import <WebKitAdditions/WKInteractionPreviewAdditions.h>
62 #else
63 #ifndef ADDITIONAL_LINK_PREVIEW_MEMBERS
64 #define ADDITIONAL_LINK_PREVIEW_MEMBERS
65 #endif
66 #ifndef ADDITIONAL_LINK_PREVIEW_PROTOCOLS
67 #define ADDITIONAL_LINK_PREVIEW_PROTOCOLS
68 #endif
69 #endif
70
71 namespace API {
72 class OpenPanelParameters;
73 }
74
75 namespace WTF {
76 class TextStream;
77 }
78
79 namespace WebCore {
80 class Color;
81 class FloatQuad;
82 class IntSize;
83 class SelectionRect;
84 struct PromisedAttachmentInfo;
85 struct ShareDataWithParsedURL;
86 enum class DOMPasteAccessResponse : uint8_t;
87 enum class RouteSharingPolicy : uint8_t;
88
89 #if ENABLE(DRAG_SUPPORT)
90 struct DragItem;
91 #endif
92 }
93
94 namespace WebKit {
95 class InputViewUpdateDeferrer;
96 class NativeWebTouchEvent;
97 class SmartMagnificationController;
98 class WebOpenPanelResultListenerProxy;
99 class WebPageProxy;
100 struct WebAutocorrectionContext;
101 }
102
103 @class _UILookupGestureRecognizer;
104 @class _UIHighlightView;
105 @class _UIWebHighlightLongPressGestureRecognizer;
106 @class UIHoverGestureRecognizer;
107 @class WebEvent;
108 @class WKActionSheetAssistant;
109 @class WKDrawingCoordinator;
110 @class WKFocusedFormControlView;
111 @class WKFormInputControl;
112 @class WKFormInputSession;
113 @class WKInspectorNodeSearchGestureRecognizer;
114
115 typedef void (^UIWKAutocorrectionCompletionHandler)(UIWKAutocorrectionRects *rectsForInput);
116 typedef void (^UIWKAutocorrectionContextHandler)(UIWKAutocorrectionContext *autocorrectionContext);
117 typedef void (^UIWKDictationContextHandler)(NSString *selectedText, NSString *beforeText, NSString *afterText);
118 typedef void (^UIWKSelectionCompletionHandler)(void);
119 typedef void (^UIWKSelectionWithDirectionCompletionHandler)(BOOL selectionEndIsMoving);
120
121 typedef BlockPtr<void(WebKit::InteractionInformationAtPosition)> InteractionInformationCallback;
122 typedef std::pair<WebKit::InteractionInformationRequest, InteractionInformationCallback> InteractionInformationRequestAndCallback;
123
124 #define FOR_EACH_WKCONTENTVIEW_ACTION(M) \
125     M(_addShortcut) \
126     M(_define) \
127     M(_lookup) \
128     M(_promptForReplace) \
129     M(_share) \
130     M(_showTextStyleOptions) \
131     M(_transliterateChinese) \
132     M(_nextAccessoryTab) \
133     M(_previousAccessoryTab) \
134     M(copy) \
135     M(cut) \
136     M(paste) \
137     M(replace) \
138     M(select) \
139     M(selectAll) \
140     M(toggleBoldface) \
141     M(toggleItalics) \
142     M(toggleUnderline) \
143     M(increaseSize) \
144     M(decreaseSize) \
145     M(pasteAndMatchStyle) \
146     M(makeTextWritingDirectionNatural) \
147     M(makeTextWritingDirectionLeftToRight) \
148     M(makeTextWritingDirectionRightToLeft)
149
150 #define FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(M) \
151     M(_alignCenter) \
152     M(_alignJustified) \
153     M(_alignLeft) \
154     M(_alignRight) \
155     M(_indent) \
156     M(_outdent) \
157     M(_toggleStrikeThrough) \
158     M(_insertOrderedList) \
159     M(_insertUnorderedList) \
160     M(_insertNestedOrderedList) \
161     M(_insertNestedUnorderedList) \
162     M(_increaseListLevel) \
163     M(_decreaseListLevel) \
164     M(_changeListType) \
165     M(_pasteAsQuotation) \
166     M(_pasteAndMatchStyle)
167
168 namespace WebKit {
169
170 enum SuppressSelectionAssistantReason : uint8_t {
171     EditableRootIsTransparentOrFullyClipped = 1 << 0,
172     FocusedElementIsTooSmall = 1 << 1,
173     DropAnimationIsRunning = 1 << 2
174 };
175
176 struct WKSelectionDrawingInfo {
177     enum class SelectionType { None, Plugin, Range };
178     WKSelectionDrawingInfo();
179     explicit WKSelectionDrawingInfo(const EditorState&);
180     SelectionType type;
181     WebCore::IntRect caretRect;
182     Vector<WebCore::SelectionRect> selectionRects;
183 };
184
185 WTF::TextStream& operator<<(WTF::TextStream&, const WKSelectionDrawingInfo&);
186
187 struct WKAutoCorrectionData {
188     String fontName;
189     CGFloat fontSize;
190     uint64_t fontTraits;
191     CGRect textFirstRect;
192     CGRect textLastRect;
193 };
194
195 }
196
197 @class WKFocusedElementInfo;
198 @protocol WKFormControl;
199
200 @interface WKFormInputSession : NSObject <_WKFormInputSession>
201
202 - (instancetype)initWithContentView:(WKContentView *)view focusedElementInfo:(WKFocusedElementInfo *)elementInfo requiresStrongPasswordAssistance:(BOOL)requiresStrongPasswordAssistance;
203 - (void)endEditing;
204 - (void)invalidate;
205
206 @end
207
208 @interface WKContentView () {
209     RetainPtr<UIWebTouchEventsGestureRecognizer> _touchEventGestureRecognizer;
210
211     BOOL _canSendTouchEventsAsynchronously;
212 #if ENABLE(POINTER_EVENTS)
213     BOOL _preventsPanningInXAxis;
214     BOOL _preventsPanningInYAxis;
215 #endif
216
217     RetainPtr<WKSyntheticTapGestureRecognizer> _singleTapGestureRecognizer;
218     RetainPtr<_UIWebHighlightLongPressGestureRecognizer> _highlightLongPressGestureRecognizer;
219     RetainPtr<UILongPressGestureRecognizer> _longPressGestureRecognizer;
220     RetainPtr<WKSyntheticTapGestureRecognizer> _doubleTapGestureRecognizer;
221     RetainPtr<UITapGestureRecognizer> _nonBlockingDoubleTapGestureRecognizer;
222     RetainPtr<UITapGestureRecognizer> _twoFingerDoubleTapGestureRecognizer;
223     RetainPtr<UITapGestureRecognizer> _twoFingerSingleTapGestureRecognizer;
224     RetainPtr<UITapGestureRecognizer> _stylusSingleTapGestureRecognizer;
225     RetainPtr<WKInspectorNodeSearchGestureRecognizer> _inspectorNodeSearchGestureRecognizer;
226
227 #if PLATFORM(IOSMAC)
228     RetainPtr<UIHoverGestureRecognizer> _hoverGestureRecognizer;
229     RetainPtr<_UILookupGestureRecognizer> _lookupGestureRecognizer;
230 #endif
231
232     RetainPtr<UIWKTextInteractionAssistant> _textSelectionAssistant;
233     OptionSet<WebKit::SuppressSelectionAssistantReason> _suppressSelectionAssistantReasons;
234
235     RetainPtr<UITextInputTraits> _traits;
236     RetainPtr<UIWebFormAccessory> _formAccessoryView;
237     RetainPtr<_UIHighlightView> _highlightView;
238     RetainPtr<UIView> _interactionViewsContainerView;
239     RetainPtr<NSString> _markedText;
240     RetainPtr<WKActionSheetAssistant> _actionSheetAssistant;
241 #if ENABLE(AIRPLAY_PICKER)
242     RetainPtr<WKAirPlayRoutePicker> _airPlayRoutePicker;
243 #endif
244     RetainPtr<WKFormInputSession> _formInputSession;
245     RetainPtr<WKFileUploadPanel> _fileUploadPanel;
246 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
247     RetainPtr<WKShareSheet> _shareSheet;
248 #endif
249     RetainPtr<UIGestureRecognizer> _previewGestureRecognizer;
250     RetainPtr<UIGestureRecognizer> _previewSecondaryGestureRecognizer;
251     Vector<bool> _focusStateStack;
252 #if HAVE(LINK_PREVIEW)
253     RetainPtr<UIPreviewItemController> _previewItemController;
254     ADDITIONAL_LINK_PREVIEW_MEMBERS
255 #endif
256
257     std::unique_ptr<WebKit::SmartMagnificationController> _smartMagnificationController;
258
259     WeakObjCPtr<id <UITextInputDelegate>> _inputDelegate;
260
261     uint64_t _latestTapID;
262     struct TapHighlightInformation {
263         BOOL nodeHasBuiltInClickHandling { false };
264         WebCore::Color color;
265         Vector<WebCore::FloatQuad> quads;
266         WebCore::IntSize topLeftRadius;
267         WebCore::IntSize topRightRadius;
268         WebCore::IntSize bottomLeftRadius;
269         WebCore::IntSize bottomRightRadius;
270     };
271     TapHighlightInformation _tapHighlightInformation;
272
273     WebKit::WKAutoCorrectionData _autocorrectionData;
274     WebKit::InteractionInformationAtPosition _positionInformation;
275     WebKit::FocusedElementInformation _focusedElementInformation;
276     RetainPtr<NSObject<WKFormPeripheral>> _inputPeripheral;
277 #if !USE(UIKIT_KEYBOARD_ADDITIONS)
278     RetainPtr<UIEvent> _uiEventBeingResent;
279 #endif
280     BlockPtr<void(::WebEvent *, BOOL)> _keyWebEventHandler;
281
282     CGPoint _lastInteractionLocation;
283     uint64_t _layerTreeTransactionIdAtLastTouchStart;
284
285     WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo;
286
287     Optional<WebKit::InteractionInformationRequest> _outstandingPositionInformationRequest;
288
289     uint64_t _positionInformationCallbackDepth;
290     Vector<Optional<InteractionInformationRequestAndCallback>> _pendingPositionInformationHandlers;
291     
292     std::unique_ptr<WebKit::InputViewUpdateDeferrer> _inputViewUpdateDeferrer;
293
294     RetainPtr<WKKeyboardScrollViewAnimator> _keyboardScrollingAnimator;
295
296 #if ENABLE(DATALIST_ELEMENT)
297     RetainPtr<UIView <WKFormControl>> _dataListTextSuggestionsInputView;
298     RetainPtr<NSArray<UITextSuggestion *>> _dataListTextSuggestions;
299 #endif
300
301 #if HAVE(PENCILKIT)
302     RetainPtr<WKDrawingCoordinator> _drawingCoordinator;
303 #endif
304
305     BOOL _isEditable;
306     BOOL _showingTextStyleOptions;
307     BOOL _hasValidPositionInformation;
308     BOOL _isTapHighlightIDValid;
309     BOOL _potentialTapInProgress;
310     BOOL _isDoubleTapPending;
311     BOOL _highlightLongPressCanClick;
312     BOOL _hasTapHighlightForPotentialTap;
313     BOOL _selectionNeedsUpdate;
314     BOOL _shouldRestoreSelection;
315     BOOL _usingGestureForSelection;
316     BOOL _inspectorNodeSearchEnabled;
317     BOOL _isChangingFocusUsingAccessoryTab;
318     BOOL _didAccessoryTabInitiateFocus;
319     BOOL _isExpectingFastSingleTapCommit;
320     BOOL _showDebugTapHighlightsForFastClicking;
321     BOOL _isZoomingToRevealFocusedElement;
322
323     BOOL _keyboardDidRequestDismissal;
324
325     BOOL _becomingFirstResponder;
326     BOOL _resigningFirstResponder;
327     BOOL _needsDeferredEndScrollingSelectionUpdate;
328     BOOL _isChangingFocus;
329     BOOL _isBlurringFocusedElement;
330
331     BOOL _focusRequiresStrongPasswordAssistance;
332
333     BOOL _hasSetUpInteractions;
334     NSUInteger _ignoreSelectionCommandFadeCount;
335     CompletionHandler<void(WebCore::DOMPasteAccessResponse)> _domPasteRequestHandler;
336     BlockPtr<void(UIWKAutocorrectionContext *)> _pendingAutocorrectionContextHandler;
337
338 #if ENABLE(DATA_INTERACTION)
339     WebKit::DragDropInteractionState _dragDropInteractionState;
340     RetainPtr<UIDragInteraction> _dragInteraction;
341     RetainPtr<UIDropInteraction> _dropInteraction;
342     BOOL _shouldRestoreCalloutBarAfterDrop;
343     BOOL _isAnimatingConcludeEditDrag;
344     RetainPtr<UIView> _visibleContentViewSnapshot;
345     RetainPtr<_UITextDragCaretView> _editDropCaretView;
346 #endif
347
348 #if PLATFORM(WATCHOS)
349     RetainPtr<WKFocusedFormControlView> _focusedFormControlView;
350     RetainPtr<UIViewController> _presentedFullScreenInputViewController;
351     RetainPtr<UINavigationController> _inputNavigationViewControllerForFullScreenInputs;
352
353     BOOL _shouldRestoreFirstResponderStatusAfterLosingFocus;
354     BlockPtr<void()> _activeFocusedStateRetainBlock;
355 #endif
356
357 #if ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING)
358     std::unique_ptr<WebKit::TextCheckingController> _textCheckingController;
359 #endif
360 }
361
362 @end
363
364 @interface WKContentView (WKInteraction) <UIGestureRecognizerDelegate, UITextAutoscrolling, UITextInputMultiDocument, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWebTouchEventsGestureRecognizerDelegate, UIWKInteractionViewProtocol, WKActionSheetAssistantDelegate, WKFileUploadPanelDelegate, WKKeyboardScrollViewAnimatorDelegate
365 #if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
366     , WKShareSheetDelegate
367 #endif
368 #if ENABLE(DATA_INTERACTION)
369     , UIDragInteractionDelegate, UIDropInteractionDelegate
370 #endif
371 >
372
373 @property (nonatomic, readonly) CGPoint lastInteractionLocation;
374 @property (nonatomic, readonly) BOOL isEditable;
375 @property (nonatomic, readonly) BOOL shouldHideSelectionWhenScrolling;
376 @property (nonatomic, readonly) const WebKit::InteractionInformationAtPosition& positionInformation;
377 @property (nonatomic, readonly) const WebKit::WKAutoCorrectionData& autocorrectionData;
378 @property (nonatomic, readonly) const WebKit::FocusedElementInformation& focusedElementInformation;
379 @property (nonatomic, readonly) UIWebFormAccessory *formAccessoryView;
380 @property (nonatomic, readonly) UITextInputAssistantItem *inputAssistantItemForWebView;
381 #if ENABLE(POINTER_EVENTS)
382 @property (nonatomic, readonly) BOOL preventsPanningInXAxis;
383 @property (nonatomic, readonly) BOOL preventsPanningInYAxis;
384 #endif
385
386 #if ENABLE(DATALIST_ELEMENT)
387 @property (nonatomic, strong) UIView <WKFormControl> *dataListTextSuggestionsInputView;
388 @property (nonatomic, strong) NSArray<UITextSuggestion *> *dataListTextSuggestions;
389 #endif
390
391 - (void)setupInteraction;
392 - (void)cleanupInteraction;
393
394 - (void)scrollViewWillStartPanOrPinchGesture;
395
396 - (BOOL)canBecomeFirstResponderForWebView;
397 - (BOOL)becomeFirstResponderForWebView;
398 - (BOOL)resignFirstResponderForWebView;
399 - (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender;
400 - (id)targetForActionForWebView:(SEL)action withSender:(id)sender;
401
402 #if ENABLE(POINTER_EVENTS)
403 - (void)cancelPointersForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
404 #endif
405
406 #define DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW(_action) \
407     - (void)_action ## ForWebView:(id)sender;
408 FOR_EACH_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
409 FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
410 #undef DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW
411
412 - (void)_setFontForWebView:(UIFont *)fontFamily sender:(id)sender;
413 - (void)_setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender;
414 - (void)_setTextColorForWebView:(UIColor *)color sender:(id)sender;
415
416 #if ENABLE(TOUCH_EVENTS)
417 - (void)_webTouchEvent:(const WebKit::NativeWebTouchEvent&)touchEvent preventsNativeGestures:(BOOL)preventsDefault;
418 #endif
419 - (void)_commitPotentialTapFailed;
420 - (void)_didNotHandleTapAsClick:(const WebCore::IntPoint&)point;
421 - (void)_didCompleteSyntheticClick;
422 - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const WebCore::Color&)color quads:(const Vector<WebCore::FloatQuad>&)highlightedQuads topLeftRadius:(const WebCore::IntSize&)topLeftRadius topRightRadius:(const WebCore::IntSize&)topRightRadius bottomLeftRadius:(const WebCore::IntSize&)bottomLeftRadius bottomRightRadius:(const WebCore::IntSize&)bottomRightRadius nodeHasBuiltInClickHandling:(BOOL)nodeHasBuiltInClickHandling;
423
424 - (BOOL)_mayDisableDoubleTapGesturesDuringSingleTap;
425 - (void)_disableDoubleTapGesturesDuringTapIfNecessary:(uint64_t)requestID;
426 - (void)_handleSmartMagnificationInformationForPotentialTap:(uint64_t)requestID renderRect:(const WebCore::FloatRect&)renderRect fitEntireRect:(BOOL)fitEntireRect viewportMinimumScale:(double)viewportMinimumScale viewportMaximumScale:(double)viewportMaximumScale;
427 - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject;
428 - (void)_elementDidBlur;
429 - (void)_didUpdateInputMode:(WebCore::InputMode)mode;
430 - (void)_didReceiveEditorStateUpdateAfterFocus;
431 - (void)_hardwareKeyboardAvailabilityChanged;
432 - (void)_selectionChanged;
433 - (void)_updateChangedSelection;
434 - (BOOL)_interpretKeyEvent:(::WebEvent *)theEvent isCharEvent:(BOOL)isCharEvent;
435 - (void)_positionInformationDidChange:(const WebKit::InteractionInformationAtPosition&)info;
436 - (void)_attemptClickAtLocation:(CGPoint)location modifierFlags:(UIKeyModifierFlags)modifierFlags;
437 - (void)_willStartScrollingOrZooming;
438 - (void)_didScroll;
439 - (void)_didEndScrollingOrZooming;
440 - (void)_scrollingNodeScrollingWillBegin;
441 - (void)_scrollingNodeScrollingDidEnd;
442 - (void)_showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(const WebCore::IntRect&)elementRect routeSharingPolicy:(WebCore::RouteSharingPolicy)policy routingContextUID:(NSString *)contextUID;
443 - (void)_showRunOpenPanel:(API::OpenPanelParameters*)parameters resultListener:(WebKit::WebOpenPanelResultListenerProxy*)listener;
444 - (void)_showShareSheet:(const WebCore::ShareDataWithParsedURL&)shareData inRect:(WTF::Optional<WebCore::FloatRect>)rect completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler;
445 - (void)dismissFilePicker;
446 - (void)_didHandleKeyEvent:(::WebEvent *)event eventWasHandled:(BOOL)eventWasHandled;
447 - (Vector<WebKit::OptionItem>&) focusedSelectElementOptions;
448 - (void)_enableInspectorNodeSearch;
449 - (void)_disableInspectorNodeSearch;
450 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler;
451 - (void)_setDoubleTapGesturesEnabled:(BOOL)enabled;
452 #if ENABLE(DATA_DETECTION)
453 - (NSArray *)_dataDetectionResults;
454 #endif
455 - (NSArray<NSValue *> *)_uiTextSelectionRects;
456 - (void)accessibilityRetrieveSpeakSelectionContent;
457 - (void)_accessibilityRetrieveRectsEnclosingSelectionOffset:(NSInteger)offset withGranularity:(UITextGranularity)granularity;
458 - (void)_accessibilityRetrieveRectsAtSelectionOffset:(NSInteger)offset withText:(NSString *)text completionHandler:(void (^)(const Vector<WebCore::SelectionRect>& rects))completionHandler;
459 - (void)_accessibilityRetrieveRectsAtSelectionOffset:(NSInteger)offset withText:(NSString *)text;
460 - (void)_accessibilityStoreSelection;
461 - (void)_accessibilityClearSelection;
462 - (WKFormInputSession *)_formInputSession;
463 - (void)_didChangeWebViewEditability;
464
465 - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction;
466
467 // UIWebFormAccessoryDelegate protocol
468 - (void)accessoryDone;
469
470 - (void)accessoryOpen;
471
472 - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;
473
474 @property (nonatomic, readonly) WebKit::InteractionInformationAtPosition currentPositionInformation;
475 - (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request;
476 - (BOOL)ensurePositionInformationIsUpToDate:(WebKit::InteractionInformationRequest)request;
477
478 #if ENABLE(DATA_INTERACTION)
479 - (void)_didChangeDragInteractionPolicy;
480 - (void)_didPerformDragOperation:(BOOL)handled;
481 - (void)_didHandleDragStartRequest:(BOOL)started;
482 - (void)_didHandleAdditionalDragItemsRequest:(BOOL)added;
483 - (void)_startDrag:(RetainPtr<CGImageRef>)image item:(const WebCore::DragItem&)item;
484 - (void)_didConcludeEditDrag:(Optional<WebCore::TextIndicatorData>)data;
485 - (void)_didChangeDragCaretRect:(CGRect)previousRect currentRect:(CGRect)rect;
486 #endif
487
488 - (void)reloadContextViewForPresentedListViewController;
489
490 #if ENABLE(DATALIST_ELEMENT)
491 - (void)updateTextSuggestionsForInputDelegate;
492 #endif
493
494 #if HAVE(PENCILKIT)
495 - (WKDrawingCoordinator *)_drawingCoordinator;
496 #endif
497
498 - (void)_handleAutocorrectionContext:(const WebKit::WebAutocorrectionContext&)context;
499
500 @end
501
502 @interface WKContentView (WKTesting)
503
504 - (void)_simulateLongPressActionAtLocation:(CGPoint)location;
505 - (void)_simulateTextEntered:(NSString *)text;
506 - (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
507 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
508 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem;
509
510 @property (nonatomic, readonly) NSString *textContentTypeForTesting;
511 @property (nonatomic, readonly) NSString *selectFormPopoverTitle;
512 @property (nonatomic, readonly) NSString *formInputLabel;
513 @property (nonatomic, readonly) WKFormInputControl *formInputControl;
514
515 @end
516
517 #if HAVE(LINK_PREVIEW)
518 @interface WKContentView (WKInteractionPreview) <UIPreviewItemDelegate ADDITIONAL_LINK_PREVIEW_PROTOCOLS>
519
520 @property (nonatomic, readonly) BOOL shouldUsePreviewForLongPress;
521
522 - (void)_registerPreview;
523 - (void)_unregisterPreview;
524
525 @end
526 #endif
527
528 @interface WKContentView (WKFileUploadPanel)
529 + (Class)_fileUploadPanelClass;
530 @end
531
532 #endif // PLATFORM(IOS_FAMILY)