Adjust keyboard scrolling animator to springy and semiphysical
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKWebViewInternal.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 "WKWebViewPrivate.h"
27
28 #if WK_API_ENABLED
29
30 #import "SameDocumentNavigationType.h"
31 #import "WKShareSheet.h"
32 #import "WKWebViewConfiguration.h"
33 #import "_WKAttachmentInternal.h"
34 #import "_WKWebViewPrintFormatterInternal.h"
35 #import <wtf/RefPtr.h>
36 #import <wtf/RetainPtr.h>
37
38 #if PLATFORM(IOS)
39 #import "UIKitSPI.h"
40 #import "WKContentView.h"
41 #import "WKContentViewInteraction.h"
42 #import "WKFullScreenWindowControllerIOS.h"
43 #import <WebCore/FloatRect.h>
44 #import <WebCore/LengthBox.h>
45 #endif
46
47 #if PLATFORM(IOS)
48 #define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate>
49 #endif
50
51 #if PLATFORM(MAC)
52 #define WK_WEB_VIEW_PROTOCOLS <WKShareSheetDelegate>
53 #endif
54
55 #if !defined(WK_WEB_VIEW_PROTOCOLS)
56 #define WK_WEB_VIEW_PROTOCOLS
57 #endif
58
59 typedef const struct OpaqueWKPage* WKPageRef;
60
61 namespace API {
62 class Attachment;
63 }
64
65 namespace WebKit {
66 class ViewSnapshot;
67 class WebPageProxy;
68 struct PrintInfo;
69 }
70
71 @class WKWebViewContentProviderRegistry;
72 @class WKPasswordView;
73 @class _WKFrameHandle;
74
75 @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
76
77 @package
78     RetainPtr<WKWebViewConfiguration> _configuration;
79
80     RefPtr<WebKit::WebPageProxy> _page;
81 }
82
83 #if PLATFORM(IOS)
84 - (void)_processDidExit;
85 - (void)_processWillSwap;
86 - (void)_didRelaunchProcess;
87
88 - (void)_didCommitLoadForMainFrame;
89 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
90 - (void)_layerTreeCommitComplete;
91
92 - (void)_couldNotRestorePageState;
93 - (void)_restorePageScrollPosition:(std::optional<WebCore::FloatPoint>)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatBoxExtent)insets scale:(double)scale;
94 - (void)_restorePageStateToUnobscuredCenter:(std::optional<WebCore::FloatPoint>)center scale:(double)scale; // FIXME: needs scroll origin?
95
96 - (RefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot;
97
98 - (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin;
99 - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
100 - (void)_zoomToFocusRect:(WebCore::FloatRect)focusedElementRect selectionRect:(WebCore::FloatRect)selectionRectInDocumentCoordinates insideFixed:(BOOL)insideFixed fontSize:(float)fontSize minimumScale:(double)minimumScale maximumScale:(double)maximumScale allowScaling:(BOOL)allowScaling forceScroll:(BOOL)forceScroll;
101 - (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
102 - (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
103 - (void)_zoomToInitialScaleWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
104
105 - (void)_setHasCustomContentView:(BOOL)hasCustomContentView loadedMIMEType:(const WTF::String&)mimeType;
106 - (void)_didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:(const WTF::String&)suggestedFilename data:(NSData *)data;
107
108 - (void)_willInvokeUIScrollViewDelegateCallback;
109 - (void)_didInvokeUIScrollViewDelegateCallback;
110
111 - (void)_scheduleVisibleContentRectUpdate;
112
113 - (void)_didCompleteAnimatedResize;
114
115 - (void)_didStartProvisionalLoadForMainFrame;
116 - (void)_didFinishLoadForMainFrame;
117 - (void)_didFailLoadForMainFrame;
118 - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType;
119
120 - (BOOL)_isShowingVideoPictureInPicture;
121 - (BOOL)_mayAutomaticallyShowVideoPictureInPicture;
122
123 - (void)_updateScrollViewBackground;
124
125 - (void)_videoControlsManagerDidChange;
126
127 - (void)_navigationGestureDidBegin;
128 - (void)_navigationGestureDidEnd;
129 - (BOOL)_isNavigationSwipeGestureRecognizer:(UIGestureRecognizer *)recognizer;
130
131 - (void)_showPasswordViewWithDocumentName:(NSString *)documentName passwordHandler:(void (^)(NSString *))passwordHandler;
132 - (void)_hidePasswordView;
133
134 - (void)_didChangeEditorState;
135
136 - (void)_addShortcut:(id)sender;
137 - (void)_define:(id)sender;
138 - (void)_lookup:(id)sender;
139 - (void)_share:(id)sender;
140 - (void)_showTextStyleOptions:(id)sender;
141 - (void)_promptForReplace:(id)sender;
142 - (void)_transliterateChinese:(id)sender;
143 - (void)replace:(id)sender;
144
145 - (void)_incrementFocusPreservationCount;
146 - (void)_decrementFocusPreservationCount;
147 - (void)_resetFocusPreservationCount;
148
149 @property (nonatomic, readonly) WKPasswordView *_passwordView;
150
151 @property (nonatomic, readonly) BOOL _isBackground;
152
153 @property (nonatomic, readonly) WKWebViewContentProviderRegistry *_contentProviderRegistry;
154
155 @property (nonatomic, readonly) WKSelectionGranularity _selectionGranularity;
156
157 @property (nonatomic, readonly) BOOL _allowsDoubleTapGestures;
158 @property (nonatomic, readonly) BOOL _haveSetObscuredInsets;
159 @property (nonatomic, readonly) UIEdgeInsets _computedObscuredInset;
160 @property (nonatomic, readonly) UIEdgeInsets _computedUnobscuredSafeAreaInset;
161 @property (nonatomic, readonly, getter=_isRetainingActiveFocusedState) BOOL _retainingActiveFocusedState;
162 #endif
163
164 #if ENABLE(ACCESSIBILITY_EVENTS)
165 - (void)_updateAccessibilityEventsEnabled;
166 #endif
167
168 #if ENABLE(ATTACHMENT_ELEMENT)
169 - (void)_didRemoveAttachment:(API::Attachment&)attachment;
170 - (void)_didInsertAttachment:(API::Attachment&)attachment withSource:(NSString *)source;
171 #endif
172
173 - (WKPageRef)_pageForTesting;
174 - (WebKit::WebPageProxy*)_page;
175
176 @end
177
178 WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);
179
180 #if ENABLE(FULLSCREEN_API) && PLATFORM(IOS)
181 @interface WKWebView (FullScreenAPI)
182 -(BOOL)hasFullScreenWindowController;
183 -(WKFullScreenWindowController *)fullScreenWindowController;
184 -(void)closeFullScreenWindowController;
185 @end
186 #endif // ENABLE(FULLSCREEN_API) && PLATFORM(IOS)
187
188 #if PLATFORM(IOS) && !PLATFORM(IOSMAC)
189 @interface WKWebView (_WKWebViewPrintFormatter)
190 @property (nonatomic, readonly) id <_WKWebViewPrintProvider> _printProvider;
191 @end
192 #endif
193
194 #endif