Unreviewed, fix iOS build with recent SDKs.
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKViewPrivate.h
1 /*
2  * Copyright (C) 2011, 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 #if !TARGET_OS_IPHONE
27
28 #import <WebKit/WKBase.h>
29 #import <WebKit/WKLayoutMode.h>
30 #import <WebKit/WKView.h>
31 #import <WebKit/_WKOverlayScrollbarStyle.h>
32
33 @class _WKLinkIconParameters;
34
35 @interface WKView (Private)
36
37 /* C SPI support. */
38
39 @property (readonly) WKPageRef pageRef;
40
41 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
42 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage;
43 - (id)initWithFrame:(NSRect)frame configurationRef:(WKPageConfigurationRef)configuration;
44
45 - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
46 - (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef;
47
48 - (void)setFrame:(NSRect)rect andScrollBy:(NSSize)offset;
49
50 // Stops updating the size of the page as the WKView frame size updates.
51 // This should always be followed by enableFrameSizeUpdates. Calls can be nested.
52 - (void)disableFrameSizeUpdates;
53 // Immediately updates the size of the page to match WKView's frame size
54 // and allows subsequent updates as the frame size is set. Calls can be nested.
55 - (void)enableFrameSizeUpdates;
56 - (BOOL)frameSizeUpdatesDisabled;
57
58 + (void)hideWordDefinitionWindow;
59
60 @property (readwrite) NSSize minimumSizeForAutoLayout;
61 @property (readwrite) BOOL shouldClipToVisibleRect;
62 @property (readwrite) BOOL shouldExpandToViewHeightForAutoLayout;
63 @property (readonly, getter=isUsingUISideCompositing) BOOL usingUISideCompositing;
64 @property (readwrite) BOOL allowsMagnification;
65 @property (readwrite) double magnification;
66 @property (readwrite, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents;
67 @property (readwrite, setter=_setIgnoresAllEvents:) BOOL _ignoresAllEvents;
68 @property (readwrite) BOOL allowsBackForwardNavigationGestures;
69 @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
70 @property (nonatomic, setter=_setTotalHeightOfBanners:) CGFloat _totalHeightOfBanners;
71
72 @property (nonatomic, setter=_setOverlayScrollbarStyle:) _WKOverlayScrollbarStyle _overlayScrollbarStyle;
73
74 @property (nonatomic, setter=_setLayoutMode:) WKLayoutMode _layoutMode;
75 // For use with _layoutMode = kWKLayoutModeFixedSize:
76 @property (nonatomic, setter=_setFixedLayoutSize:) CGSize _fixedLayoutSize;
77
78 @property (nonatomic, setter=_setViewScale:) CGFloat _viewScale;
79
80 @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_API_AVAILABLE(macos(10.11));
81
82 @property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
83
84 @property (readonly) NSColor *_pageExtendedBackgroundColor;
85 @property (copy, nonatomic) NSColor *underlayColor;
86
87 @property (nonatomic, setter=_setBackgroundColor:) NSColor *_backgroundColor WK_API_AVAILABLE(macos(10.14));
88
89 @property (strong, nonatomic, setter=_setInspectorAttachmentView:) NSView *_inspectorAttachmentView WK_API_AVAILABLE(macos(10.11));
90
91 @property (nonatomic, readwrite, setter=_setRequiresUserActionForEditingControlsManager:) BOOL _requiresUserActionForEditingControlsManager;
92
93 - (NSView*)fullScreenPlaceholderView;
94 - (NSWindow*)createFullScreenWindow;
95
96 - (void)beginDeferringViewInWindowChanges;
97 - (void)endDeferringViewInWindowChanges;
98 - (void)endDeferringViewInWindowChangesSync;
99 - (BOOL)isDeferringViewInWindowChanges;
100 - (void)_prepareForMoveToWindow:(NSWindow *)targetWindow withCompletionHandler:(void(^)(void))completionHandler;
101
102 - (BOOL)windowOcclusionDetectionEnabled;
103 - (void)setWindowOcclusionDetectionEnabled:(BOOL)flag;
104
105 - (void)setMagnification:(double)magnification centeredAtPoint:(NSPoint)point;
106
107 - (void)setAllowsLinkPreview:(BOOL)allowsLinkPreview;
108 - (BOOL)allowsLinkPreview;
109
110 - (void)saveBackForwardSnapshotForCurrentItem;
111 - (void)saveBackForwardSnapshotForItem:(WKBackForwardListItemRef)item;
112
113 // Views must be layer-backed, have no transform applied, be in back-to-front z-order, and the whole set must be a contiguous opaque rectangle.
114 - (void)_setCustomSwipeViews:(NSArray *)customSwipeViews;
115 // The top content inset is applied in the window's coordinate space, to the union of the custom swipe view's frames.
116 - (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset;
117 - (BOOL)_tryToSwipeWithEvent:(NSEvent *)event ignoringPinnedState:(BOOL)ignoringPinnedState;
118 // The rect returned is always that of the snapshot, and only if it is the view being manipulated by the swipe. This only works for layer-backed windows.
119 - (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect swipeSnapshotRectInWindowCoordinates))callback;
120
121 // Clients that want to maintain default behavior can return nil. To disable the immediate action entirely, return NSNull. And to
122 // do something custom, return an object that conforms to the NSImmediateActionAnimationController protocol.
123 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(uint32_t)type userData:(WKTypeRef)userData;
124
125 - (void)_prepareForImmediateActionAnimation;
126 - (void)_cancelImmediateActionAnimation;
127 - (void)_completeImmediateActionAnimation;
128
129 - (void)_dismissContentRelativeChildWindows;
130 - (void)_dismissContentRelativeChildWindowsWithAnimation:(BOOL)withAnimation;
131
132 - (void)_didChangeContentSize:(NSSize)newSize;
133
134 - (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event;
135
136 - (void)_setShouldSuppressFirstResponderChanges:(BOOL)shouldSuppress WK_API_AVAILABLE(macos(10.13.4));
137
138 @property (nonatomic, readwrite, setter=_setWantsMediaPlaybackControlsView:) BOOL _wantsMediaPlaybackControlsView;
139 @property (nonatomic, readonly)  id _mediaPlaybackControlsView;
140 - (void)_addMediaPlaybackControlsView:(id)mediaPlaybackControlsView;
141 - (void)_removeMediaPlaybackControlsView;
142
143 - (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_API_AVAILABLE(macos(10.13.4));
144
145 @property (nonatomic, readwrite, setter=_setUseSystemAppearance:) BOOL _useSystemAppearance WK_API_AVAILABLE(macos(10.14));
146
147 @end
148
149 @interface WKView (PrivateForSubclassToDefine)
150
151 // This a method that subclasses can define and WKView itself does not define. WKView will call the method if it is present.
152 - (void)_shouldLoadIconWithParameters:(_WKLinkIconParameters *)parameters completionHandler:(void (^)(void (^)(NSData *)))completionHandler;
153
154 @end
155
156 #endif // !TARGET_OS_IPHONE