Swipe snapshot removed too early (jumps around) on arstechnica and NYT
[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 namespace WebKit {
50 class ViewSnapshot;
51 class WebPageProxy;
52 struct PrintInfo;
53 }
54
55 @class _WKFrameHandle;
56
57 @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
58
59 @package
60     RetainPtr<WKWebViewConfiguration> _configuration;
61
62     RefPtr<WebKit::WebPageProxy> _page;
63
64 #if PLATFORM(IOS)
65     NSUInteger _activeFocusedStateRetainCount;
66 #endif
67 }
68
69 #if PLATFORM(IOS)
70 - (void)_processDidExit;
71
72 - (void)_didCommitLoadForMainFrame;
73 - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
74
75 - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID;
76 - (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale;
77 - (void)_restorePageStateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale;
78
79 - (PassRefPtr<WebKit::ViewSnapshot>)_takeViewSnapshot;
80
81 - (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset;
82 - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
83 - (void)_zoomToFocusRect:(WebCore::FloatRect)focusedElementRect selectionRect:(WebCore::FloatRect)selectionRectInDocumentCoordinates fontSize:(float)fontSize minimumScale:(double)minimumScale maximumScale:(double)maximumScale allowScaling:(BOOL)allowScaling forceScroll:(BOOL)forceScroll;
84 - (BOOL)_zoomToRect:(WebCore::FloatRect)targetRect withOrigin:(WebCore::FloatPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(float)minimumScrollDistance;
85 - (void)_zoomOutWithOrigin:(WebCore::FloatPoint)origin animated:(BOOL)animated;
86
87 - (void)_setHasCustomContentView:(BOOL)hasCustomContentView loadedMIMEType:(const WTF::String&)mimeType;
88 - (void)_didFinishLoadingDataForCustomContentProviderWithSuggestedFilename:(const WTF::String&)suggestedFilename data:(NSData *)data;
89 - (void)_setViewportMetaTagWidth:(float)newWidth;
90
91 - (void)_willInvokeUIScrollViewDelegateCallback;
92 - (void)_didInvokeUIScrollViewDelegateCallback;
93
94 - (void)_updateVisibleContentRects;
95
96 - (void)_didFinishLoadForMainFrame;
97 - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType;
98
99 - (BOOL)_isShowingVideoOptimized;
100 - (BOOL)_mayAutomaticallyShowVideoOptimized;
101
102 @property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
103 #else
104 @property (nonatomic, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents;
105 #endif
106
107 @end
108
109 WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);
110
111 #if PLATFORM(IOS)
112 @interface WKWebView (_WKWebViewPrintFormatter)
113 - (NSInteger)_computePageCountAndStartDrawingToPDFForFrame:(_WKFrameHandle *)frame printInfo:(const WebKit::PrintInfo&)printInfo firstPage:(uint32_t)firstPage computedTotalScaleFactor:(double&)totalScaleFactor;
114 - (void)_endPrinting;
115 @property (nonatomic, setter=_setPrintedDocument:) CGPDFDocumentRef _printedDocument;
116 @end
117 #endif
118
119 #endif