Add SPI to retrieve the set of text inputs in a given rect, and later focus one
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKWebViewPrivate.h
1 /*
2  * Copyright (C) 2014 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 <WebKit/WKWebView.h>
27
28 #import <WebKit/WKDataDetectorTypes.h>
29 #import <WebKit/_WKActivatedElementInfo.h>
30 #import <WebKit/_WKAttachment.h>
31 #import <WebKit/_WKFindOptions.h>
32 #import <WebKit/_WKLayoutMode.h>
33 #import <WebKit/_WKOverlayScrollbarStyle.h>
34 #import <WebKit/_WKRenderingProgressEvents.h>
35
36 typedef NS_ENUM(NSInteger, _WKPaginationMode) {
37     _WKPaginationModeUnpaginated,
38     _WKPaginationModeLeftToRight,
39     _WKPaginationModeRightToLeft,
40     _WKPaginationModeTopToBottom,
41     _WKPaginationModeBottomToTop,
42 } WK_API_AVAILABLE(macosx(10.10), ios(8.0));
43
44 typedef NS_OPTIONS(NSUInteger, _WKMediaCaptureState) {
45     _WKMediaCaptureStateNone = 0,
46     _WKMediaCaptureStateActiveMicrophone = 1 << 0,
47     _WKMediaCaptureStateActiveCamera = 1 << 1,
48     _WKMediaCaptureStateMutedMicrophone = 1 << 2,
49     _WKMediaCaptureStateMutedCamera = 1 << 3,
50 } WK_API_AVAILABLE(macosx(10.13), ios(11.0));
51
52 typedef NS_OPTIONS(NSUInteger, _WKMediaMutedState) {
53     _WKMediaNoneMuted = 0,
54     _WKMediaAudioMuted = 1 << 0,
55     _WKMediaCaptureDevicesMuted = 1 << 1,
56 } WK_API_AVAILABLE(macosx(10.13), ios(11.0));
57
58 typedef NS_OPTIONS(NSUInteger, _WKCaptureDevices) {
59     _WKCaptureDeviceMicrophone = 1 << 0,
60     _WKCaptureDeviceCamera = 1 << 1,
61     _WKCaptureDeviceDisplay = 1 << 2,
62 } WK_API_AVAILABLE(macosx(10.13), ios(11.0));
63
64 typedef NS_OPTIONS(NSUInteger, _WKSelectionAttributes) {
65     _WKSelectionAttributeNoSelection = 0,
66     _WKSelectionAttributeIsCaret = 1 << 0,
67     _WKSelectionAttributeIsRange = 1 << 1,
68     _WKSelectionAttributeAtStartOfSentence = 1 << 2,
69 } WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
70
71 #if TARGET_OS_IPHONE
72
73 typedef NS_ENUM(NSUInteger, _WKDragInteractionPolicy) {
74     _WKDragInteractionPolicyDefault = 0,
75     _WKDragInteractionPolicyAlwaysEnable,
76     _WKDragInteractionPolicyAlwaysDisable
77 } WK_API_AVAILABLE(ios(11.0));
78
79 #else
80 #import <WebKit/WKBase.h>
81 #endif
82
83 #if !TARGET_OS_IPHONE
84
85 typedef NS_ENUM(NSInteger, _WKImmediateActionType) {
86     _WKImmediateActionNone,
87     _WKImmediateActionLinkPreview,
88     _WKImmediateActionDataDetectedItem,
89     _WKImmediateActionLookupText,
90     _WKImmediateActionMailtoLink,
91     _WKImmediateActionTelLink
92 } WK_API_AVAILABLE(macosx(10.12));
93
94 typedef NS_OPTIONS(NSUInteger, _WKRectEdge) {
95     _WKRectEdgeNone = 0,
96     _WKRectEdgeLeft = 1 << CGRectMinXEdge,
97     _WKRectEdgeTop = 1 << CGRectMinYEdge,
98     _WKRectEdgeRight = 1 << CGRectMaxXEdge,
99     _WKRectEdgeBottom = 1 << CGRectMaxYEdge,
100     _WKRectEdgeAll = _WKRectEdgeLeft | _WKRectEdgeTop | _WKRectEdgeRight | _WKRectEdgeBottom,
101 } WK_API_AVAILABLE(macosx(10.13.4));
102
103 #endif
104
105 @class WKBrowsingContextHandle;
106 @class _WKApplicationManifest;
107 @class _WKFrameHandle;
108 @class _WKHitTestResult;
109 @class _WKIconLoadingDelegate;
110 @class _WKInspector;
111 @class _WKRemoteObjectRegistry;
112 @class _WKSafeBrowsingWarning;
113 @class _WKSessionState;
114 @class _WKTextInputContext;
115 @class _WKThumbnailView;
116 @class _WKWebsitePolicies;
117 @class _WKWebViewPrintFormatter;
118
119 @protocol WKHistoryDelegatePrivate;
120 @protocol _WKDiagnosticLoggingDelegate;
121 @protocol _WKFindDelegate;
122 @protocol _WKIconLoadingDelegate;
123 @protocol _WKInputDelegate;
124 @protocol _WKFullscreenDelegate;
125
126 @interface WKWebView (WKPrivate)
127
128 // FIXME: This should return a _WKRemoteObjectRegistry *.
129 @property (nonatomic, readonly) id _remoteObjectRegistry;
130 @property (nonatomic, readonly) WKBrowsingContextHandle *_handle;
131
132 @property (nonatomic, setter=_setObservedRenderingProgressEvents:) _WKRenderingProgressEvents _observedRenderingProgressEvents;
133
134 @property (nonatomic, weak, setter=_setHistoryDelegate:) id <WKHistoryDelegatePrivate> _historyDelegate;
135 @property (nonatomic, weak, setter=_setIconLoadingDelegate:) id <_WKIconLoadingDelegate> _iconLoadingDelegate;
136
137 @property (nonatomic, readonly) NSURL *_unreachableURL;
138
139 - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL;
140 - (WKNavigation *)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType characterEncodingName:(NSString *)characterEncodingName baseURL:(NSURL *)baseURL userData:(id)userData WK_API_AVAILABLE(macosx(10.12), ios(10.0));
141 - (WKNavigation *)_loadRequest:(NSURLRequest *)request shouldOpenExternalURLs:(BOOL)shouldOpenExternalURLs WK_API_AVAILABLE(macosx(10.13), ios(11.0));
142
143 @property (nonatomic, readonly) NSArray *_certificateChain WK_API_DEPRECATED_WITH_REPLACEMENT("certificateChain", macosx(10.10, 10.11), ios(8.0, 9.0));
144 @property (nonatomic, readonly) NSURL *_committedURL;
145 @property (nonatomic, readonly) NSString *_MIMEType;
146 @property (nonatomic, readonly) NSString *_userAgent WK_API_AVAILABLE(macosx(10.11), ios(9.0));
147
148 @property (nonatomic, readonly, getter=_isPlayingAudio) BOOL _playingAudio WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
149
150 @property (copy, setter=_setApplicationNameForUserAgent:) NSString *_applicationNameForUserAgent;
151 @property (copy, setter=_setCustomUserAgent:) NSString *_customUserAgent;
152
153 @property (nonatomic, setter=_setUserContentExtensionsEnabled:) BOOL _userContentExtensionsEnabled WK_API_AVAILABLE(macosx(10.11), ios(9.0));
154
155 @property (nonatomic, readonly) pid_t _webProcessIdentifier;
156 @property (nonatomic, readonly) pid_t _provisionalWebProcessIdentifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
157
158 @property (nonatomic, getter=_isEditable, setter=_setEditable:) BOOL _editable WK_API_AVAILABLE(macosx(10.11), ios(9.0));
159
160 // FIXME: Remove these once nobody is using them.
161 @property (nonatomic, readonly) NSData *_sessionStateData;
162 - (void)_restoreFromSessionStateData:(NSData *)sessionStateData;
163
164 @property (nonatomic, readonly) _WKSessionState *_sessionState;
165 - (WKNavigation *)_restoreSessionState:(_WKSessionState *)sessionState andNavigate:(BOOL)navigate;
166 - (_WKSessionState *)_sessionStateWithFilter:(BOOL (^)(WKBackForwardListItem *item))filter;
167
168 @property (nonatomic, setter=_setAllowsRemoteInspection:) BOOL _allowsRemoteInspection;
169 @property (nonatomic, copy, setter=_setRemoteInspectionNameOverride:) NSString *_remoteInspectionNameOverride WK_API_AVAILABLE(macosx(10.12), ios(10.0));
170
171 @property (nonatomic, setter=_setAddsVisitedLinks:) BOOL _addsVisitedLinks;
172
173 @property (nonatomic, readonly) BOOL _networkRequestsInProgress;
174
175 @property (nonatomic, readonly, getter=_isShowingNavigationGestureSnapshot) BOOL _showingNavigationGestureSnapshot;
176
177 - (void)_close;
178
179 - (void)_updateWebsitePolicies:(_WKWebsitePolicies *)websitePolicies WK_API_AVAILABLE(macosx(10.13), ios(11.0));
180
181 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler WK_API_AVAILABLE(macosx(10.13), ios(11.0));
182
183 @property (nonatomic, setter=_setLayoutMode:) _WKLayoutMode _layoutMode;
184 // For use with _layoutMode = _WKLayoutModeFixedSize:
185 @property (nonatomic, setter=_setFixedLayoutSize:) CGSize _fixedLayoutSize;
186
187 @property (nonatomic, setter=_setViewportSizeForCSSViewportUnits:) CGSize _viewportSizeForCSSViewportUnits WK_API_AVAILABLE(macosx(10.13), ios(11.0));
188
189 @property (nonatomic, setter=_setViewScale:) CGFloat _viewScale WK_API_AVAILABLE(macosx(10.11), ios(9.0));
190
191 @property (nonatomic, setter=_setMinimumEffectiveDeviceWidth:) CGFloat _minimumEffectiveDeviceWidth WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
192
193 @property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage WK_API_AVAILABLE(macosx(10.13.4), ios(8.0));
194
195 - (_WKAttachment *)_insertAttachmentWithFilename:(NSString *)filename contentType:(NSString *)contentType data:(NSData *)data options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("-_insertAttachmentWithFileWrapper:contentType:options:completion:", macosx(10.13.4, WK_MAC_TBA), ios(11.3, WK_IOS_TBA));
196 - (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType options:(_WKAttachmentDisplayOptions *)options completion:(void(^)(BOOL success))completionHandler WK_API_DEPRECATED_WITH_REPLACEMENT("-_insertAttachmentWithFileWrapper:contentType:completion:", macosx(WK_MAC_TBA, WK_MAC_TBA), ios(WK_IOS_TBA, WK_IOS_TBA));
197 - (_WKAttachment *)_insertAttachmentWithFileWrapper:(NSFileWrapper *)fileWrapper contentType:(NSString *)contentType completion:(void(^)(BOOL success))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
198 - (_WKAttachment *)_attachmentForIdentifier:(NSString *)identifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
199
200 - (void)_simulateDeviceOrientationChangeWithAlpha:(double)alpha beta:(double)beta gamma:(double)gamma WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
201
202 + (BOOL)_handlesSafeBrowsing WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
203 + (NSURL *)_confirmMalwareSentinel WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
204 + (NSURL *)_visitUnsafeWebsiteSentinel WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
205 - (void)_showSafeBrowsingWarningWithTitle:(NSString *)title warning:(NSString *)warning details:(NSAttributedString *)details completionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
206 - (void)_showSafeBrowsingWarningWithURL:(NSURL *)url title:(NSString *)title warning:(NSString *)warning details:(NSAttributedString *)details completionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
207
208 - (void)_isJITEnabled:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
209 - (void)_removeDataDetectedLinks:(dispatch_block_t)completion WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
210
211 - (IBAction)_alignCenter:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
212 - (IBAction)_alignJustified:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
213 - (IBAction)_alignLeft:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
214 - (IBAction)_alignRight:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
215 - (IBAction)_indent:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
216 - (IBAction)_outdent:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
217 - (IBAction)_toggleStrikeThrough:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
218 - (IBAction)_insertOrderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
219 - (IBAction)_insertUnorderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
220 - (IBAction)_insertNestedOrderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
221 - (IBAction)_insertNestedUnorderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
222 - (IBAction)_increaseListLevel:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
223 - (IBAction)_decreaseListLevel:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
224 - (IBAction)_changeListType:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
225 - (IBAction)_pasteAsQuotation:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
226 - (IBAction)_pasteAndMatchStyle:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
227 - (IBAction)_takeFindStringFromSelection:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
228
229 @property (class, nonatomic, copy, setter=_setStringForFind:) NSString *_stringForFind WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
230 @property (nonatomic, readonly) _WKSelectionAttributes _selectionAttributes WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
231
232 #if TARGET_OS_IPHONE
233
234 - (void)_setFont:(UIFont *)font sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
235 - (void)_setFontSize:(CGFloat)fontSize sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
236 - (void)_setTextColor:(UIColor *)color sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
237
238 - (void)_detectDataWithTypes:(WKDataDetectorTypes)types completionHandler:(dispatch_block_t)completion WK_API_AVAILABLE(ios(WK_IOS_TBA));
239
240 // DERECATED: The setters of the three following function are deprecated, please use overrideLayoutParameters.
241 // Define the smallest size a page take with a regular viewport.
242 @property (nonatomic, readonly) CGSize _minimumLayoutSizeOverride;
243 // Define the largest size the unobscured area can get for the current view bounds. This value is used to define viewport units.
244 @property (nonatomic, readonly) CGSize _maximumUnobscuredSizeOverride;
245
246 // Define the inset of the scrollview unusable by the web page.
247 @property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
248
249 @property (nonatomic, setter=_setUnobscuredSafeAreaInsets:) UIEdgeInsets _unobscuredSafeAreaInsets WK_API_AVAILABLE(ios(11.0));
250 @property (nonatomic, readonly) BOOL _safeAreaShouldAffectObscuredInsets WK_API_AVAILABLE(ios(11.0));
251 @property (nonatomic, setter=_setObscuredInsetEdgesAffectedBySafeArea:) UIRectEdge _obscuredInsetEdgesAffectedBySafeArea WK_API_AVAILABLE(ios(11.0));
252
253 // An ancestor view whose bounds will be intersected with those of this WKWebView to determine the visible region of content to render.
254 @property (nonatomic, readonly) UIView *_enclosingViewForExposedRectComputation WK_API_AVAILABLE(ios(11.0));
255
256 // Override the interface orientation. Clients using _beginAnimatedResizeWithUpdates: must update the interface orientation
257 // in the update block.
258 @property (nonatomic, setter=_setInterfaceOrientationOverride:) UIInterfaceOrientation _interfaceOrientationOverride;
259
260 @property (nonatomic, setter=_setAllowsViewportShrinkToFit:) BOOL _allowsViewportShrinkToFit;
261
262 // FIXME: Remove these three properties once we expose WKWebViewContentProvider as API.
263 @property (nonatomic, readonly, getter=_isDisplayingPDF) BOOL _displayingPDF;
264 @property (nonatomic, readonly) NSData *_dataForDisplayedPDF;
265 // FIXME: This can be removed once WKNavigation's response property is implemented.
266 @property (nonatomic, readonly) NSString *_suggestedFilenameForDisplayedPDF;
267
268 @property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter;
269
270 @property (nonatomic, setter=_setDragInteractionPolicy:) _WKDragInteractionPolicy _dragInteractionPolicy WK_API_AVAILABLE(ios(11.0));
271
272 - (void)_beginInteractiveObscuredInsetsChange;
273 - (void)_endInteractiveObscuredInsetsChange;
274 - (void)_hideContentUntilNextUpdate;
275
276 - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock;
277 - (void)_endAnimatedResize;
278 - (void)_resizeWhileHidingContentWithUpdates:(void (^)(void))updateBlock;
279
280 - (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)imageWidth completionHandler:(void(^)(CGImageRef))completionHandler;
281
282 - (void)_overrideLayoutParametersWithMinimumLayoutSize:(CGSize)minimumLayoutSize maximumUnobscuredSizeOverride:(CGSize)maximumUnobscuredSizeOverride WK_API_AVAILABLE(ios(9_0));
283
284 - (void)_clearOverrideLayoutParameters WK_API_AVAILABLE(ios(11.0));
285 - (void)_clearInterfaceOrientationOverride WK_API_AVAILABLE(ios(11.0));
286
287 - (UIView *)_viewForFindUI;
288
289 - (void)_setOverlaidAccessoryViewsInset:(CGSize)inset;
290
291 // Puts the view into a state where being taken out of the view hierarchy and resigning first responder
292 // will not count as becoming inactive and unfocused. The returned block must be called to exit the state.
293 - (void (^)(void))_retainActiveFocusedState WK_API_AVAILABLE(ios(9_0));
294
295 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler WK_API_AVAILABLE(ios(9_0));
296
297 - (id)_snapshotLayerContentsForBackForwardListItem:(WKBackForwardListItem *)item WK_API_AVAILABLE(ios(9_0));
298 - (NSArray *)_dataDetectionResults;
299
300 - (void)_accessibilityRetrieveSpeakSelectionContent WK_API_AVAILABLE(ios(11.0));
301 - (void)_accessibilityDidGetSpeakSelectionContent:(NSString *)content WK_API_AVAILABLE(ios(11.0));
302
303 @property (nonatomic, readonly) UIView *_safeBrowsingWarning WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
304 #else
305 @property (nonatomic, readonly) NSView *_safeBrowsingWarning WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
306
307 @property (nonatomic, readonly) _WKRectEdge _pinnedState WK_API_AVAILABLE(macosx(10.13.4));
308 @property (nonatomic, setter=_setRubberBandingEnabled:) _WKRectEdge _rubberBandingEnabled WK_API_AVAILABLE(macosx(10.13.4));
309
310 @property (readonly) NSColor *_pageExtendedBackgroundColor;
311 @property (nonatomic, setter=_setBackgroundColor:) NSColor *_backgroundColor WK_API_AVAILABLE(macosx(10.14));
312 @property (nonatomic, setter=_setDrawsBackground:) BOOL _drawsBackground;
313 @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
314
315 @property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
316
317 // Default value is 0. A value of 0 means the window's backing scale factor will be used and automatically update when the window moves screens.
318 @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_API_AVAILABLE(macosx(10.11));
319
320 @property (nonatomic, setter=_setWindowOcclusionDetectionEnabled:) BOOL _windowOcclusionDetectionEnabled;
321
322 @property (nonatomic, readonly) NSInteger _spellCheckerDocumentTag WK_API_AVAILABLE(macosx(10.14));
323
324 - (void)_setShouldSuppressFirstResponderChanges:(BOOL)shouldSuppress;
325
326 // Clients that want to maintain default behavior can return nil. To disable the immediate action entirely, return NSNull. And to
327 // do something custom, return an object that conforms to the NSImmediateActionAnimationController protocol.
328 - (id)_immediateActionAnimationControllerForHitTestResult:(_WKHitTestResult *)hitTestResult withType:(_WKImmediateActionType)type userData:(id<NSSecureCoding>)userData;
329
330 @property (nonatomic, setter=_setMinimumLayoutWidth:) CGFloat _minimumLayoutWidth WK_API_AVAILABLE(macosx(10.12));
331
332 // When using _minimumLayoutWidth, the web content will lay out to the intrinsic height
333 // of the content; use this property to force it to lay out to the height of the view instead.
334 @property (nonatomic, setter=_setShouldExpandContentToViewHeightForAutoLayout:) BOOL _shouldExpandContentToViewHeightForAutoLayout WK_API_AVAILABLE(macosx(10.12));
335
336 @property (nonatomic, setter=_setAlwaysShowsHorizontalScroller:) BOOL _alwaysShowsHorizontalScroller WK_API_AVAILABLE(macosx(10.13.4));
337 @property (nonatomic, setter=_setAlwaysShowsVerticalScroller:) BOOL _alwaysShowsVerticalScroller WK_API_AVAILABLE(macosx(10.13.4));
338
339 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo;
340 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(_WKFrameHandle *)frameHandle WK_API_AVAILABLE(macosx(10.12), ios(10.0));
341
342 // FIXME: This SPI should become a part of the WKUIDelegate. rdar://problem/26561537
343 @property (nonatomic, readwrite, setter=_setWantsMediaPlaybackControlsView:) BOOL _wantsMediaPlaybackControlsView WK_API_AVAILABLE(macosx(10.12.3));
344 @property (nonatomic, readonly) id _mediaPlaybackControlsView WK_API_AVAILABLE(macosx(10.13));
345 - (void)_addMediaPlaybackControlsView:(id)mediaPlaybackControlsView WK_API_AVAILABLE(macosx(10.13));
346 - (void)_removeMediaPlaybackControlsView WK_API_AVAILABLE(macosx(10.12.3));
347
348 - (void)_prepareForMoveToWindow:(NSWindow *)targetWindow completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(10.13));
349
350 @property (nonatomic, setter=_setOverlayScrollbarStyle:) _WKOverlayScrollbarStyle _overlayScrollbarStyle WK_API_AVAILABLE(macosx(10.13.4));
351 @property (strong, nonatomic, setter=_setInspectorAttachmentView:) NSView *_inspectorAttachmentView WK_API_AVAILABLE(macosx(10.13.4));
352
353 @property (nonatomic, setter=_setThumbnailView:) _WKThumbnailView *_thumbnailView WK_API_AVAILABLE(macosx(10.13.4));
354 @property (nonatomic, setter=_setIgnoresAllEvents:) BOOL _ignoresAllEvents WK_API_AVAILABLE(macosx(10.13.4));
355
356 #endif
357
358 - (WKNavigation *)_reloadWithoutContentBlockers WK_API_AVAILABLE(macosx(10.12), ios(10.0));
359 - (WKNavigation *)_reloadExpiredOnly WK_API_AVAILABLE(macosx(10.13), ios(11.0));
360
361 - (void)_killWebContentProcess;
362 - (void)_killWebContentProcessAndResetState;
363
364 - (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
365 - (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
366 - (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError *))completionHandler WK_API_AVAILABLE(macosx(10.13), ios(11.0));
367
368 - (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
369
370 @property (nonatomic, setter=_setPaginationMode:) _WKPaginationMode _paginationMode;
371 // Whether the column-break-{before,after} properties are respected instead of the
372 // page-break-{before,after} properties.
373 @property (nonatomic, setter=_setPaginationBehavesLikeColumns:) BOOL _paginationBehavesLikeColumns;
374 // Set to 0 to have the page length equal the view length.
375 @property (nonatomic, setter=_setPageLength:) CGFloat _pageLength;
376 @property (nonatomic, setter=_setGapBetweenPages:) CGFloat _gapBetweenPages;
377 @property (nonatomic, setter=_setPaginationLineGridEnabled:) BOOL _paginationLineGridEnabled;
378 @property (readonly) NSUInteger _pageCount;
379
380 @property (nonatomic, readonly) BOOL _supportsTextZoom;
381 @property (nonatomic, setter=_setTextZoomFactor:) double _textZoomFactor;
382 @property (nonatomic, setter=_setPageZoomFactor:) double _pageZoomFactor;
383
384 @property (nonatomic, weak, setter=_setDiagnosticLoggingDelegate:) id <_WKDiagnosticLoggingDelegate> _diagnosticLoggingDelegate WK_API_AVAILABLE(macosx(10.11), ios(9.0));
385 @property (nonatomic, weak, setter=_setFindDelegate:) id <_WKFindDelegate> _findDelegate;
386 - (void)_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
387 - (void)_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
388 - (void)_hideFindUI;
389
390 @property (nonatomic, weak, setter=_setInputDelegate:) id <_WKInputDelegate> _inputDelegate WK_API_AVAILABLE(macosx(10.12), ios(10.0));
391
392 @property (nonatomic, readonly, getter=_isDisplayingStandaloneImageDocument) BOOL _displayingStandaloneImageDocument;
393 @property (nonatomic, readonly, getter=_isDisplayingStandaloneMediaDocument) BOOL _displayingStandaloneMediaDocument;
394
395 @property (nonatomic, setter=_setScrollPerformanceDataCollectionEnabled:) BOOL _scrollPerformanceDataCollectionEnabled WK_API_AVAILABLE(macosx(10.11), ios(9.0));
396 @property (nonatomic, readonly) NSArray *_scrollPerformanceData WK_API_AVAILABLE(macosx(10.11), ios(9.0));
397
398 - (void)_saveBackForwardSnapshotForItem:(WKBackForwardListItem *)item WK_API_AVAILABLE(macosx(10.11), ios(9.0));
399
400 @property (nonatomic, getter=_allowsMediaDocumentInlinePlayback, setter=_setAllowsMediaDocumentInlinePlayback:) BOOL _allowsMediaDocumentInlinePlayback;
401
402 @property (nonatomic, readonly) BOOL _webProcessIsResponsive WK_API_AVAILABLE(macosx(10.12), ios(10.0));
403
404 @property (nonatomic, setter=_setFullscreenDelegate:) id<_WKFullscreenDelegate> _fullscreenDelegate WK_API_AVAILABLE(macosx(10.13), ios(11.0));
405 @property (nonatomic, readonly) BOOL _isInFullscreen WK_API_AVAILABLE(macosx(10.12.3));
406
407 @property (nonatomic, readonly) _WKMediaCaptureState _mediaCaptureState WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
408
409 - (void)_setMediaCaptureMuted:(BOOL)muted WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
410 - (void)_muteMediaCapture WK_API_AVAILABLE(macosx(10.13), ios(11.0));
411 - (void)_setPageMuted:(_WKMediaMutedState)mutedState WK_API_AVAILABLE(macosx(10.13), ios(11.0));
412
413 @property (nonatomic, setter=_setMediaCaptureEnabled:) BOOL _mediaCaptureEnabled WK_API_AVAILABLE(macosx(10.13), ios(11.0));
414
415 @property (nonatomic, readonly) BOOL _canTogglePictureInPicture;
416 @property (nonatomic, readonly) BOOL _isPictureInPictureActive;
417 - (void)_updateMediaPlaybackControlsManager;
418 - (void)_togglePictureInPicture;
419 - (void)_stopAllMediaPlayback;
420 - (void)_suspendAllMediaPlayback;
421 - (void)_resumeAllMediaPlayback;
422
423 - (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
424 - (void)_focusTextInputContext:(_WKTextInputContext *)textInputElement completionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
425
426 @end
427
428 #if TARGET_OS_IPHONE
429
430 @interface WKWebView () <UIResponderStandardEditActions>
431 @end
432
433 #else
434
435 @interface WKWebView (WKNSTextFinderClient) <NSTextFinderClient>
436 @end
437
438 #endif
439
440 @interface WKWebView (WKTesting)
441
442 - (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
443
444 #if TARGET_OS_IPHONE
445
446 @property (nonatomic, readonly) CGRect _contentVisibleRect WK_API_AVAILABLE(ios(10.0));
447 - (CGPoint)_convertPointFromContentsToView:(CGPoint)point WK_API_AVAILABLE(ios(10.0));
448 - (CGPoint)_convertPointFromViewToContents:(CGPoint)point WK_API_AVAILABLE(ios(10.0));
449
450 - (void)keyboardAccessoryBarNext WK_API_AVAILABLE(ios(10.0));
451 - (void)keyboardAccessoryBarPrevious WK_API_AVAILABLE(ios(10.0));
452 - (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(10.3));
453 - (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(10.3));
454 @property (nonatomic, readonly) NSString *textContentTypeForTesting WK_API_AVAILABLE(ios(12.0));
455 @property (nonatomic, readonly) NSString *selectFormPopoverTitle WK_API_AVAILABLE(ios(12.0));
456 @property (nonatomic, readonly) NSString *formInputLabel WK_API_AVAILABLE(ios(12.0));
457 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute WK_API_AVAILABLE(ios(12.0));
458
459 - (void)applyAutocorrection:(NSString *)newString toString:(NSString *)oldString withCompletionHandler:(void (^)(void))completionHandler WK_API_AVAILABLE(ios(11.0));
460
461 - (void)didStartFormControlInteraction WK_API_AVAILABLE(ios(10.3));
462 - (void)didEndFormControlInteraction WK_API_AVAILABLE(ios(10.3));
463
464 - (void)_didShowForcePressPreview WK_API_AVAILABLE(ios(10.3));
465 - (void)_didDismissForcePressPreview WK_API_AVAILABLE(ios(10.3));
466 - (void)_doAfterNextStablePresentationUpdate:(dispatch_block_t)updateBlock WK_API_AVAILABLE(ios(10.3));
467
468 @property (nonatomic, readonly) NSArray<NSValue *> *_uiTextSelectionRects WK_API_AVAILABLE(ios(10.3));
469 @property (nonatomic, readonly) CGRect _uiTextCaretRect WK_API_AVAILABLE(ios(10.3));
470 @property (nonatomic, readonly) CGRect _inputViewBounds WK_API_AVAILABLE(ios(10.3));
471
472 @property (nonatomic, readonly) NSString *_scrollingTreeAsText WK_API_AVAILABLE(ios(10.3));
473
474 @property (nonatomic, readonly) NSNumber *_stableStateOverride WK_API_AVAILABLE(ios(10.3));
475
476 - (NSDictionary *)_propertiesOfLayerWithID:(unsigned long long)layerID WK_API_AVAILABLE(ios(11.0));
477 - (void)_simulateLongPressActionAtLocation:(CGPoint)location WK_API_AVAILABLE(ios(11.0));
478 - (void)_simulateTextEntered:(NSString *)text WK_API_AVAILABLE(ios(12.0));
479
480 @property (nonatomic, readonly) CGRect _dragCaretRect WK_API_AVAILABLE(ios(11.0));
481
482 - (void)_requestActivatedElementAtPosition:(CGPoint)position completionBlock:(void (^)(_WKActivatedElementInfo *))block WK_API_AVAILABLE(ios(11.0));
483 - (void)_accessibilityRetrieveRectsAtSelectionOffset:(NSInteger)offset withText:(NSString *)text completionHandler:(void (^)(NSArray<NSValue *> *rects))completionHandler WK_API_AVAILABLE(ios(11.3));
484 - (void)_accessibilityStoreSelection WK_API_AVAILABLE(ios(11.3));
485 - (void)_accessibilityClearSelection WK_API_AVAILABLE(ios(11.3));
486 - (UIView *)_fullScreenPlaceholderView WK_API_AVAILABLE(ios(12.0));
487
488 @property (nonatomic, readonly) BOOL _contentViewIsFirstResponder WK_API_AVAILABLE(ios(WK_IOS_TBA));
489 #else
490 - (void)_dismissContentRelativeChildWindows WK_API_AVAILABLE(macosx(10.13.4));
491 - (void)_setFrame:(NSRect)rect andScrollBy:(NSSize)offset WK_API_AVAILABLE(macosx(10.13.4));
492 - (void)_beginDeferringViewInWindowChanges WK_API_AVAILABLE(macosx(10.13.4));
493 - (void)_endDeferringViewInWindowChanges WK_API_AVAILABLE(macosx(10.13.4));
494 - (void)_endDeferringViewInWindowChangesSync WK_API_AVAILABLE(macosx(10.13.4));
495 - (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event WK_API_AVAILABLE(macosx(10.13.4));
496 - (void)_setCustomSwipeViews:(NSArray *)customSwipeViews WK_API_AVAILABLE(macosx(10.13.4));
497 - (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset WK_API_AVAILABLE(macosx(10.13.4));
498 - (NSView *)_fullScreenPlaceholderView WK_API_AVAILABLE(macosx(10.13.4));
499 - (NSWindow *)_fullScreenWindow WK_API_AVAILABLE(macosx(10.13.4));
500 - (void)_disableFrameSizeUpdates WK_API_AVAILABLE(macosx(10.13.4));
501 - (void)_enableFrameSizeUpdates WK_API_AVAILABLE(macosx(10.13.4));
502 - (void)_prepareForImmediateActionAnimation WK_API_AVAILABLE(macosx(10.13.4));
503 - (void)_cancelImmediateActionAnimation WK_API_AVAILABLE(macosx(10.13.4));
504 - (void)_completeImmediateActionAnimation WK_API_AVAILABLE(macosx(10.13.4));
505 - (BOOL)_canChangeFrameLayout:(_WKFrameHandle *)frameHandle WK_API_AVAILABLE(macosx(10.13.4));
506 - (BOOL)_tryToSwipeWithEvent:(NSEvent *)event ignoringPinnedState:(BOOL)ignoringPinnedState WK_API_AVAILABLE(macosx(10.13.4));
507 - (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect))callback WK_API_AVAILABLE(macosx(10.13.4));
508 @property (nonatomic, setter=_setTotalHeightOfBanners:) CGFloat _totalHeightOfBanners WK_API_AVAILABLE(macosx(10.13.4));
509 @property (nonatomic, copy, setter=_setUnderlayColor:) NSColor *_underlayColor WK_API_AVAILABLE(macosx(10.13.4));
510 @property (nonatomic, readwrite, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents WK_API_AVAILABLE(macosx(10.13.4));
511 @property (nonatomic, readonly) WKPageRef _pageRefForTransitionToWKWebView  WK_API_AVAILABLE(macosx(10.13.4));
512 @property (nonatomic, readonly) BOOL _hasActiveVideoForControlsManager WK_API_AVAILABLE(macosx(10.12));
513 - (void)_requestControlledElementID WK_API_AVAILABLE(macosx(10.12.3));
514 - (void)_handleControlledElementIDResponse:(NSString *)identifier WK_API_AVAILABLE(macosx(10.12.3));
515 - (void)_handleAcceptedCandidate:(NSTextCheckingResult *)candidate WK_API_AVAILABLE(macosx(10.12.3));
516 - (void)_didHandleAcceptedCandidate WK_API_AVAILABLE(macosx(10.12.3));
517 - (void)_forceRequestCandidates WK_API_AVAILABLE(macosx(10.12.3));
518 - (void)_didUpdateCandidateListVisibility:(BOOL)visible WK_API_AVAILABLE(macosx(10.12.3));
519 @property (nonatomic, readonly) BOOL _shouldRequestCandidates WK_API_AVAILABLE(macosx(10.12.3));
520 - (void)_insertText:(id)string replacementRange:(NSRange)replacementRange WK_API_AVAILABLE(macosx(10.12.3));
521 - (NSRect)_candidateRect WK_API_AVAILABLE(macosx(10.13));
522 @property (nonatomic, readwrite, setter=_setUseSystemAppearance:) BOOL _useSystemAppearance WK_API_AVAILABLE(macosx(10.14));
523
524 - (void)_setHeaderBannerHeight:(int)height WK_API_AVAILABLE(macosx(10.12.3));
525 - (void)_setFooterBannerHeight:(int)height WK_API_AVAILABLE(macosx(10.12.3));
526 - (void)_doAfterProcessingAllPendingMouseEvents:(dispatch_block_t)action WK_API_AVAILABLE(macosx(WK_MAC_TBA));
527 #endif
528
529 - (void)_requestActiveNowPlayingSessionInfo:(void(^)(BOOL, BOOL, NSString*, double, double, NSInteger))callback WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
530
531 - (void)_setPageScale:(CGFloat)scale withOrigin:(CGPoint)origin WK_API_AVAILABLE(ios(10.3));
532 - (CGFloat)_pageScale WK_API_AVAILABLE(ios(10.3));
533
534 - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(10.12), ios(10.0));
535 - (void)_doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(10.14), ios(12.0));
536 - (void)_doAfterNextPresentationUpdateWithoutWaitingForPainting:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
537 - (void)_doAfterNextVisibleContentRectUpdate:(void (^)(void))updateBlock WK_API_AVAILABLE(macosx(10.13), ios(11.0));
538
539 - (void)_disableBackForwardSnapshotVolatilityForTesting WK_API_AVAILABLE(macosx(10.12.3), ios(10.3));
540 - (void)_executeEditCommand:(NSString *)command argument:(NSString *)argument completion:(void (^)(BOOL))completion WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
541
542 - (void)_denyNextUserMediaRequest WK_API_AVAILABLE(macosx(10.14), ios(12.0));
543
544 - (BOOL)_beginBackSwipeForTesting;
545 - (BOOL)_completeBackSwipeForTesting;
546 - (void)_setDefersLoadingForTesting:(BOOL)defersLoading;
547
548 - (void)_setShareSheetCompletesImmediatelyWithResolutionForTesting:(BOOL)resolved WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
549
550 @property (nonatomic, readonly) BOOL _hasInspectorFrontend WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
551 @property (nonatomic, readonly) _WKInspector *_inspector WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
552 @property (nonatomic, readonly) _WKFrameHandle *_mainFrame WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
553
554 - (void)_processWillSuspendImminentlyForTesting;
555 - (void)_processDidResumeForTesting;
556
557 @end