Title: [223267] trunk/Source/WebKit
Revision
223267
Author
[email protected]
Date
2017-10-12 17:41:45 -0700 (Thu, 12 Oct 2017)

Log Message

Expose some of WKView's WebViewImpl accessors through WKWebViewPrivate
https://bugs.webkit.org/show_bug.cgi?id=178240
<rdar://problem/34962720>

Reviewed by Tim Horton.
        
Also renamed createFullScreenWindow to fullScreenWindow to reflect the fact that it returns
an autoreleased NSWindow so we don't make the same naming mistake in the WKWebView SPI.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _dismissContentRelativeChildWindows]):
(-[WKWebView _setFrame:andScrollBy:]):
(-[WKWebView _setTotalHeightOfBanners:]):
(-[WKWebView _totalHeightOfBanners]):
(-[WKWebView _beginDeferringViewInWindowChanges]):
(-[WKWebView _endDeferringViewInWindowChanges]):
(-[WKWebView _endDeferringViewInWindowChangesSync]):
(-[WKWebView _gestureEventWasNotHandledByWebCore:]):
(-[WKWebView _setIgnoresNonWheelEvents:]):
(-[WKWebView _ignoresNonWheelEvents]):
(-[WKWebView _setCustomSwipeViews:]):
(-[WKWebView _setCustomSwipeViewsTopContentInset:]):
(-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]):
(-[WKWebView _setDidMoveSwipeSnapshotCallback:]):
(-[WKWebView _fullScreenPlaceholderView]):
(-[WKWebView _fullScreenWindow]):
(-[WKWebView _disableFrameSizeUpdates]):
(-[WKWebView _enableFrameSizeUpdates]):
(-[WKWebView _canChangeFrameLayout:]):
(-[WKWebView _underlayColor]):
(-[WKWebView _setUnderlayColor:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView createFullScreenWindow]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::fullScreenWindowController):
(WebKit::WebViewImpl::fullScreenWindow):
(WebKit::WebViewImpl::createFullScreenWindow): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (223266 => 223267)


--- trunk/Source/WebKit/ChangeLog	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/ChangeLog	2017-10-13 00:41:45 UTC (rev 223267)
@@ -1,3 +1,45 @@
+2017-10-12  Alex Christensen  <[email protected]>
+
+        Expose some of WKView's WebViewImpl accessors through WKWebViewPrivate
+        https://bugs.webkit.org/show_bug.cgi?id=178240
+        <rdar://problem/34962720>
+
+        Reviewed by Tim Horton.
+        
+        Also renamed createFullScreenWindow to fullScreenWindow to reflect the fact that it returns
+        an autoreleased NSWindow so we don't make the same naming mistake in the WKWebView SPI.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _dismissContentRelativeChildWindows]):
+        (-[WKWebView _setFrame:andScrollBy:]):
+        (-[WKWebView _setTotalHeightOfBanners:]):
+        (-[WKWebView _totalHeightOfBanners]):
+        (-[WKWebView _beginDeferringViewInWindowChanges]):
+        (-[WKWebView _endDeferringViewInWindowChanges]):
+        (-[WKWebView _endDeferringViewInWindowChangesSync]):
+        (-[WKWebView _gestureEventWasNotHandledByWebCore:]):
+        (-[WKWebView _setIgnoresNonWheelEvents:]):
+        (-[WKWebView _ignoresNonWheelEvents]):
+        (-[WKWebView _setCustomSwipeViews:]):
+        (-[WKWebView _setCustomSwipeViewsTopContentInset:]):
+        (-[WKWebView _tryToSwipeWithEvent:ignoringPinnedState:]):
+        (-[WKWebView _setDidMoveSwipeSnapshotCallback:]):
+        (-[WKWebView _fullScreenPlaceholderView]):
+        (-[WKWebView _fullScreenWindow]):
+        (-[WKWebView _disableFrameSizeUpdates]):
+        (-[WKWebView _enableFrameSizeUpdates]):
+        (-[WKWebView _canChangeFrameLayout:]):
+        (-[WKWebView _underlayColor]):
+        (-[WKWebView _setUnderlayColor:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView createFullScreenWindow]):
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::fullScreenWindowController):
+        (WebKit::WebViewImpl::fullScreenWindow):
+        (WebKit::WebViewImpl::createFullScreenWindow): Deleted.
+
 2017-10-12  Youenn Fablet  <[email protected]>
 
         Layout Test http/tests/cache-storage/cache-clearing.https.html is failing

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2017-10-13 00:41:45 UTC (rev 223267)
@@ -149,7 +149,10 @@
 - (NSInteger)_webView:(WKWebView *)webView dataOwnerForDragSession:(id <UIDragSession>)session WK_API_AVAILABLE(ios(11.0));
 #endif
 - (void)_webView:(WKWebView *)webView didChangeSafeAreaShouldAffectObscuredInsets:(BOOL)safeAreaShouldAffectObscuredInsets WK_API_AVAILABLE(ios(11.0));
-#else
+#else // TARGET_OS_IPHONE
+- (void)_prepareForImmediateActionAnimationForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_cancelImmediateActionAnimationForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_completeImmediateActionAnimationForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_showWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_focusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_unfocusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
@@ -174,7 +177,7 @@
 - (void)_webView:(WKWebView *)webView unavailablePlugInButtonClickedWithReason:(_WKPlugInUnavailabilityReason)reason plugInInfo:(NSDictionary *)plugInInfo;
 - (NSMenu *)_webView:(WKWebView *)webView contextMenu:(NSMenu *)menu forElement:(_WKContextMenuElementInfo *)element WK_API_AVAILABLE(macosx(10.12));
 - (NSMenu *)_webView:(WKWebView *)webView contextMenu:(NSMenu *)menu forElement:(_WKContextMenuElementInfo *)element userInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(10.12));
-#endif
+#endif // TARGET_OS_IPHONE
 
 @end
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKViewPrivate.h	2017-10-13 00:41:45 UTC (rev 223267)
@@ -26,7 +26,6 @@
 #if !TARGET_OS_IPHONE
 
 #import <WebKit/WKBase.h>
-#import <WebKit/WKImmediateActionTypes.h>
 #import <WebKit/WKLayoutMode.h>
 #import <WebKit/WKView.h>
 #import <WebKit/_WKOverlayScrollbarStyle.h>

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-10-13 00:41:45 UTC (rev 223267)
@@ -3683,18 +3683,31 @@
     return [self _immediateActionAnimationControllerForHitTestResult:wrapper(*hitTestResult) withType:(_WKImmediateActionType)type userData:data];
 }
 
-// We don't expose these various bits of SPI like WKView does,
-// so have these internal methods just do the work (or do nothing):
 - (void)_web_prepareForImmediateActionAnimation
 {
+    id <WKUIDelegatePrivate> uiDelegate = (id <WKUIDelegatePrivate>)[self UIDelegate];
+    if ([uiDelegate respondsToSelector:@selector(_prepareForImmediateActionAnimationForWebView:)])
+        [uiDelegate _prepareForImmediateActionAnimationForWebView:self];
+    else
+        [self _prepareForImmediateActionAnimation];
 }
 
 - (void)_web_cancelImmediateActionAnimation
 {
+    id <WKUIDelegatePrivate> uiDelegate = (id <WKUIDelegatePrivate>)[self UIDelegate];
+    if ([uiDelegate respondsToSelector:@selector(_cancelImmediateActionAnimationForWebView:)])
+        [uiDelegate _cancelImmediateActionAnimationForWebView:self];
+    else
+        [self _cancelImmediateActionAnimation];
 }
 
 - (void)_web_completeImmediateActionAnimation
 {
+    id <WKUIDelegatePrivate> uiDelegate = (id <WKUIDelegatePrivate>)[self UIDelegate];
+    if ([uiDelegate respondsToSelector:@selector(_completeImmediateActionAnimationForWebView:)])
+        [uiDelegate _completeImmediateActionAnimationForWebView:self];
+    else
+        [self _completeImmediateActionAnimation];
 }
 
 - (void)_web_didChangeContentSize:(NSSize)newSize
@@ -5348,7 +5361,7 @@
 
 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(_WKFrameHandle *)frameHandle
 {
-    if (auto webFrameProxy = _page->process().webFrame(frameHandle._frameID))
+    if (auto* webFrameProxy = _page->process().webFrame(frameHandle._frameID))
         return _impl->printOperationWithPrintInfo(printInfo, *webFrameProxy);
     return nil;
 }
@@ -5660,6 +5673,125 @@
     return toAPI(_page.get());
 }
 
+- (void)_dismissContentRelativeChildWindows
+{
+    _impl->dismissContentRelativeChildWindowsFromViewOnly();
+}
+
+- (void)_setFrame:(NSRect)rect andScrollBy:(NSSize)offset
+{
+    _impl->setFrameAndScrollBy(NSRectToCGRect(rect), NSSizeToCGSize(offset));
+}
+
+- (void)_setTotalHeightOfBanners:(CGFloat)totalHeightOfBanners
+{
+    _impl->setTotalHeightOfBanners(totalHeightOfBanners);
+}
+
+- (CGFloat)_totalHeightOfBanners
+{
+    return _impl->totalHeightOfBanners();
+}
+
+- (void)_beginDeferringViewInWindowChanges
+{
+    _impl->beginDeferringViewInWindowChanges();
+}
+
+- (void)_endDeferringViewInWindowChanges
+{
+    _impl->endDeferringViewInWindowChanges();
+}
+
+- (void)_endDeferringViewInWindowChangesSync
+{
+    _impl->endDeferringViewInWindowChangesSync();
+}
+
+- (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event
+{
+    _impl->gestureEventWasNotHandledByWebCoreFromViewOnly(event);
+}
+
+- (void)_setIgnoresNonWheelEvents:(BOOL)ignoresNonWheelEvents
+{
+    _impl->setIgnoresNonWheelEvents(ignoresNonWheelEvents);
+}
+
+- (BOOL)_ignoresNonWheelEvents
+{
+    return _impl->ignoresNonWheelEvents();
+}
+
+- (void)_setCustomSwipeViews:(NSArray *)customSwipeViews
+{
+    _impl->setCustomSwipeViews(customSwipeViews);
+}
+
+- (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset
+{
+    _impl->setCustomSwipeViewsTopContentInset(topContentInset);
+}
+
+- (BOOL)_tryToSwipeWithEvent:(NSEvent *)event ignoringPinnedState:(BOOL)ignoringPinnedState
+{
+    return _impl->tryToSwipeWithEvent(event, ignoringPinnedState);
+}
+
+- (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect))callback
+{
+    _impl->setDidMoveSwipeSnapshotCallback(callback);
+}
+
+- (NSView *)_fullScreenPlaceholderView
+{
+    return _impl->fullScreenPlaceholderView();
+}
+
+- (NSWindow *)_fullScreenWindow
+{
+    return _impl->fullScreenWindow();
+}
+
+- (void)_disableFrameSizeUpdates
+{
+    _impl->disableFrameSizeUpdates();
+}
+
+- (void)_enableFrameSizeUpdates
+{
+    _impl->enableFrameSizeUpdates();
+}
+
+- (void)_prepareForImmediateActionAnimation
+{
+}
+
+- (void)_cancelImmediateActionAnimation
+{
+}
+
+- (void)_completeImmediateActionAnimation
+{
+}
+
+- (BOOL)_canChangeFrameLayout:(_WKFrameHandle *)frameHandle
+{
+    if (auto* webFrameProxy = _page->process().webFrame(frameHandle._frameID))
+        return _impl->canChangeFrameLayout(*webFrameProxy);
+    return false;
+}
+
+- (NSColor *)_underlayColor
+{
+    return _impl->underlayColor();
+}
+
+- (void)_setUnderlayColor:(NSColor *)underlayColor
+{
+    _impl->setUnderlayColor(underlayColor);
+}
+
 - (BOOL)_hasActiveVideoForControlsManager
 {
     return _page && _page->hasActiveVideoForControlsManager();

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2017-10-13 00:41:45 UTC (rev 223267)
@@ -385,9 +385,28 @@
 - (void)_requestActivatedElementAtPosition:(CGPoint)position completionBlock:(void (^)(_WKActivatedElementInfo *))block WK_API_AVAILABLE(ios(11.0));
 - (void)_accessibilityRetrieveRectsAtSelectionOffset:(NSInteger)offset withText:(NSString *)text completionHandler:(void (^)(NSArray<NSValue *> *rects))completionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
 
-#endif // TARGET_OS_IPHONE
-
-#if !TARGET_OS_IPHONE
+#else
+- (void)_dismissContentRelativeChildWindows WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_setFrame:(NSRect)rect andScrollBy:(NSSize)offset WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_beginDeferringViewInWindowChanges WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_endDeferringViewInWindowChanges WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_endDeferringViewInWindowChangesSync WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_setCustomSwipeViews:(NSArray *)customSwipeViews WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_setCustomSwipeViewsTopContentInset:(float)topContentInset WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (NSView *)_fullScreenPlaceholderView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (NSWindow *)_fullScreenWindow WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_disableFrameSizeUpdates WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_enableFrameSizeUpdates WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_prepareForImmediateActionAnimation WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_cancelImmediateActionAnimation WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_completeImmediateActionAnimation WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (BOOL)_canChangeFrameLayout:(_WKFrameHandle *)frameHandle WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (BOOL)_tryToSwipeWithEvent:(NSEvent *)event ignoringPinnedState:(BOOL)ignoringPinnedState WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_setDidMoveSwipeSnapshotCallback:(void(^)(CGRect))callback WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+@property (nonatomic, setter=_setTotalHeightOfBanners:) CGFloat _totalHeightOfBanners WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+@property (nonatomic, copy, setter=_setUnderlayColor:) NSColor *_underlayColor;
+@property (nonatomic, readwrite, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 @property (nonatomic, readonly) WKPageRef _pageRefForTransitionToWKWebView  WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 @property (nonatomic, readonly) BOOL _hasActiveVideoForControlsManager WK_API_AVAILABLE(macosx(10.12));
 - (void)_requestControlledElementID WK_API_AVAILABLE(macosx(10.12.3));

Modified: trunk/Source/WebKit/UIProcess/API/mac/WKView.mm (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/API/mac/WKView.mm	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKView.mm	2017-10-13 00:41:45 UTC (rev 223267)
@@ -1245,7 +1245,7 @@
 // FIXME: This returns an autoreleased object. Should it really be prefixed 'create'?
 - (NSWindow *)createFullScreenWindow
 {
-    return _data->_impl->createFullScreenWindow();
+    return _data->_impl->fullScreenWindow();
 }
 
 - (void)beginDeferringViewInWindowChanges

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h	2017-10-13 00:41:45 UTC (rev 223267)
@@ -282,7 +282,7 @@
     void closeFullScreenWindowController();
 #endif
     NSView *fullScreenPlaceholderView();
-    NSWindow *createFullScreenWindow();
+    NSWindow *fullScreenWindow();
 
     bool isEditable() const;
     bool executeSavedCommandBySelector(SEL);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (223266 => 223267)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2017-10-13 00:39:55 UTC (rev 223266)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2017-10-13 00:41:45 UTC (rev 223267)
@@ -2432,7 +2432,7 @@
 WKFullScreenWindowController *WebViewImpl::fullScreenWindowController()
 {
     if (!m_fullScreenWindowController)
-        m_fullScreenWindowController = adoptNS([[WKFullScreenWindowController alloc] initWithWindow:createFullScreenWindow() webView:m_view.getAutoreleased() page:m_page]);
+        m_fullScreenWindowController = adoptNS([[WKFullScreenWindowController alloc] initWithWindow:fullScreenWindow() webView:m_view.getAutoreleased() page:m_page]);
 
     return m_fullScreenWindowController.get();
 }
@@ -2456,7 +2456,7 @@
     return nil;
 }
 
-NSWindow *WebViewImpl::createFullScreenWindow()
+NSWindow *WebViewImpl::fullScreenWindow()
 {
 #if ENABLE(FULLSCREEN_API)
     return [[[WebCoreFullScreenWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:(NSWindowStyleMaskBorderless | NSWindowStyleMaskResizable) backing:NSBackingStoreBuffered defer:NO] autorelease];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to