2 * Copyright (C) 2014 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #import <WebKit/WKWebView.h>
30 typedef NS_OPTIONS(NSUInteger, _WKRenderingProgressEvents) {
31 _WKRenderingProgressEventFirstLayout = 1 << 0,
32 _WKRenderingProgressEventFirstPaintWithSignificantArea = 1 << 2,
33 } WK_ENUM_AVAILABLE(10_10, 8_0);
35 typedef NS_ENUM(NSInteger, _WKPaginationMode) {
36 _WKPaginationModeUnpaginated,
37 _WKPaginationModeLeftToRight,
38 _WKPaginationModeRightToLeft,
39 _WKPaginationModeTopToBottom,
40 _WKPaginationModeBottomToTop,
41 } WK_ENUM_AVAILABLE(10_10, 8_0);
43 typedef NS_OPTIONS(NSUInteger, _WKFindOptions) {
44 _WKFindOptionsCaseInsensitive = 1 << 0,
45 _WKFindOptionsAtWordStarts = 1 << 1,
46 _WKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
47 _WKFindOptionsBackwards = 1 << 3,
48 _WKFindOptionsWrapAround = 1 << 4,
49 _WKFindOptionsShowOverlay = 1 << 5,
50 _WKFindOptionsShowFindIndicator = 1 << 6,
51 _WKFindOptionsShowHighlight = 1 << 7,
52 _WKFindOptionsDetermineMatchIndex = 1 << 8,
53 } WK_ENUM_AVAILABLE(10_10, 8_0);
55 @class WKBrowsingContextHandle;
56 @class _WKRemoteObjectRegistry;
57 @class _WKWebViewPrintFormatter;
59 @protocol WKHistoryDelegatePrivate;
60 @protocol _WKFindDelegate;
61 @protocol _WKFormDelegate;
63 @interface WKWebView (WKPrivate)
65 // FIXME: This should return a _WKRemoteObjectRegistry *.
66 @property (nonatomic, readonly) id _remoteObjectRegistry;
67 @property (nonatomic, readonly) WKBrowsingContextHandle *_handle;
69 @property (nonatomic, setter=_setObservedRenderingProgressEvents:) _WKRenderingProgressEvents _observedRenderingProgressEvents;
71 @property (nonatomic, weak, setter=_setHistoryDelegate:) id <WKHistoryDelegatePrivate> _historyDelegate;
73 @property (nonatomic, readonly) NSURL *_unreachableURL;
75 - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL;
77 - (WKNavigation *)_reload;
79 @property (nonatomic, readonly) NSArray *_certificateChain;
80 @property (nonatomic, readonly) NSURL *_committedURL;
81 @property (nonatomic, readonly) NSString *_MIMEType;
83 @property (copy, setter=_setApplicationNameForUserAgent:) NSString *_applicationNameForUserAgent;
84 @property (copy, setter=_setCustomUserAgent:) NSString *_customUserAgent;
86 @property (nonatomic, readonly) pid_t _webProcessIdentifier;
88 @property (nonatomic, readonly) NSData *_sessionState;
89 - (void)_restoreFromSessionState:(NSData *)sessionState;
91 @property (nonatomic, setter=_setAllowsRemoteInspection:) BOOL _allowsRemoteInspection;
93 @property (nonatomic, setter=_setAddsVisitedLinks:) BOOL _addsVisitedLinks;
98 // DERECATED: The setters of the three following function are deprecated, please use overrideLayoutParameters.
99 // Define the smallest size a page take with a regular viewport.
100 @property (nonatomic, setter=_setMinimumLayoutSizeOverride:) CGSize _minimumLayoutSizeOverride;
101 // Define the smallest size a page take with the minmal-ui viewport.
102 @property (nonatomic, setter=_setMinimumLayoutSizeOverrideForMinimalUI:) CGSize _minimumLayoutSizeOverrideForMinimalUI;
103 // Define the largest size the unobscured area can get for the current view bounds. This value is used to define viewport units.
104 @property (nonatomic, setter=_setMaximumUnobscuredSizeOverride:) CGSize _maximumUnobscuredSizeOverride;
106 @property (nonatomic, readonly) BOOL _usesMinimalUI;
108 // Define the inset of the scrollview unusable by the web page.
109 @property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
111 // Override the interface orientation. Clients using _beginAnimatedResizeWithUpdates: must update the interface orientation
112 // in the update block.
113 @property (nonatomic, setter=_setInterfaceOrientationOverride:) UIInterfaceOrientation _interfaceOrientationOverride;
115 @property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage;
117 // FIXME: Remove these three properties once we expose WKWebViewContentProvider as API.
118 @property (nonatomic, readonly, getter=_isDisplayingPDF) BOOL _displayingPDF;
119 @property (nonatomic, readonly) NSData *_dataForDisplayedPDF;
120 // FIXME: This can be removed once WKNavigation's response property is implemented.
121 @property (nonatomic, readonly) NSString *_suggestedFilenameForDisplayedPDF;
123 // The viewport meta tag width is negative if the value is not defined.
124 @property (nonatomic, readonly) CGFloat _viewportMetaTagWidth;
126 @property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter;
128 - (void)_beginInteractiveObscuredInsetsChange;
129 - (void)_endInteractiveObscuredInsetsChange;
131 - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock;
132 - (void)_endAnimatedResize;
134 - (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)imageWidth completionHandler:(void(^)(CGImageRef))completionHandler;
136 - (void)_overrideLayoutParametersWithMinimumLayoutSize:(CGSize)minimumLayoutSize minimumLayoutSizeForMinimalUI:(CGSize)minimumLayoutSizeForMinimalUI maximumUnobscuredSizeOverride:(CGSize)maximumUnobscuredSizeOverride;
138 - (UIView *)_viewForFindUI;
140 - (void)_setOverlaidAccessoryViewsInset:(CGSize)inset;
142 - (void)_killWebContentProcess;
143 - (void)_didRelaunchProcess;
146 @property (readonly) NSColor *_pageExtendedBackgroundColor;
147 @property (nonatomic, setter=_setDrawsTransparentBackground:) BOOL _drawsTransparentBackground;
148 @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
149 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
150 @property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
154 - (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
155 - (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
157 @property (nonatomic, setter=_setPaginationMode:) _WKPaginationMode _paginationMode;
158 // Whether the column-break-{before,after} properties are respected instead of the
159 // page-break-{before,after} properties.
160 @property (nonatomic, setter=_setPaginationBehavesLikeColumns:) BOOL _paginationBehavesLikeColumns;
161 // Set to 0 to have the page length equal the view length.
162 @property (nonatomic, setter=_setPageLength:) CGFloat _pageLength;
163 @property (nonatomic, setter=_setGapBetweenPages:) CGFloat _gapBetweenPages;
164 @property (readonly) NSUInteger _pageCount;
166 @property (nonatomic, readonly) BOOL _supportsTextZoom;
167 @property (nonatomic, setter=_setTextZoomFactor:) double _textZoomFactor;
168 @property (nonatomic, setter=_setPageZoomFactor:) double _pageZoomFactor;
170 @property (nonatomic, weak, setter=_setFindDelegate:) id <_WKFindDelegate> _findDelegate;
171 - (void)_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
172 - (void)_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
175 @property (nonatomic, weak, setter=_setFormDelegate:) id <_WKFormDelegate> _formDelegate;
177 @property (nonatomic, readonly, getter=_isDisplayingStandaloneImageDocument) BOOL _displayingStandaloneImageDocument;