Title: [163681] trunk/Source/WebKit2
Revision
163681
Author
ander...@apple.com
Date
2014-02-07 18:38:02 -0800 (Fri, 07 Feb 2014)

Log Message

Pass the preferences through from the WKWebViewConfiguration object
https://bugs.webkit.org/show_bug.cgi?id=128430

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences init]):
Don't return nil if [super init] returns a valid object.

(-[WKPreferences minimumFontSize]):
(-[WKPreferences setMinimumFontSize:]):
Change this property to be unsigned.

* UIProcess/API/Cocoa/WKPreferencesInternal.h:
Use @package.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
Set up a WebKit::WebPageConfiguration and use the new -[WKView initWithFrame:context:configuration:] method.

* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView initWithFrame:configuration:]):
Set the preferences.

* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:context:configuration:]):
Add a new initializer that takes a WebContext and a WebPageConfiguration.

(-[WKView _registerDraggedTypes]):
This shouldn't be in the private category.

(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
Call the new initializer.

* UIProcess/API/mac/WKViewInternal.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (163680 => 163681)


--- trunk/Source/WebKit2/ChangeLog	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-08 02:38:02 UTC (rev 163681)
@@ -1,3 +1,42 @@
+2014-02-07  Anders Carlsson  <ander...@apple.com>
+
+        Pass the preferences through from the WKWebViewConfiguration object
+        https://bugs.webkit.org/show_bug.cgi?id=128430
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/Cocoa/WKPreferences.h:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences init]):
+        Don't return nil if [super init] returns a valid object.
+
+        (-[WKPreferences minimumFontSize]):
+        (-[WKPreferences setMinimumFontSize:]):
+        Change this property to be unsigned.
+
+        * UIProcess/API/Cocoa/WKPreferencesInternal.h:
+        Use @package.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        Set up a WebKit::WebPageConfiguration and use the new -[WKView initWithFrame:context:configuration:] method.
+
+        * UIProcess/API/ios/WKContentView.mm:
+        (-[WKContentView initWithFrame:configuration:]):
+        Set the preferences.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:context:configuration:]):
+        Add a new initializer that takes a WebContext and a WebPageConfiguration.
+
+        (-[WKView _registerDraggedTypes]):
+        This shouldn't be in the private category.
+        
+        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
+        Call the new initializer.
+
+        * UIProcess/API/mac/WKViewInternal.h:
+
 2014-02-07  Tim Horton  <timothy_hor...@apple.com>
 
         Fix the WebKit2 build after r163671.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.h (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.h	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.h	2014-02-08 02:38:02 UTC (rev 163681)
@@ -35,7 +35,7 @@
 WK_API_CLASS
 @interface WKPreferences : NSObject
 
-@property (nonatomic) int minimumFontSize;
+@property (nonatomic) unsigned minimumFontSize;
 
 @end
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm	2014-02-08 02:38:02 UTC (rev 163681)
@@ -34,7 +34,7 @@
 
 - (instancetype)init
 {
-    if ((self = [super init]))
+    if (!(self = [super init]))
         return nil;
 
     _preferences = WebKit::WebPreferences::create(String());
@@ -42,12 +42,12 @@
     return self;
 }
 
-- (int)minimumFontSize
+- (unsigned)minimumFontSize
 {
     return _preferences->minimumFontSize();
 }
 
-- (void)setMinimumFontSize:(int)minimumFontSize
+- (void)setMinimumFontSize:(unsigned)minimumFontSize
 {
     _preferences->setMinimumFontSize(minimumFontSize);
 }

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesInternal.h (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesInternal.h	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesInternal.h	2014-02-08 02:38:02 UTC (rev 163681)
@@ -34,6 +34,7 @@
 }
 
 @interface WKPreferences () {
+@package
     RefPtr<WebKit::WebPreferences> _preferences;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-02-08 02:38:02 UTC (rev 163681)
@@ -35,7 +35,7 @@
 #import "WKNavigationDelegate.h"
 #import "WKNavigationInternal.h"
 #import "WKPreferencesInternal.h"
-#import "WKProcessClass.h"
+#import "WKProcessClassInternal.h"
 #import "WKRemoteObjectRegistryInternal.h"
 #import "WKWebViewConfiguration.h"
 #import "WebContext.h"
@@ -110,7 +110,10 @@
 #endif
 
 #if PLATFORM(MAC) && !PLATFORM(IOS)
-    _wkView = [[WKView alloc] initWithFrame:bounds configuration:_configuration.get()];
+    WebKit::WebPageConfiguration webPageConfiguration;
+    webPageConfiguration.preferences = [_configuration preferences]->_preferences.get();
+
+    _wkView = [[WKView alloc] initWithFrame:bounds context:*[_configuration.get() processClass]->_context configuration:std::move(webPageConfiguration)];
     [self addSubview:_wkView.get()];
     _page = WebKit::toImpl([_wkView pageRef]);
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2014-02-08 02:38:02 UTC (rev 163681)
@@ -35,6 +35,7 @@
 #import "WKBrowsingContextGroupPrivate.h"
 #import "WKGeolocationProviderIOS.h"
 #import "WKInteractionView.h"
+#import "WKPreferencesInternal.h"
 #import "WKProcessGroupPrivate.h"
 #import "WKProcessClassInternal.h"
 #import "WKWebViewConfiguration.h"
@@ -104,6 +105,7 @@
     _pageClient = std::make_unique<PageClientImpl>(self);
 
     WebPageConfiguration webPageConfiguration;
+    webPageConfiguration.preferences = [_configuration preferences]->_preferences.get();
 
     _page = configuration.processClass->_context->createWebPage(*_pageClient, std::move(webPageConfiguration));
     _page->initializeWebPage();

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-02-08 02:38:02 UTC (rev 163681)
@@ -59,7 +59,6 @@
 #import "WKTextInputWindowController.h"
 #import "WKViewInternal.h"
 #import "WKViewPrivate.h"
-#import "WKWebViewConfiguration.h"
 #import "WebBackForwardList.h"
 #import "WebContext.h"
 #import "WebEventFactory.h"
@@ -258,11 +257,6 @@
 
 #if WK_API_ENABLED
 
-- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
-{
-    return [self initWithFrame:frame contextRef:toAPI(configuration.processClass->_context.get()) pageGroupRef:nullptr];
-}
-
 - (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
 {
     return [self initWithFrame:frame contextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:nil];
@@ -2886,30 +2880,8 @@
     return _data->_page->suppressVisibilityUpdates();
 }
 
-@end
-
-@implementation WKView (Private)
-
-- (void)saveBackForwardSnapshotForCurrentItem
+- (instancetype)initWithFrame:(NSRect)frame context:(WebContext&)context configuration:(WebPageConfiguration)webPageConfiguration
 {
-    _data->_page->recordNavigationSnapshot();
-}
-
-- (void)_registerDraggedTypes
-{
-    NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()];
-    [types addObjectsFromArray:PasteboardTypes::forURL()];
-    [self registerForDraggedTypes:[types allObjects]];
-    [types release];
-}
-
-- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
-{
-    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
-}
-
-- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
-{
     self = [super initWithFrame:frame];
     if (!self)
         return nil;
@@ -2933,13 +2905,8 @@
     [trackingArea release];
 
     _data = [[WKViewData alloc] init];
-
-    WebPageConfiguration webPageConfiguration;
-    webPageConfiguration.pageGroup = toImpl(pageGroupRef);
-    webPageConfiguration.relatedPage = toImpl(relatedPage);
-
     _data->_pageClient = std::make_unique<PageClientImpl>(self);
-    _data->_page = toImpl(contextRef)->createWebPage(*_data->_pageClient, std::move(webPageConfiguration));
+    _data->_page = context.createWebPage(*_data->_pageClient, std::move(webPageConfiguration));
     _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
     _data->_page->initializeWebPage();
 
@@ -2968,6 +2935,37 @@
     return self;
 }
 
+- (void)_registerDraggedTypes
+{
+    NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()];
+    [types addObjectsFromArray:PasteboardTypes::forURL()];
+    [self registerForDraggedTypes:[types allObjects]];
+    [types release];
+}
+
+@end
+
+@implementation WKView (Private)
+
+- (void)saveBackForwardSnapshotForCurrentItem
+{
+    _data->_page->recordNavigationSnapshot();
+}
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
+{
+    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
+}
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
+{
+    WebPageConfiguration webPageConfiguration;
+    webPageConfiguration.pageGroup = toImpl(pageGroupRef);
+    webPageConfiguration.relatedPage = toImpl(relatedPage);
+
+    return [self initWithFrame:frame context:*toImpl(contextRef) configuration:webPageConfiguration];
+}
+
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
 - (BOOL)wantsUpdateLayer
 {

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (163680 => 163681)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2014-02-08 02:28:08 UTC (rev 163680)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2014-02-08 02:38:02 UTC (rev 163681)
@@ -43,18 +43,20 @@
 }
 
 namespace WebKit {
-    class DrawingAreaProxy;
-    class FindIndicator;
-    class LayerTreeContext;
-    struct ColorSpaceData;
-    struct EditorState;
+class DrawingAreaProxy;
+class FindIndicator;
+class LayerTreeContext;
+class WebContext;
+struct ColorSpaceData;
+struct EditorState;
+struct WebPageConfiguration;
 }
 
 @class WKFullScreenWindowController;
 
 @interface WKView ()
 #if WK_API_ENABLED
-- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration;
+- (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration;
 #endif
 
 - (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to