[iOS] Hook up WebPlatformTouchPoint's radiusX / radiusY to _UIWebTouchPoint.majorRadi...
[WebKit-https.git] / Source / WebKit2 / Platform / spi / ios / UIKitSPI.h
1 /*
2  * Copyright (C) 2014-2016 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 #import <UIKit/UIKit.h>
27
28 #if USE(APPLE_INTERNAL_SDK)
29
30 #import <UIKit/UIAlertController_Private.h>
31 #import <UIKit/UIApplication_Private.h>
32 #import <UIKit/UIBarButtonItem_Private.h>
33 #import <UIKit/UIDatePicker_Private.h>
34 #import <UIKit/UIDevice_Private.h>
35 #import <UIKit/UIDocumentMenuViewController_Private.h>
36 #import <UIKit/UIDocumentPasswordView.h>
37 #import <UIKit/UIFont_Private.h>
38 #import <UIKit/UIGeometry_Private.h>
39 #import <UIKit/UIGestureRecognizer_Private.h>
40 #import <UIKit/UIImagePickerController_Private.h>
41 #import <UIKit/UIImage_Private.h>
42 #import <UIKit/UIInterface_Private.h>
43 #import <UIKit/UIKeyboardImpl.h>
44 #import <UIKit/UIKeyboardIntl.h>
45 #import <UIKit/UIKeyboard_Private.h>
46 #import <UIKit/UILongPressGestureRecognizer_Private.h>
47 #import <UIKit/UIPeripheralHost.h>
48 #import <UIKit/UIPeripheralHost_Private.h>
49 #import <UIKit/UIPickerContentView_Private.h>
50 #import <UIKit/UIPickerView_Private.h>
51 #import <UIKit/UIPresentationController_Private.h>
52 #import <UIKit/UIResponder_Private.h>
53 #import <UIKit/UIScrollView_Private.h>
54 #import <UIKit/UIStringDrawing_Private.h>
55 #import <UIKit/UITableViewCell_Private.h>
56 #import <UIKit/UITapGestureRecognizer_Private.h>
57 #import <UIKit/UITextInput_Private.h>
58 #import <UIKit/UITextInteractionAssistant_Private.h>
59 #import <UIKit/UIViewControllerTransitioning_Private.h>
60 #import <UIKit/UIViewController_Private.h>
61 #import <UIKit/UIViewController_ViewService.h>
62 #import <UIKit/UIView_Private.h>
63 #import <UIKit/UIWKSelectionAssistant.h>
64 #import <UIKit/UIWKTextInteractionAssistant.h>
65 #import <UIKit/UIWebBrowserView.h>
66 #import <UIKit/UIWebDocumentView.h>
67 #import <UIKit/UIWebFormAccessory.h>
68 #import <UIKit/UIWebGeolocationPolicyDecider.h>
69 #import <UIKit/UIWebScrollView.h>
70 #import <UIKit/UIWebTiledView.h>
71 #import <UIKit/UIWebTouchEventsGestureRecognizer.h>
72 #import <UIKit/UIWindow_Private.h>
73 #import <UIKit/_UIBackdropView_Private.h>
74 #import <UIKit/_UIHighlightView.h>
75 #import <UIKit/_UINavigationInteractiveTransition.h>
76 #import <UIKit/_UINavigationParallaxTransition.h>
77
78 #if HAVE(LINK_PREVIEW)
79 #import <UIKit/UIPreviewItemController.h>
80 #endif
81
82 #else
83
84 #if HAVE(LINK_PREVIEW)
85 typedef NS_ENUM(NSInteger, UIPreviewItemType) {
86     UIPreviewItemTypeNone,
87     UIPreviewItemTypeClientCustom,
88     UIPreviewItemTypeLink,
89     UIPreviewItemTypeImage,
90     UIPreviewItemTypeText,
91     UIPreviewItemTypeAttachment,
92 };
93
94 @class UIPreviewItemController;
95
96 @protocol UIPreviewItemDelegate <NSObject>
97 - (NSDictionary *)_dataForPreviewItemController:(UIPreviewItemController *)controller atPosition:(CGPoint)position type:(UIPreviewItemType *)type;
98 @optional
99 - (BOOL)_interactionShouldBeginFromPreviewItemController:(UIPreviewItemController *)controller forPosition:(CGPoint)position;
100 - (void)_interactionStartedFromPreviewItemController:(UIPreviewItemController *)controller;
101 - (void)_interactionStoppedFromPreviewItemController:(UIPreviewItemController *)controller;
102 - (UIViewController *)_presentedViewControllerForPreviewItemController:(UIPreviewItemController *)controller;
103 - (void)_previewItemController:(UIPreviewItemController *)controller didDismissPreview:(UIViewController *)viewController committing:(BOOL)committing;
104 - (void)_previewItemController:(UIPreviewItemController *)controller commitPreview:(UIViewController *)viewController;
105 - (void)_previewItemControllerDidCancelPreview:(UIPreviewItemController *)controller;
106 - (UIImage *)_presentationSnapshotForPreviewItemController:(UIPreviewItemController *)controller;
107 - (NSArray *)_presentationRectsForPreviewItemController:(UIPreviewItemController *)controller;
108 - (CGRect)_presentationRectForPreviewItemController:(UIPreviewItemController *)controller;
109 @end
110
111 @interface UIPreviewItemController : NSObject
112 - (instancetype)initWithView:(UIView *)view;
113 @property (assign, nonatomic) id<UIPreviewItemDelegate> delegate;
114 @property (assign, nonatomic, readonly) UIPreviewItemType type;
115 @property (strong, nonatomic, readonly) NSDictionary *previewData;
116 @property (strong, nonatomic, readonly) UIGestureRecognizer *presentationGestureRecognizer;
117 @property (strong, nonatomic, readonly) UIGestureRecognizer *presentationSecondaryGestureRecognizer;
118 @end
119 #endif
120
121 @interface UIAlertController ()
122 - (void)_addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(void))handler;
123 - (void)_addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(void))handler shouldDismissHandler:(BOOL (^)(void))shouldDismissHandler;
124 @property (nonatomic) UIAlertControllerStyle preferredStyle;
125 @end
126
127 @interface UIApplication ()
128 - (UIInterfaceOrientation)interfaceOrientation;
129 - (void)_cancelAllTouches;
130 - (CGFloat)statusBarHeight;
131 - (BOOL)isSuspendedUnderLock;
132 @end
133
134 typedef NS_ENUM(NSInteger, UIDatePickerPrivateMode)  {
135     UIDatePickerModeYearAndMonth = 4269,
136 };
137
138 @interface UIDatePicker ()
139 @property (nonatomic, readonly, getter=_contentWidth) CGFloat contentWidth;
140 @end
141
142 #define UICurrentUserInterfaceIdiomIsPad() ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
143
144 @interface UIDevice ()
145 @property (nonatomic, readonly, retain) NSString *buildVersion;
146 @end
147
148 typedef enum {
149     kUIKeyboardInputRepeat                 = 1 << 0,
150     kUIKeyboardInputPopupVariant           = 1 << 1,
151     kUIKeyboardInputMultitap               = 1 << 2,
152     kUIKeyboardInputSkipCandidateSelection = 1 << 3,
153     kUIKeyboardInputDeadKey                = 1 << 4,
154     kUIKeyboardInputModifierFlagsChanged   = 1 << 5,
155     kUIKeyboardInputFlick                  = 1 << 6,
156     kUIKeyboardInputPreProcessed           = 1 << 7,
157 } UIKeyboardInputFlags;
158
159 @interface UIEvent ()
160 @property (nonatomic, readonly) UIKeyboardInputFlags _inputFlags;
161 - (void *)_hidEvent;
162 - (NSString *)_unmodifiedInput;
163 - (NSString *)_modifiedInput;
164 - (NSInteger)_modifierFlags;
165 - (BOOL)_isKeyDown;
166 @end
167
168 typedef enum {
169     UIFontTraitPlain = 0x00000000,
170 } UIFontTrait;
171
172 @interface UIFont ()
173 + (UIFont *)fontWithFamilyName:(NSString *)familyName traits:(UIFontTrait)traits size:(CGFloat)fontSize;
174 @end
175
176 typedef enum {
177     UIAllCorners = 0xFF,
178 } UIRectCorners;
179
180 @interface UIImagePickerController ()
181 @property (nonatomic, setter=_setAllowsMultipleSelection:) BOOL _allowsMultipleSelection;
182 @end
183
184 @interface UIImage ()
185 - (id)initWithCGImage:(CGImageRef)CGImage imageOrientation:(UIImageOrientation)imageOrientation;
186 @end
187
188 @interface UIKeyCommand ()
189 @property (nonatomic, readonly) UIEvent *_triggeringEvent;
190 @end
191
192 @protocol UIKeyboardImplGeometryDelegate
193 @property (nonatomic, readwrite, getter=isMinimized) BOOL minimized;
194 - (void)prepareForImplBoundsHeightChange:(CGFloat)endDelta suppressNotification:(BOOL)suppressNotification;
195 - (void)implBoundsHeightChangeDone:(CGFloat)endDelta suppressNotification:(BOOL)suppressNotification;
196 - (BOOL)shouldSaveMinimizationState;
197 - (BOOL)canDismiss;
198 - (BOOL)isActive;
199 @end
200
201 @protocol UIKeyboardCandidateListDelegate <NSObject>
202 @optional
203 - (void)setCandidateList:(id)candidateList updateCandidateView:(BOOL)updateCandidateView;
204 - (void)candidateListAcceptCandidate:(id)candidateList;
205 - (void)candidateListSelectionDidChange:(id)candidateList;
206 - (void)candidateListShouldBeDismissed:(id)candidateList;
207 @end
208
209 @interface UIKeyboard : UIView <UIKeyboardImplGeometryDelegate>
210 @end
211
212 @interface UIKeyboard ()
213 + (CGSize)defaultSizeForInterfaceOrientation:(UIInterfaceOrientation)orientation;
214 - (void)activate;
215 - (void)geometryChangeDone:(BOOL)keyboardVisible;
216 - (void)prepareForGeometryChange;
217 @end
218
219 @interface UIKeyboardImpl : UIView <UIKeyboardCandidateListDelegate>
220 @end
221
222 @interface UIKeyboardImpl ()
223 + (UIKeyboardImpl *)activeInstance;
224 + (UIKeyboardImpl *)sharedInstance;
225 + (CGSize)defaultSizeForInterfaceOrientation:(UIInterfaceOrientation)orientation;
226 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags;
227 - (void)addInputString:(NSString *)string withFlags:(NSUInteger)flags withInputManagerHint:(NSString *)hint;
228 - (BOOL)autocorrectSpellingEnabled;
229 - (void)deleteFromInput;
230 - (void)deleteFromInputWithFlags:(NSUInteger)flags;
231 - (void)replaceText:(id)replacement;
232 @property (nonatomic, readwrite, retain) UIResponder <UIKeyInput> *delegate;
233 @end
234
235 @interface UIGestureRecognizer ()
236 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90200
237 @property(nonatomic, copy) NSArray<NSNumber *> *allowedTouchTypes;
238 #endif
239 @end
240
241 @interface UILongPressGestureRecognizer ()
242 @property (nonatomic) CFTimeInterval delay;
243 @property (nonatomic, readonly) CGPoint startPoint;
244 @property (nonatomic, assign, setter=_setRequiresQuietImpulse:) BOOL _requiresQuietImpulse;
245 @end
246
247 @interface _UIWebHighlightLongPressGestureRecognizer : UILongPressGestureRecognizer
248 @end
249
250 @interface _UIWebHighlightLongPressGestureRecognizer ()
251 - (void)cancel;
252 @end
253
254 @interface UIPeripheralHost : NSObject <UIGestureRecognizerDelegate>
255 @end
256
257 @class UIKeyboardRotationState;
258
259 @interface UIPeripheralHost ()
260 + (UIPeripheralHost *)sharedInstance;
261 + (UIPeripheralHost *)activeInstance;
262 + (CGRect)visiblePeripheralFrame;
263 - (BOOL)isOnScreen;
264 - (UIKeyboardRotationState *)rotationState;
265 @end
266
267 @interface UIPickerContentView : UIView
268 @end
269
270 @interface UIPickerContentView ()
271 +(CGFloat)_checkmarkOffset;
272 -(CGFloat)labelWidthForBounds:(CGRect)bounds;
273 @property (nonatomic, getter=isChecked) BOOL checked;
274 @property (nonatomic, readonly) UILabel *titleLabel;
275 @end
276
277 @interface UIPickerView ()
278 + (CGSize)defaultSizeForCurrentOrientation;
279 - (void)_setUsesCheckedSelection:(BOOL)usesCheckedSelection;
280 @property (nonatomic, setter=_setMagnifierEnabled:) BOOL _magnifierEnabled;
281 @end
282
283 @interface UIResponder ()
284 - (void)_handleKeyUIEvent:(UIEvent *)event;
285 @end
286
287 @class CADisplay;
288 @interface UIScreen ()
289 - (CADisplay *)_display;
290 @end
291
292 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90100
293 typedef enum {
294     UITouchTypeDirect
295 } UITouchType;
296
297 @interface UITouch ()
298 @property(nonatomic,readonly) UITouchType type;
299 @end
300 #endif
301
302 @interface UIScrollView ()
303 - (void)_stopScrollingAndZoomingAnimations;
304 - (void)_zoomToCenter:(CGPoint)center scale:(CGFloat)scale duration:(CFTimeInterval)duration force:(BOOL)force;
305 - (void)_zoomToCenter:(CGPoint)center scale:(CGFloat)scale duration:(CFTimeInterval)duration;
306 @property (nonatomic, getter=isZoomEnabled) BOOL zoomEnabled;
307 @property (nonatomic, readonly, getter=_isAnimatingZoom) BOOL isAnimatingZoom;
308 @property (nonatomic, readonly, getter=_isAnimatingScroll) BOOL isAnimatingScroll;
309 @property (nonatomic) CGFloat horizontalScrollDecelerationFactor;
310 @property (nonatomic) CGFloat verticalScrollDecelerationFactor;
311 @end
312
313 @interface NSString (UIKitDetails)
314 - (CGSize)_legacy_sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode;
315 - (CGSize)_legacy_sizeWithFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode;
316 @end
317
318 @interface UITapGestureRecognizer ()
319 @property (nonatomic, getter=_allowableSeparation, setter=_setAllowableSeparation:) CGFloat allowableSeparation; 
320 @property (nonatomic, readonly) CGPoint location;
321 @property (nonatomic) CGFloat allowableMovement;
322 @property (nonatomic, readonly) CGPoint centroid;
323 @end
324
325 @class WebEvent;
326
327 typedef enum {
328     UITextShortcutConversionTypeDefault = 0,
329     UITextShortcutConversionTypeNo = 1,
330     UITextShortcutConversionTypeYes = 2,
331 } UITextShortcutConversionType;
332
333 @protocol UITextInputTraits_Private <NSObject, UITextInputTraits>
334 - (void)takeTraitsFrom:(id <UITextInputTraits>)traits;
335 @optional
336 @property (nonatomic) UITextShortcutConversionType shortcutConversionType;
337 @end
338
339 @class UITextInputArrowKeyHistory;
340
341 @protocol UITextInputPrivate <UITextInput, UITextInputTokenizer, UITextInputTraits_Private>
342 @optional
343 - (BOOL)requiresKeyEvents;
344 - (NSArray *)metadataDictionariesForDictationResults;
345 - (UIColor *)textColorForCaretSelection;
346 - (UIFont *)fontForCaretSelection;
347 - (UIView *)automaticallySelectedOverlay;
348 - (void)handleKeyWebEvent:(WebEvent *)event;
349 - (void)insertDictationResult:(NSArray *)dictationResult withCorrectionIdentifier:(id)correctionIdentifier;
350 - (void)replaceRangeWithTextWithoutClosingTyping:(UITextRange *)range replacementText:(NSString *)text;
351 - (void)setBottomBufferHeight:(CGFloat)bottomBuffer;
352 @property (nonatomic) UITextGranularity selectionGranularity;
353 @required
354 - (BOOL)hasContent;
355 - (BOOL)hasSelection;
356 - (void)selectAll;
357 @end
358
359 @interface UITextInputTraits : NSObject <UITextInputTraits, UITextInputTraits_Private, NSCopying>
360 @end
361
362 @interface UITextInteractionAssistant : NSObject
363 @end
364
365 @interface UITextInteractionAssistant ()
366 - (void)activateSelection;
367 - (void)deactivateSelection;
368 - (void)didEndScrollingOverflow;
369 - (void)selectionChanged;
370 - (void)setGestureRecognizers;
371 - (void)willStartScrollingOverflow;
372 @end
373
374 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
375 @class UITextSuggestion;
376
377 @protocol UITextInputSuggestionDelegate <UITextInputDelegate>
378 - (void)setSuggestions:(NSArray <UITextSuggestion*> *)suggestions;
379 @end
380 #endif
381
382 @interface UIViewController ()
383 + (UIViewController *)_viewControllerForFullScreenPresentationFromView:(UIView *)view;
384 + (UIViewController *)viewControllerForView:(UIView *)view;
385 @end
386
387 @interface UIViewController (ViewService)
388 - (pid_t)_hostProcessIdentifier;
389 @end
390
391 @protocol UIViewControllerContextTransitioningEx <UIViewControllerContextTransitioning>
392 - (void)__runAlongsideAnimations;
393 - (void)_interactivityDidChange:(BOOL)isInteractive;
394 @property (nonatomic, assign, setter=_setAllowUserInteraction:, getter=_allowUserInteraction) BOOL _allowUserInteraction;
395 @property (nonatomic, assign, setter=_setPercentOffset:) CGFloat _percentOffset;
396 @property (nonatomic, retain, setter=_setContainerViews:) NSArray *_containerViews;
397 @end
398
399 @interface _UIViewControllerTransitionContext : NSObject <UIViewControllerContextTransitioningEx>
400 @end
401
402 // FIXME: Separate the parts we are simply re-declaring from the ones we are overriding.
403 @interface _UIViewControllerTransitionContext (Details)
404 - (void) _setTransitionIsInFlight:(BOOL)flag;
405 @property (nonatomic, assign, setter=_setAllowUserInteraction:, getter=_allowUserInteraction) BOOL _allowUserInteraction;
406 @property (nonatomic, assign, setter=_setAnimator:) id <UIViewControllerAnimatedTransitioning> _animator;
407 @property (nonatomic, assign, setter=_setContainerView:) UIView *containerView;
408 @property (nonatomic, assign, setter=_setInteractor:) id <UIViewControllerInteractiveTransitioning> _interactor;
409 @property (nonatomic, assign, setter=_setPercentOffset:) CGFloat _percentOffset;
410 @property (nonatomic, copy, setter=_setCompletionHandler:)  void (^_completionHandler)(_UIViewControllerTransitionContext *context, BOOL transitionCompleted);
411 @property (nonatomic, retain, setter=_setContainerViews:) NSArray *_containerViews;
412 @end
413
414 @interface _UIViewControllerOneToOneTransitionContext : _UIViewControllerTransitionContext
415 @end
416
417 @interface _UIViewControllerOneToOneTransitionContext ()
418 @property (nonatomic, assign, setter=_setFromEndFrame:) CGRect fromEndFrame;
419 @property (nonatomic, assign, setter=_setFromStartFrame:) CGRect fromStartFrame;
420 @property (nonatomic, assign, setter=_setToEndFrame:) CGRect toEndFrame;
421 @property (nonatomic, assign, setter=_setToStartFrame:) CGRect toStartFrame;
422 @property (nonatomic, retain, setter=_setFromViewController:) UIViewController *fromViewController;
423 @property (nonatomic, retain, setter=_setToViewController:) UIViewController *toViewController;
424 @end
425
426 @protocol UIViewControllerAnimatedTransitioningEx <UIViewControllerAnimatedTransitioning>
427 - (BOOL)interactionAborted;
428 - (UINavigationControllerOperation) operation;
429 - (UIPercentDrivenInteractiveTransition *)interactionController;
430 - (void)setInteractionAborted:(BOOL)aborted;
431 - (void)setInteractionController:(UIPercentDrivenInteractiveTransition *)controller;
432 - (void)setOperation:(UINavigationControllerOperation)operation;
433 @optional
434 - (UIWindow *)window;
435 @end
436
437 typedef NS_ENUM (NSInteger, _UIBackdropMaskViewFlags) {
438     _UIBackdropMaskViewNone = 0,
439     _UIBackdropMaskViewGrayscaleTint = 1 << 0,
440     _UIBackdropMaskViewColorTint = 1 << 1,
441     _UIBackdropMaskViewFilters = 1 << 2,
442     _UIBackdropMaskViewAll = _UIBackdropMaskViewGrayscaleTint | _UIBackdropMaskViewColorTint | _UIBackdropMaskViewFilters,
443 };
444
445 @interface UIView ()
446 + (BOOL)_isInAnimationBlock;
447 - (CGSize)size;
448 - (void)setFrameOrigin:(CGPoint)origin;
449 - (void)setSize:(CGSize)size;
450 @property (nonatomic, assign, setter=_setBackdropMaskViewFlags:) NSInteger _backdropMaskViewFlags;
451 @end
452
453 @interface UIWebSelectionAssistant : NSObject <UIGestureRecognizerDelegate>
454 @end
455
456 @interface UIWebSelectionAssistant ()
457 - (BOOL)isSelectionGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
458 - (id)initWithView:(UIView *)view;
459 - (void)clearSelection;
460 - (void)didEndScrollingOrZoomingPage;
461 - (void)didEndScrollingOverflow;
462 - (void)resignedFirstResponder;
463 - (void)selectionChanged;
464 - (void)setGestureRecognizers;
465 - (void)willStartScrollingOrZoomingPage;
466 - (void)willStartScrollingOverflow;
467 @property (nonatomic, readonly) CGRect selectionFrame;
468 @end
469
470 typedef NS_ENUM(NSInteger, UIWKSelectionTouch) {
471     UIWKSelectionTouchStarted = 0,
472     UIWKSelectionTouchMoved = 1,
473     UIWKSelectionTouchEnded = 2,
474     UIWKSelectionTouchEndedMovingForward = 3,
475     UIWKSelectionTouchEndedMovingBackward = 4,
476     UIWKSelectionTouchEndedNotMoving = 5,
477 };
478
479 typedef NS_ENUM(NSInteger, UIWKSelectionFlags) {
480     UIWKNone = 0,
481     UIWKWordIsNearTap = 1,
482     UIWKIsBlockSelection = 2,
483     UIWKPhraseBoundaryChanged = 4,
484 };
485
486 typedef NS_ENUM(NSInteger, UIWKGestureType) {
487     UIWKGestureLoupe = 0,
488     UIWKGestureOneFingerTap = 1,
489     UIWKGestureTapAndAHalf = 2,
490     UIWKGestureDoubleTap = 3,
491     UIWKGestureTapAndHalf = 4,
492     UIWKGestureDoubleTapInUneditable = 5,
493     UIWKGestureOneFingerTapInUneditable = 6,
494     UIWKGestureOneFingerTapSelectsAll = 7,
495     UIWKGestureOneFingerDoubleTap = 8,
496     UIWKGestureOneFingerTripleTap = 9,
497     UIWKGestureTwoFingerSingleTap = 10,
498     UIWKGestureTwoFingerRangedSelectGesture = 11,
499     UIWKGestureTapOnLinkWithGesture = 12,
500     UIWKGestureMakeWebSelection = 13,
501     UIWKGesturePhraseBoundary = 14,
502 };
503
504 @interface UIWKSelectionAssistant : UIWebSelectionAssistant
505 @end
506
507 @interface UIWKSelectionAssistant ()
508 - (BOOL)shouldHandleSingleTapAtPoint:(CGPoint)point;
509 - (void)blockSelectionChangedWithTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags growThreshold:(CGFloat)grow shrinkThreshold:(CGFloat)shrink;
510 - (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags;
511 - (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch withFlags:(UIWKSelectionFlags)flags;
512 - (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch;
513 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
514 - (void)showShareSheetFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
515 @property (nonatomic, readonly) UILongPressGestureRecognizer *selectionLongPressRecognizer;
516 @end
517
518 typedef NS_ENUM(NSInteger, UIWKHandlePosition) {
519     UIWKHandleTop = 0,
520     UIWKHandleRight = 1,
521     UIWKHandleBottom = 2,
522     UIWKHandleLeft = 3,
523 };
524
525 @interface UIWKAutocorrectionRects : NSObject
526 @end
527
528 @interface UIWKAutocorrectionRects (UIWKAutocorrectionRectsDetails)
529 @property (nonatomic, assign) CGRect firstRect;
530 @property (nonatomic, assign) CGRect lastRect;
531 @end
532
533 @interface UIWKAutocorrectionContext : NSObject
534 @end
535
536 @interface UIWKAutocorrectionContext (UIWKAutocorrectionContextDetails)
537 @property (nonatomic, copy) NSString *contextBeforeSelection;
538 @property (nonatomic, copy) NSString *selectedText;
539 @property (nonatomic, copy) NSString *contextAfterSelection;
540 @property (nonatomic, copy) NSString *markedText;
541 @property (nonatomic, assign) NSRange rangeInMarkedText;
542 @end
543
544 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 100000
545 @protocol UIResponderStandardEditActions
546 @end
547 #endif
548
549 @interface UIWKTextInteractionAssistant : UITextInteractionAssistant <UIResponderStandardEditActions>
550 @end
551
552 @interface UIWKTextInteractionAssistant (UIWKTextInteractionAssistantDetails)
553 - (void)selectionChangedWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState withFlags:(UIWKSelectionFlags)flags;
554 - (void)showDictionaryFor:(NSString *)selectedTerm fromRect:(CGRect)presentationRect;
555 - (void)selectionChangedWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch;
556 - (void)showTextStyleOptions;
557 - (void)hideTextStyleOptions;
558
559 @property (nonatomic, readonly, assign) UILongPressGestureRecognizer *loupeGesture;
560 @property (nonatomic, readonly, assign) UITapGestureRecognizer *singleTapGesture;
561 @end
562
563 @protocol UIWKInteractionViewProtocol
564 - (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state;
565
566 - (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart;
567 - (void)changeSelectionWithTouchesFrom:(CGPoint)from to:(CGPoint)to withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState;
568 - (CGRect)textFirstRect;
569 - (CGRect)textLastRect;
570
571 - (void)requestAutocorrectionContextWithCompletionHandler:(void (^)(UIWKAutocorrectionContext *autocorrectionContext))completionHandler;
572
573 - (void)requestAutocorrectionRectsForString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForInput))completionHandler;
574
575 - (void)applyAutocorrection:(NSString *)correction toString:(NSString *)input withCompletionHandler:(void (^)(UIWKAutocorrectionRects *rectsForCorrection))completionHandler;
576
577 - (NSString *)markedText;
578 - (BOOL)hasMarkedText;
579
580 - (BOOL)hasSelectablePositionAtPoint:(CGPoint)point;
581 - (BOOL)pointIsInAssistedNode:(CGPoint)point;
582 - (NSArray *)webSelectionRects;
583 - (void)_cancelLongPressGestureRecognizer;
584
585 @optional
586 - (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart withFlags:(UIWKSelectionFlags)flags;
587 - (void)changeBlockSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch forHandle:(UIWKHandlePosition)handle;
588 - (void)clearSelection;
589 - (void)replaceDictatedText:(NSString *)oldText withText:(NSString *)newText;
590 - (void)requestDictationContext:(void (^)(NSString *selectedText, NSString *prefixText, NSString *postfixText))completionHandler;
591 - (BOOL)pointIsNearMarkedText:(CGPoint)point;
592 - (NSString *)selectedText;
593 - (void)replaceText:(NSString *)text withText:(NSString *)word;
594 - (void)selectWordForReplacement;
595 - (BOOL)isReplaceAllowed;
596 - (void)selectWordBackward;
597 - (UIView *)unscaledView;
598 - (CGFloat)inverseScale;
599 - (CGRect)unobscuredContentRect;
600 @end
601
602 typedef enum {
603     UIWebSelectionModeWeb = 0,
604     UIWebSelectionModeTextOnly = 1,
605 } UIWebSelectionMode;
606
607 @protocol UIWebFormAccessoryDelegate;
608
609 @interface UIWebFormAccessory : UIInputView
610 @end
611
612 @interface UIWebFormAccessory ()
613 - (void)hideAutoFillButton;
614 - (void)setClearVisible:(BOOL)flag;
615 - (void)showAutoFillButtonWithTitle:(NSString *)title;
616 @property (nonatomic, retain) UIBarButtonItem *_autofill;
617 @property (nonatomic, assign) id <UIWebFormAccessoryDelegate> delegate;
618
619 @property (nonatomic, assign, getter=isNextEnabled) BOOL nextEnabled;
620 @property (nonatomic, assign, getter=isPreviousEnabled) BOOL previousEnabled;
621 - (id)initWithInputAssistantItem:(UITextInputAssistantItem *)inputAssistantItem;
622 @end
623
624 @protocol UIWebFormAccessoryDelegate
625 - (void)accessoryAutoFill;
626 - (void)accessoryClear;
627 - (void)accessoryDone;
628 - (void)accessoryTab:(BOOL)isNext;
629 @end
630
631 @interface UIWebGeolocationPolicyDecider : NSObject
632 @end
633
634 @interface UIWebGeolocationPolicyDecider ()
635 + (instancetype)sharedPolicyDecider;
636 - (void)decidePolicyForGeolocationRequestFromOrigin:(id)securityOrigin requestingURL:(NSURL *)requestingURL window:(UIWindow *)window listener:(id)listener;
637 @end
638
639 typedef enum {
640     UIWebTouchEventTouchBegin = 0,
641     UIWebTouchEventTouchChange = 1,
642     UIWebTouchEventTouchEnd = 2,
643     UIWebTouchEventTouchCancel = 3,
644 } UIWebTouchEventType;
645
646 typedef enum {
647     UIWebTouchPointTypeDirect = 0,
648     UIWebTouchPointTypeStylus
649 } UIWebTouchPointType;
650
651 struct _UIWebTouchPoint {
652     CGPoint locationInScreenCoordinates;
653     CGPoint locationInDocumentCoordinates;
654     unsigned identifier;
655     UITouchPhase phase;
656 #if __IPHONE_OS_VERSION_MIN_REQUIRED > 100000
657     CGFloat majorRadiusInScreenCoordinates;
658     CGFloat force;
659     CGFloat altitudeAngle;
660     CGFloat azimuthAngle;
661     UIWebTouchPointType touchType;
662 #endif
663 };
664
665 struct _UIWebTouchEvent {
666     UIWebTouchEventType type;
667     NSTimeInterval timestamp;
668     CGPoint locationInScreenCoordinates;
669     CGPoint locationInDocumentCoordinates;
670     CGFloat scale;
671     CGFloat rotation;
672
673     bool inJavaScriptGesture;
674
675     struct _UIWebTouchPoint* touchPoints;
676     unsigned touchPointCount;
677
678     bool isPotentialTap;
679 };
680
681 @protocol UIWebTouchEventsGestureRecognizerDelegate
682 - (BOOL)isAnyTouchOverActiveArea:(NSSet *)touches;
683 - (BOOL)shouldIgnoreWebTouch;
684 @end
685
686 @interface UIWebTouchEventsGestureRecognizer : UIGestureRecognizer
687 @end
688
689 @interface UIWebTouchEventsGestureRecognizer ()
690 - (id)initWithTarget:(id)target action:(SEL)action touchDelegate:(id <UIWebTouchEventsGestureRecognizerDelegate>)delegate;
691 @property (nonatomic, getter=isDefaultPrevented) BOOL defaultPrevented;
692 @property (nonatomic, readonly) BOOL inJavaScriptGesture;
693 @property (nonatomic, readonly) CGPoint locationInWindow;
694 @property (nonatomic, readonly) UIWebTouchEventType type;
695 @property (nonatomic, readonly) const struct _UIWebTouchEvent *lastTouchEvent;
696 @end
697
698 typedef NS_ENUM(NSInteger, _UIBackdropViewStylePrivate) {
699     _UIBackdropViewStyle_Light = 2020,
700     _UIBackdropViewStyle_Dark = 2030
701 };
702
703 @interface _UIBackdropView : UIView
704 @end
705
706 @interface _UIBackdropView (_UIBackdropViewDetails)
707 - (instancetype)initWithPrivateStyle:(_UIBackdropViewStylePrivate)style;
708 - (instancetype)initWithFrame:(CGRect)frame privateStyle:(_UIBackdropViewStylePrivate)style;
709 @property (nonatomic, strong, readonly) UIView *contentView;
710 @end
711
712 @interface _UIHighlightView : UIView
713 @end
714
715 @interface _UIHighlightView ()
716 - (void)setColor:(UIColor *)aColor;
717 - (void)setCornerRadii:(NSArray *)cornerRadii;
718 - (void)setCornerRadius:(CGFloat)aCornerRadius;
719 - (void)setFrames:(NSArray *)frames boundaryRect:(CGRect)aBoundarRect;
720 - (void)setQuads:(NSArray *)quads boundaryRect:(CGRect)aBoundaryRect;
721 @end
722
723 @interface _UINavigationParallaxTransition : NSObject <UIViewControllerAnimatedTransitioningEx>
724 @end
725
726 @interface _UINavigationParallaxTransition ()
727 - (instancetype) initWithCurrentOperation:(UINavigationControllerOperation)operation;
728 @end
729
730 @protocol _UINavigationInteractiveTransitionBaseDelegate;
731
732 @interface _UINavigationInteractiveTransitionBase : UIPercentDrivenInteractiveTransition <UIGestureRecognizerDelegate>
733 @end
734
735 @interface _UINavigationInteractiveTransitionBase ()
736 - (id)initWithGestureRecognizerView:(UIView *)gestureRecognizerView animator:(id<UIViewControllerAnimatedTransitioning>)animator delegate:(id<_UINavigationInteractiveTransitionBaseDelegate>)delegate;
737 @property (nonatomic, assign) BOOL shouldReverseTranslation;
738 @property (nonatomic, retain) _UINavigationParallaxTransition *animationController;
739 @end
740
741 @protocol _UINavigationInteractiveTransitionBaseDelegate <NSObject>
742 - (void)startInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition;
743 - (BOOL)shouldBeginInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition;
744 - (BOOL)interactiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;
745 - (BOOL)interactiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;
746 - (UIPanGestureRecognizer *)gestureRecognizerForInteractiveTransition:(_UINavigationInteractiveTransitionBase *)interactiveTransition WithTarget:(id)target action:(SEL)action;
747 @end
748
749 @class BKSAnimationFenceHandle;
750
751 @interface UIWindow ()
752 + (BKSAnimationFenceHandle *)_synchronizedDrawingFence;
753 + (mach_port_t)_synchronizeDrawingAcrossProcesses;
754 - (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
755 @end
756
757 @interface UIWebScrollView : UIScrollView
758 @end
759
760 @interface UIWebTiledView : UIView
761 @end
762
763 @class WAKWindow;
764
765 @interface UIWebTiledView ()
766 - (void)setWAKWindow:(WAKWindow *)window;
767 @end
768
769 @interface UIWebDocumentView : UIWebTiledView
770 @end
771
772 typedef enum {
773     UIEveryDocumentMask = 0xFFFFFF,
774 } UIDocumentMask;
775
776 @interface UIWebDocumentView ()
777 - (void)setDelegate:(id)delegate;
778 - (void)setAutoresizes:(BOOL)flag;
779 - (void)setMinimumSize:(CGSize)aSize;
780 - (void)setInitialScale:(float)aScale forDocumentTypes:(UIDocumentMask)aDocumentMask;
781 - (void)setViewportSize:(CGSize)aSize forDocumentTypes:(UIDocumentMask)aDocumentMask;
782 - (void)setMinimumScale:(float)aScale forDocumentTypes:(UIDocumentMask)aDocumentMask;
783 - (void)setMaximumScale:(float)aScale forDocumentTypes:(UIDocumentMask)aDocumentMask;
784 @end
785
786 @interface UIWebBrowserView : UIWebDocumentView
787 @end
788
789 @class WebView;
790
791 @interface UIWebBrowserView ()
792 - (WebView *)webView;
793 - (void)setPaused:(BOOL)paused;
794 - (void)sendScrollEventIfNecessaryWasUserScroll:(BOOL)userScroll;
795 @property (nonatomic) BOOL inputViewObeysDOMFocus;
796 @end
797
798 @interface UIDocumentMenuViewController ()
799 - (instancetype)_initIgnoringApplicationEntitlementForImportOfTypes:(NSArray *)types;
800 @end
801
802 @protocol UIDocumentPasswordViewDelegate;
803
804 @interface UIDocumentPasswordView : UIView <UITextFieldDelegate>
805 @end
806
807 @interface UIDocumentPasswordView ()
808
809 - (id)initWithDocumentName:(NSString *)documentName;
810
811 @property (nonatomic, assign) NSObject<UIDocumentPasswordViewDelegate> *passwordDelegate;
812 @property (nonatomic, readonly) UITextField *passwordField;
813
814 @end
815
816 @protocol UIDocumentPasswordViewDelegate
817
818 @required
819
820 - (void)userDidEnterPassword:(NSString *)password forPasswordView:(UIDocumentPasswordView *)passwordView;
821
822 @optional
823
824 - (void)didBeginEditingPassword:(UITextField *)passwordField inView:(UIDocumentPasswordView *)passwordView;
825 - (void)didEndEditingPassword:(UITextField *)passwordField inView:(UIDocumentPasswordView *)passwordView;
826
827 @end
828
829 @interface UIViewControllerPreviewAction : NSObject <NSCopying>
830 @end
831
832 @interface UIViewControllerPreviewAction ()
833 + (instancetype)actionWithTitle:(NSString *)title handler:(void (^)(UIViewControllerPreviewAction *action, UIViewController *previewViewController))handler;
834 @end
835
836 #endif // USE(APPLE_INTERNAL_SDK)
837
838 @interface UIView (IPI)
839 - (UIScrollView *)_scroller;
840 - (CGPoint)accessibilityConvertPointFromSceneReferenceCoordinates:(CGPoint)point;
841 - (CGRect)accessibilityConvertRectToSceneReferenceCoordinates:(CGRect)rect;
842 @end
843
844 @interface UIResponder ()
845 - (UIResponder *)firstResponder;
846 @end
847
848 WTF_EXTERN_C_BEGIN
849
850 BOOL UIKeyboardEnabledInputModesAllowOneToManyShortcuts();
851 BOOL UIKeyboardEnabledInputModesAllowChineseTransliterationForText(NSString *);
852 BOOL UIKeyboardCurrentInputModeAllowsChineseOrJapaneseReanalysisForText(NSString *);
853
854 extern const float UITableCellDefaultFontSize;
855 extern const float UITableViewCellDefaultFontSize;
856
857 extern NSString * const UIWindowDidMoveToScreenNotification;
858 extern NSString * const UIWindowDidRotateNotification;
859 extern NSString * const UIWindowNewScreenUserInfoKey;
860 extern NSString * const UIWindowWillRotateNotification;
861
862 extern NSString * const UIKeyboardIsLocalUserInfoKey;
863
864 extern UIApplication *UIApp;
865 BOOL _UIApplicationIsExtension(void);
866 void _UIApplicationLoadWebKit(void);
867 BOOL _UIApplicationUsesLegacyUI(void);
868
869 void UIImageDataWriteToSavedPhotosAlbum(NSData *imageData, id completionTarget, SEL completionSelector, void *contextInfo);
870
871 UIImage* _UIImageGetWebKitPhotoLibraryIcon(void);
872 UIImage* _UIImageGetWebKitTakePhotoOrVideoIcon(void);
873
874 extern const float UIWebViewGrowsAndShrinksToFitHeight;
875 extern const float UIWebViewScalesToFitScale;
876 extern const float UIWebViewStandardViewportWidth;
877
878 extern NSString *const UIKeyInputPageUp;
879 extern NSString *const UIKeyInputPageDown;
880
881 extern const NSString *UIPreviewDataLink;
882 extern const NSString *UIPreviewDataDDResult;
883 extern const NSString *UIPreviewDataDDContext;
884
885 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
886 extern const NSString *UIPreviewDataAttachmentList;
887 extern const NSString *UIPreviewDataAttachmentIndex;
888 #endif
889
890 WTF_EXTERN_C_END