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