[iOS] Hardware Keyboard: All combinations of arrow keys and space key do not scroll...
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / Cocoa / WKWebViewInternal.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 "WKWebViewPrivate.h"
27
28 #if WK_API_ENABLED
29
30 #import "SameDocumentNavigationType.h"
31 #import <wtf/RefPtr.h>
32 #import <wtf/RetainPtr.h>
33
34 #if PLATFORM(IOS)
35 #import "UIKitSPI.h"
36 #import "WKContentView.h"
37 #import "WKContentViewInteraction.h"
38 #import <WebCore/FloatRect.h>
39 #endif
40
41 #if PLATFORM(IOS)
42 #define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate>
43 #endif
44
45 #if !defined(WK_WEB_VIEW_PROTOCOLS)
46 #define WK_WEB_VIEW_PROTOCOLS
47 #endif
48
49 typedef const struct OpaqueWKPage* WKPageRef;
50
51 namespace WebKit {
52 class ViewSnapshot;
53 class WebPageProxy;
54 struct PrintInfo;
55 }
56
57 @class _WKFrameHandle;
58
59 @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
60
61 @package
62     RetainPtr<WKWebViewConfiguration> _configuration;
63
64     RefPtr<WebKit::WebPageProxy> _page;
65
66 #if PLATFORM(IOS)
67     NSUInteger _activeFocusedStateRetainCount;
68 #endif
69 }
70
71 #if PLATFORM(IOS)
72 - (void)_processDidExit;
73
74 - (void)_didCommitLoadForMainFrame;
75 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
76
77 - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID;
78 - (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale;
79 - (void)_restorePageStateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale;
80
81 - (PassRefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot;
82
83 - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset;
84 - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
85 - (void)_scrollByOffset:(WebCore::FloatPoint)offset;
86 - (void)_zoomToFocusRect:(WebCore::FloatRect)focusedElementRect selectionRect:(WebCore::FloatRect)selectionRectInDocumentCoordinates fontSize:(float)fontSize minimumScale:(double)minimumScale maximumScale:(double)maximumScale allowScaling:(BOOL)allowScaling forceScroll:(BOOL)forceScroll;
87 - (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
88 - (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
89
90 - (void)_setHasCustomContentView:(BOOL)hasCustomContentView loadedMIMEType:(const WTF::String&)mimeType;
91 - (void)_didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:(const WTF::String&)suggestedFilename data:(NSData *)data;
92 - (void)_setViewportMetaTagWidth:(float)newWidth;
93
94 - (void)_willInvokeUIScrollViewDelegateCallback;
95 - (void)_didInvokeUIScrollViewDelegateCallback;
96
97 - (void)_updateVisibleContentRects;
98
99 - (void)_didFinishLoadForMainFrame;
100 - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType;
101
102 - (BOOL)_isShowingVideoPictureInPicture;
103 - (BOOL)_mayAutomaticallyShowVideoPictureInPicture;
104
105 - (void)_updateScrollViewBackground;
106
107 - (void)_navigationGestureDidBegin;
108 - (void)_navigationGestureDidEnd;
109
110 @property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
111 #else
112 @property (nonatomic, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents;
113 #endif
114
115 - (WKPageRef)_pageForTesting;
116
117 @end
118
119 WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);
120
121 #if PLATFORM(IOS)
122 @interface WKWebView (_WKWebViewPrintFormatter)
123 - (NSInteger)_computePageCountAndStartDrawingToPDFForFrame:(_WKFrameHandle *)frame printInfo:(const WebKit::PrintInfo&)printInfo firstPage:(uint32_t)firstPage computedTotalScaleFactor:(double&)totalScaleFactor;
124 - (void)_endPrinting;
125 @property (nonatomic, setter=_setPrintedDocument:) CGPDFDocumentRef _printedDocument;
126 @end
127 #endif
128
129 #endif