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