44d65b2c88b37957ce68fe9c4cfd4cab605ba5fb
[WebKit-https.git] / Source / WebKit2 / 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 "WKWebViewConfiguration.h"
32 #import <wtf/RefPtr.h>
33 #import <wtf/RetainPtr.h>
34
35 #if PLATFORM(IOS)
36 #import "UIKitSPI.h"
37 #import "WKContentView.h"
38 #import "WKContentViewInteraction.h"
39 #import <WebCore/FloatRect.h>
40 #endif
41
42 #if PLATFORM(IOS)
43 #define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate>
44 #endif
45
46 #if !defined(WK_WEB_VIEW_PROTOCOLS)
47 #define WK_WEB_VIEW_PROTOCOLS
48 #endif
49
50 typedef const struct OpaqueWKPage* WKPageRef;
51
52 namespace WebKit {
53 class ViewSnapshot;
54 class WebPageProxy;
55 struct PrintInfo;
56 }
57
58 @class WKWebViewContentProviderRegistry;
59 @class _WKFrameHandle;
60 @protocol _WKWebViewPrintProvider;
61
62 @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
63
64 @package
65     RetainPtr<WKWebViewConfiguration> _configuration;
66
67     RefPtr<WebKit::WebPageProxy> _page;
68
69 #if PLATFORM(IOS)
70     NSUInteger _activeFocusedStateRetainCount;
71 #endif
72 }
73
74 #if PLATFORM(IOS)
75 - (void)_processDidExit;
76
77 - (void)_didCommitLoadForMainFrame;
78 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
79 - (void)_layerTreeCommitComplete;
80
81 - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID;
82 - (void)_couldNotRestorePageState;
83 - (void)_restorePageScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatSize)topInset scale:(double)scale;
84 - (void)_restorePageStateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale; // FIXME: needs scroll origin?
85
86 - (PassRefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot;
87
88 - (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin;
89 - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
90 - (void)_scrollByContentOffset:(WebCore::FloatPoint)offset;
91 - (void)_zoomToFocusRect:(WebCore::FloatRect)focusedElementRect selectionRect:(WebCore::FloatRect)selectionRectInDocumentCoordinates fontSize:(float)fontSize minimumScale:(double)minimumScale maximumScale:(double)maximumScale allowScaling:(BOOL)allowScaling forceScroll:(BOOL)forceScroll;
92 - (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
93 - (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
94 - (void)_zoomToInitialScaleWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
95
96 - (void)_setHasCustomContentView:(BOOL)hasCustomContentView loadedMIMEType:(const WTF::String&)mimeType;
97 - (void)_didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:(const WTF::String&)suggestedFilename data:(NSData *)data;
98
99 - (void)_willInvokeUIScrollViewDelegateCallback;
100 - (void)_didInvokeUIScrollViewDelegateCallback;
101
102 - (void)_updateVisibleContentRects;
103 - (void)_updateVisibleContentRectAfterScrollInView:(UIScrollView *)scrollView;
104 - (void)_updateContentRectsWithState:(BOOL)inStableState;
105
106 - (void)_didFinishLoadForMainFrame;
107 - (void)_didFailLoadForMainFrame;
108 - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType;
109
110 - (BOOL)_isShowingVideoPictureInPicture;
111 - (BOOL)_mayAutomaticallyShowVideoPictureInPicture;
112
113 - (void)_updateScrollViewBackground;
114
115 - (void)_navigationGestureDidBegin;
116 - (void)_navigationGestureDidEnd;
117
118 @property (nonatomic, readonly) BOOL _isBackground;
119
120 @property (nonatomic, readonly) WKWebViewContentProviderRegistry *_contentProviderRegistry;
121
122 @property (nonatomic, readonly) WKSelectionGranularity _selectionGranularity;
123
124 @property (nonatomic, readonly) BOOL _allowsDoubleTapGestures;
125 @property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
126 #endif
127
128 - (WKPageRef)_pageForTesting;
129
130 @end
131
132 WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);
133
134 #if PLATFORM(IOS)
135 @interface WKWebView (_WKWebViewPrintFormatter)
136 @property (nonatomic, readonly) id <_WKWebViewPrintProvider> _printProvider;
137 @end
138 #endif
139
140 #endif