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