Title: [254360] trunk/Source/WebKit
Revision
254360
Author
[email protected]
Date
2020-01-10 11:56:50 -0800 (Fri, 10 Jan 2020)

Log Message

[macOS UI-side compositing] Introduce WKScrollView and WKContentView for macOS
https://bugs.webkit.org/show_bug.cgi?id=206042

Reviewed by Tim Horton.

Add WKScrollViewMac and WKWebViewMac, with bare-bones implementations. WKScrollViewMac
has a WKScrollViewDelegate to make it more iOS-like, to avoid clients having to register
boundsDidChange notifications, and WKWebView on macOS becomes the delegate.

These views are only created when UI-side compositing is enabled.

* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/mac/WKContentViewMac.h: Added.
* UIProcess/API/mac/WKContentViewMac.mm: Added.
(-[WKContentView initWithFrame:page:]):
(-[WKContentView isFlipped]):
(-[WKContentView _setAcceleratedCompositingRootLayer:]):
* UIProcess/API/mac/WKScrollViewMac.h: Added.
* UIProcess/API/mac/WKScrollViewMac.mm: Added.
(+[WKScrollView isCompatibleWithResponsiveScrolling]):
(-[WKScrollView initWithFrame:]):
(-[WKScrollView dealloc]):
(-[WKScrollView delegate]):
(-[WKScrollView setDelegate:]):
(-[WKScrollView contentOffset]):
(-[WKScrollView boundsDidChange:]):
(-[WKScrollView setContentInsets:]):
* UIProcess/API/mac/WKWebViewMac.h:
* UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView scrollViewDidScroll:]):
(-[WKWebView scrollViewContentInsetsDidChange:]):
(-[WKWebView _setupScrollAndContentViews]):
* UIProcess/ios/WebPageProxyIOS.mm:
* WebKit.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (254359 => 254360)


--- trunk/Source/WebKit/ChangeLog	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/ChangeLog	2020-01-10 19:56:50 UTC (rev 254360)
@@ -1,3 +1,43 @@
+2020-01-10  Simon Fraser  <[email protected]>
+
+        [macOS UI-side compositing] Introduce WKScrollView and WKContentView for macOS
+        https://bugs.webkit.org/show_bug.cgi?id=206042
+
+        Reviewed by Tim Horton.
+
+        Add WKScrollViewMac and WKWebViewMac, with bare-bones implementations. WKScrollViewMac
+        has a WKScrollViewDelegate to make it more iOS-like, to avoid clients having to register
+        boundsDidChange notifications, and WKWebView on macOS becomes the delegate.
+
+        These views are only created when UI-side compositing is enabled.
+
+        * SourcesCocoa.txt:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _initializeWithConfiguration:]):
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/API/mac/WKContentViewMac.h: Added.
+        * UIProcess/API/mac/WKContentViewMac.mm: Added.
+        (-[WKContentView initWithFrame:page:]):
+        (-[WKContentView isFlipped]):
+        (-[WKContentView _setAcceleratedCompositingRootLayer:]):
+        * UIProcess/API/mac/WKScrollViewMac.h: Added.
+        * UIProcess/API/mac/WKScrollViewMac.mm: Added.
+        (+[WKScrollView isCompatibleWithResponsiveScrolling]):
+        (-[WKScrollView initWithFrame:]):
+        (-[WKScrollView dealloc]):
+        (-[WKScrollView delegate]):
+        (-[WKScrollView setDelegate:]):
+        (-[WKScrollView contentOffset]):
+        (-[WKScrollView boundsDidChange:]):
+        (-[WKScrollView setContentInsets:]):
+        * UIProcess/API/mac/WKWebViewMac.h:
+        * UIProcess/API/mac/WKWebViewMac.mm:
+        (-[WKWebView scrollViewDidScroll:]):
+        (-[WKWebView scrollViewContentInsetsDidChange:]):
+        (-[WKWebView _setupScrollAndContentViews]):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2020-01-10  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Support authenticatorGetNextAssertion

Modified: trunk/Source/WebKit/SourcesCocoa.txt (254359 => 254360)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-01-10 19:56:50 UTC (rev 254360)
@@ -334,6 +334,8 @@
 UIProcess/API/ios/WKWebViewIOS.mm
 UIProcess/API/ios/WKWebViewTestingIOS.mm
 
+UIProcess/API/mac/WKContentViewMac.mm
+UIProcess/API/mac/WKScrollViewMac.mm
 UIProcess/API/mac/WKView.mm
 UIProcess/API/mac/WKWebViewMac.mm
 UIProcess/API/mac/WKWebViewTestingMac.mm

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


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-01-10 19:56:50 UTC (rev 254360)
@@ -161,6 +161,7 @@
 
 #if PLATFORM(MAC)
 #import "AppKitSPI.h"
+#import "WKContentViewMac.h"
 #import "WKTextFinderClient.h"
 #import "WKViewInternal.h"
 #import <WebCore/ColorMac.h>
@@ -314,6 +315,7 @@
     [self _setupPageConfiguration:pageConfiguration];
 
     _usePlatformFindUI = YES;
+
 #if PLATFORM(IOS_FAMILY)
     _avoidsUnsafeArea = YES;
     _obscuredInsetEdgesAffectedBySafeArea = UIRectEdgeTop | UIRectEdgeLeft | UIRectEdgeRight;
@@ -356,8 +358,13 @@
     _impl = makeUnique<WebKit::WebViewImpl>(self, self, processPool, pageConfiguration.copyRef());
     _page = &_impl->page();
 
+    if (_impl->isUsingUISideCompositing())
+        _contentView = adoptNS([[WKContentView alloc] initWithFrame:self.bounds page:_page.copyRef()]);
+
     _impl->setAutomaticallyAdjustsContentInsets(true);
     _impl->setRequiresUserActionForEditingControlsManager([configuration _requiresUserActionForEditingControlsManager]);
+
+    [self _setupScrollAndContentViews];
 #endif
 
     if (NSString *applicationNameForUserAgent = configuration.applicationNameForUserAgent)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (254359 => 254360)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h	2020-01-10 19:56:50 UTC (rev 254360)
@@ -83,13 +83,14 @@
 #endif
 }
 
+@class WKContentView;
+@class WKPasswordView;
+@class WKSafeBrowsingWarning;
+@class WKScrollView;
 @class WKWebViewContentProviderRegistry;
-@class WKPasswordView;
 @class _WKFrameHandle;
-@class WKSafeBrowsingWarning;
 
 #if PLATFORM(IOS_FAMILY)
-@class WKScrollView;
 @class WKFullScreenWindowController;
 @protocol WKWebViewContentProvider;
 #endif
@@ -126,6 +127,10 @@
 #if PLATFORM(MAC)
     std::unique_ptr<WebKit::WebViewImpl> _impl;
     RetainPtr<WKTextFinderClient> _textFinderClient;
+
+    // Only used with UI-side compositing.
+    RetainPtr<WKScrollView> _scrollView;
+    RetainPtr<WKContentView> _contentView;
 #endif
 
 #if PLATFORM(IOS_FAMILY)

Added: trunk/Source/WebKit/UIProcess/API/mac/WKContentViewMac.h (0 => 254360)


--- trunk/Source/WebKit/UIProcess/API/mac/WKContentViewMac.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKContentViewMac.h	2020-01-10 19:56:50 UTC (rev 254360)
@@ -0,0 +1,46 @@
+/*
+* Copyright (C) 2020 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#if PLATFORM(MAC)
+
+#import <Cocoa/Cocoa.h>
+#import <wtf/RetainPtr.h>
+
+@class CALayer;
+
+namespace WebKit {
+class WebPageProxy;
+}
+
+@interface WKContentView : NSView
+
+@property (nonatomic) BOOL sizeChangedSinceLastVisibleContentRectUpdate;
+
+- (instancetype)initWithFrame:(NSRect)frame page:(RefPtr<WebKit::WebPageProxy>&&)page;
+- (void)_setAcceleratedCompositingRootLayer:(CALayer *)layer;
+
+@end
+
+#endif // PLATFORM(MAC)

Added: trunk/Source/WebKit/UIProcess/API/mac/WKContentViewMac.mm (0 => 254360)


--- trunk/Source/WebKit/UIProcess/API/mac/WKContentViewMac.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKContentViewMac.mm	2020-01-10 19:56:50 UTC (rev 254360)
@@ -0,0 +1,70 @@
+/*
+* Copyright (C) 2020 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#import "config.h"
+#import "WKContentViewMac.h"
+
+#if PLATFORM(MAC)
+
+#import "RemoteLayerTreeDrawingAreaProxy.h"
+#import "WebPageProxy.h"
+#import <QuartzCore/CATransaction.h>
+
+@implementation WKContentView {
+    RefPtr<WebKit::WebPageProxy> _page;
+}
+
+- (instancetype)initWithFrame:(NSRect)frame page:(RefPtr<WebKit::WebPageProxy>&&)page
+{
+    self = [super initWithFrame:frame];
+    if (!self)
+        return nil;
+    
+    _page = WTFMove(page);
+    _page->setUseFixedLayout(true);
+    _page->setDelegatesScrolling(true);
+
+    [self setWantsLayer:YES];
+    return self;
+}
+
+- (BOOL)isFlipped
+{
+    return YES;
+}
+
+- (void)_setAcceleratedCompositingRootLayer:(CALayer *)layer
+{
+    [CATransaction begin];
+    [CATransaction setDisableActions:YES];
+
+    [self layer].sublayers = layer ? @[ layer ] : nil;
+
+    [CATransaction commit];
+}
+
+@end
+
+#endif // PLATFORM(MAC)

Added: trunk/Source/WebKit/UIProcess/API/mac/WKScrollViewMac.h (0 => 254360)


--- trunk/Source/WebKit/UIProcess/API/mac/WKScrollViewMac.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKScrollViewMac.h	2020-01-10 19:56:50 UTC (rev 254360)
@@ -0,0 +1,47 @@
+/*
+* Copyright (C) 2020 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#if PLATFORM(MAC)
+
+#import <Cocoa/Cocoa.h>
+
+@protocol WKScrollViewDelegate
+
+- (void)scrollViewDidScroll:(NSScrollView *)scrollView;
+- (void)scrollViewContentInsetsDidChange:(NSScrollView *)scrollView;
+
+@end
+
+
+@interface WKScrollView : NSScrollView
+
+@property (assign, nonatomic) id <WKScrollViewDelegate> delegate;
+@property (readonly, nonatomic) CGPoint contentOffset;
+
+@end
+
+
+#endif // PLATFORM(MAC)
+

Added: trunk/Source/WebKit/UIProcess/API/mac/WKScrollViewMac.mm (0 => 254360)


--- trunk/Source/WebKit/UIProcess/API/mac/WKScrollViewMac.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKScrollViewMac.mm	2020-01-10 19:56:50 UTC (rev 254360)
@@ -0,0 +1,98 @@
+/*
+* Copyright (C) 2020 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#import "config.h"
+#import "WKScrollViewMac.h"
+
+#if PLATFORM(MAC)
+
+#import <wtf/WeakObjCPtr.h>
+
+@implementation WKScrollView {
+    WeakObjCPtr<id <WKScrollViewDelegate>> _delegate;
+}
+
++ (BOOL)isCompatibleWithResponsiveScrolling
+{
+    return NO;
+}
+
+- (instancetype)initWithFrame:(NSRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (!self)
+        return nil;
+
+    self.allowsMagnification = YES;
+    self.minMagnification = 1; // Matches ViewGestureController.
+    self.maxMagnification = 3;
+
+    [self.contentView setPostsBoundsChangedNotifications:YES];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChange:) name:NSViewBoundsDidChangeNotification object:self.contentView];
+    return self;
+}
+
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    [super dealloc];
+}
+
+- (id <WKScrollViewDelegate>)delegate
+{
+    return _delegate.getAutoreleased();
+}
+
+- (void)setDelegate:(id <WKScrollViewDelegate>)delegate
+{
+    _delegate = delegate;
+}
+
+- (CGPoint)contentOffset
+{
+    return self.contentView.bounds.origin;
+}
+
+- (void)boundsDidChange:(NSNotification *)notification
+{
+    auto retainedDelegate = _delegate.get();
+    if (retainedDelegate)
+        [retainedDelegate scrollViewDidScroll:self];
+}
+
+- (void)setContentInsets:(NSEdgeInsets)insets
+{
+    BOOL insetsChanged = !NSEdgeInsetsEqual(insets, self.contentInsets);
+    [super setContentInsets:insets];
+    if (insetsChanged) {
+        auto retainedDelegate = _delegate.get();
+        if (retainedDelegate)
+            [retainedDelegate scrollViewContentInsetsDidChange:self];
+    }
+}
+
+@end
+
+#endif // PLATFORM(MAC)

Modified: trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.h (254359 => 254360)


--- trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.h	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.h	2020-01-10 19:56:50 UTC (rev 254360)
@@ -27,17 +27,18 @@
 
 #if PLATFORM(MAC)
 
+#import "WKScrollViewMac.h"
 #import "WebViewImpl.h"
 #import "_WKOverlayScrollbarStyle.h"
 #import <WebCore/ScrollTypes.h>
 
-@protocol WebViewImplDelegate;
-
 _WKOverlayScrollbarStyle toAPIScrollbarStyle(Optional<WebCore::ScrollbarOverlayStyle>);
 Optional<WebCore::ScrollbarOverlayStyle> toCoreScrollbarStyle(_WKOverlayScrollbarStyle);
 
-@interface WKWebView (WKInternalMac) <WebViewImplDelegate>
+@interface WKWebView (WKInternalMac) <WebViewImplDelegate, WKScrollViewDelegate>
 
+- (void)_setupScrollAndContentViews;
+
 - (void)_takeFindStringFromSelectionInternal:(id)sender;
 - (void)insertText:(id)string replacementRange:(NSRange)replacementRange;
 

Modified: trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm (254359 => 254360)


--- trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm	2020-01-10 19:56:50 UTC (rev 254360)
@@ -30,7 +30,9 @@
 
 #import "AppKitSPI.h"
 #import "VersionChecks.h"
+#import "WKContentViewMac.h"
 #import "WKSafeBrowsingWarning.h"
+#import "WKScrollViewMac.h"
 #import "WKTextFinderClient.h"
 #import "WKUIDelegatePrivate.h"
 #import "WebBackForwardList.h"
@@ -1207,6 +1209,34 @@
     _impl->insertText(string, replacementRange);
 }
 
+#pragma mark - WKScrollViewDelegate
+
+- (void)scrollViewDidScroll:(NSScrollView *)scrollView
+{
+    // Only called with UI-side compositing.
+}
+
+- (void)scrollViewContentInsetsDidChange:(NSScrollView *)scrollView
+{
+    // Only called with UI-side compositing.
+}
+
+#pragma mark -
+
+- (void)_setupScrollAndContentViews
+{
+    if (!_impl->isUsingUISideCompositing())
+        return;
+
+    _scrollView = adoptNS([[WKScrollView alloc] initWithFrame:[self bounds]]);
+    [_scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+    [self addSubview:_scrollView.get() positioned:NSWindowBelow relativeTo:nil];
+
+    // The content view will get resized to fit the content.
+    [_scrollView setDocumentView:_contentView.get()];
+    [_scrollView setDelegate:self];
+}
+
 @end
 
 #pragma mark -

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (254359 => 254360)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-01-10 19:36:25 UTC (rev 254359)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-01-10 19:56:50 UTC (rev 254360)
@@ -101,6 +101,8 @@
 		07A5EBBC1C7BA43E00B9CA69 /* WKFrameHandleRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 07A5EBBA1C7BA43E00B9CA69 /* WKFrameHandleRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0E97D74D200E900400BF6643 /* SafeBrowsingSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E97D74C200E8FF300BF6643 /* SafeBrowsingSPI.h */; };
 		0EDE85032004E75D00030560 /* WebsitePopUpPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 0EDE85022004E74900030560 /* WebsitePopUpPolicy.h */; };
+		0F04159C23C7CC730060A3E2 /* WKScrollViewMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F04159823C7CC720060A3E2 /* WKScrollViewMac.h */; };
+		0F04159E23C7CC730060A3E2 /* WKContentViewMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F04159A23C7CC730060A3E2 /* WKContentViewMac.h */; };
 		0F08CF521D63C13A00B48DF1 /* WKFormSelectPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F08CF511D63C13A00B48DF1 /* WKFormSelectPicker.h */; };
 		0F08CF541D63C14000B48DF1 /* WKFormSelectPopover.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F08CF531D63C14000B48DF1 /* WKFormSelectPopover.h */; };
 		0F174AA3142A4CB70039250F /* APIGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F174AA2142A4CB60039250F /* APIGeometry.h */; };
@@ -2089,6 +2091,10 @@
 		089C1667FE841158C02AAC07 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		0E97D74C200E8FF300BF6643 /* SafeBrowsingSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingSPI.h; sourceTree = "<group>"; };
 		0EDE85022004E74900030560 /* WebsitePopUpPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebsitePopUpPolicy.h; sourceTree = "<group>"; };
+		0F04159823C7CC720060A3E2 /* WKScrollViewMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScrollViewMac.h; sourceTree = "<group>"; };
+		0F04159923C7CC730060A3E2 /* WKContentViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentViewMac.mm; sourceTree = "<group>"; };
+		0F04159A23C7CC730060A3E2 /* WKContentViewMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentViewMac.h; sourceTree = "<group>"; };
+		0F04159B23C7CC730060A3E2 /* WKScrollViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKScrollViewMac.mm; sourceTree = "<group>"; };
 		0F08CF511D63C13A00B48DF1 /* WKFormSelectPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFormSelectPicker.h; path = ios/forms/WKFormSelectPicker.h; sourceTree = "<group>"; };
 		0F08CF531D63C14000B48DF1 /* WKFormSelectPopover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFormSelectPopover.h; path = ios/forms/WKFormSelectPopover.h; sourceTree = "<group>"; };
 		0F0C365718C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeHostIOS.mm; sourceTree = "<group>"; };
@@ -8733,6 +8739,10 @@
 		BC111B47112F616900337BAB /* mac */ = {
 			isa = PBXGroup;
 			children = (
+				0F04159A23C7CC730060A3E2 /* WKContentViewMac.h */,
+				0F04159923C7CC730060A3E2 /* WKContentViewMac.mm */,
+				0F04159823C7CC720060A3E2 /* WKScrollViewMac.h */,
+				0F04159B23C7CC730060A3E2 /* WKScrollViewMac.mm */,
 				BC8699B3116AADAA002A925B /* WKView.mm */,
 				BC8699B4116AADAA002A925B /* WKViewInternal.h */,
 				0FFED99023A3203800EEF459 /* WKWebViewMac.h */,
@@ -10726,6 +10736,7 @@
 				5CD286581E7235D10094FDC8 /* WKContentRuleListStorePrivate.h in Headers */,
 				0FCB4E4C18BBE044000FCFC9 /* WKContentView.h in Headers */,
 				0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */,
+				0F04159E23C7CC730060A3E2 /* WKContentViewMac.h in Headers */,
 				BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */,
 				1AE52F981920267200A1FA37 /* WKContextConfigurationRef.h in Headers */,
 				1A445BA5184D5FDA004B3414 /* WKContextConnectionClient.h in Headers */,
@@ -10942,6 +10953,7 @@
 				1A7E377518E4A33A003D0FFF /* WKScriptMessageHandler.h in Headers */,
 				7CC99A3618EF7CBC0048C8B4 /* WKScriptMessageInternal.h in Headers */,
 				0FCB4E5418BBE044000FCFC9 /* WKScrollView.h in Headers */,
+				0F04159C23C7CC730060A3E2 /* WKScrollViewMac.h in Headers */,
 				51CD1C651B34B9D400142CA5 /* WKSecurityOrigin.h in Headers */,
 				51CD1C671B34B9DF00142CA5 /* WKSecurityOriginInternal.h in Headers */,
 				51CD1C5E1B3493B400142CA5 /* WKSecurityOriginRef.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to