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#import <WebKit/WKBase.h> 27#import <WebKit/WKView.h> 28 29@interface WKView (Private) 30 31/* C SPI support. */ 32 33@property (readonly) WKPageRef pageRef; 34 35#if TARGET_OS_IPHONE 36- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef; 37- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage; 38#else 39- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef; 40- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage; 41#endif 42 43#if TARGET_OS_IPHONE 44 45@property (nonatomic) CGSize minimumLayoutSizeOverride; 46 47// Define the inset of the scrollview unusable by the web page. 48@property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets; 49 50@property (nonatomic, setter=_setBackgroundExtendsBeyondPage:) BOOL _backgroundExtendsBeyondPage; 51 52// This is deprecated and should be removed entirely: <rdar://problem/16294704>. 53@property (readonly) UIColor *_pageExtendedBackgroundColor; 54 55- (void)_beginInteractiveObscuredInsetsChange; 56- (void)_endInteractiveObscuredInsetsChange; 57 58#else 59 60- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef; 61- (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef; 62 63- (void)setFrame:(NSRect)rect andScrollBy:(NSSize)offset; 64 65// Stops updating the size of the page as the WKView frame size updates. 66// This should always be followed by enableFrameSizeUpdates. Calls can be nested. 67- (void)disableFrameSizeUpdates; 68// Immediately updates the size of the page to match WKView's frame size 69// and allows subsequent updates as the frame size is set. Calls can be nested. 70- (void)enableFrameSizeUpdates; 71- (BOOL)frameSizeUpdatesDisabled; 72 73+ (void)hideWordDefinitionWindow; 74 75@property (readwrite) CGFloat minimumLayoutWidth; 76@property (readwrite) CGFloat minimumWidthForAutoLayout; 77@property (readwrite) NSSize minimumSizeForAutoLayout; 78@property (readwrite) BOOL shouldClipToVisibleRect; 79@property (readwrite) BOOL shouldExpandToViewHeightForAutoLayout; 80@property (readonly, getter=isUsingUISideCompositing) BOOL usingUISideCompositing; 81@property (readwrite) BOOL allowsMagnification; 82@property (readwrite) double magnification; 83@property (readwrite) BOOL allowsBackForwardNavigationGestures; 84@property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset; 85 86#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 87@property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets; 88#endif 89 90@property (readonly) NSColor *_pageExtendedBackgroundColor; 91@property(copy, nonatomic) NSColor *underlayColor; 92 93- (NSView*)fullScreenPlaceholderView; 94- (NSWindow*)createFullScreenWindow; 95 96- (void)beginDeferringViewInWindowChanges; 97- (void)endDeferringViewInWindowChanges; 98- (void)endDeferringViewInWindowChangesSync; 99- (BOOL)isDeferringViewInWindowChanges; 100 101- (BOOL)windowOcclusionDetectionEnabled; 102- (void)setWindowOcclusionDetectionEnabled:(BOOL)flag; 103 104- (void)forceAsyncDrawingAreaSizeUpdate:(NSSize)size; 105- (void)waitForAsyncDrawingAreaSizeUpdate; 106 107- (void)setMagnification:(double)magnification centeredAtPoint:(NSPoint)point; 108 109- (void)saveBackForwardSnapshotForCurrentItem; 110 111// 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. 112- (void)_setCustomSwipeViews:(NSArray *)customSwipeViews; 113// The top content inset is applied in the window's coordinate space, to the union of the custom swipe view's frames. 114- (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset; 115- (BOOL)_tryToSwipeWithEvent:(NSEvent *)event ignoringPinnedState:(BOOL)ignoringPinnedState; 116// 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. 117- (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect swipeSnapshotRectInWindowCoordinates))callback; 118 119#endif 120 121@end 122