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