Changeset 163681 in webkit


Ignore:
Timestamp:
Feb 7, 2014 6:38:02 PM (10 years ago)
Author:
andersca@apple.com
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:
Location:
trunk/Source/WebKit2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r163680 r163681  
     12014-02-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Pass the preferences through from the WKWebViewConfiguration object
     4        https://bugs.webkit.org/show_bug.cgi?id=128430
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/Cocoa/WKPreferences.h:
     9        * UIProcess/API/Cocoa/WKPreferences.mm:
     10        (-[WKPreferences init]):
     11        Don't return nil if [super init] returns a valid object.
     12
     13        (-[WKPreferences minimumFontSize]):
     14        (-[WKPreferences setMinimumFontSize:]):
     15        Change this property to be unsigned.
     16
     17        * UIProcess/API/Cocoa/WKPreferencesInternal.h:
     18        Use @package.
     19
     20        * UIProcess/API/Cocoa/WKWebView.mm:
     21        (-[WKWebView initWithFrame:configuration:]):
     22        Set up a WebKit::WebPageConfiguration and use the new -[WKView initWithFrame:context:configuration:] method.
     23
     24        * UIProcess/API/ios/WKContentView.mm:
     25        (-[WKContentView initWithFrame:configuration:]):
     26        Set the preferences.
     27
     28        * UIProcess/API/mac/WKView.mm:
     29        (-[WKView initWithFrame:context:configuration:]):
     30        Add a new initializer that takes a WebContext and a WebPageConfiguration.
     31
     32        (-[WKView _registerDraggedTypes]):
     33        This shouldn't be in the private category.
     34       
     35        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
     36        Call the new initializer.
     37
     38        * UIProcess/API/mac/WKViewInternal.h:
     39
    1402014-02-07  Tim Horton  <timothy_horton@apple.com>
    241
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.h

    r163663 r163681  
    3636@interface WKPreferences : NSObject
    3737
    38 @property (nonatomic) int minimumFontSize;
     38@property (nonatomic) unsigned minimumFontSize;
    3939
    4040@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm

    r163663 r163681  
    3535- (instancetype)init
    3636{
    37     if ((self = [super init]))
     37    if (!(self = [super init]))
    3838        return nil;
    3939
     
    4343}
    4444
    45 - (int)minimumFontSize
     45- (unsigned)minimumFontSize
    4646{
    4747    return _preferences->minimumFontSize();
    4848}
    4949
    50 - (void)setMinimumFontSize:(int)minimumFontSize
     50- (void)setMinimumFontSize:(unsigned)minimumFontSize
    5151{
    5252    _preferences->setMinimumFontSize(minimumFontSize);
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesInternal.h

    r163663 r163681  
    3535
    3636@interface WKPreferences () {
     37@package
    3738    RefPtr<WebKit::WebPreferences> _preferences;
    3839}
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r163663 r163681  
    3636#import "WKNavigationInternal.h"
    3737#import "WKPreferencesInternal.h"
    38 #import "WKProcessClass.h"
     38#import "WKProcessClassInternal.h"
    3939#import "WKRemoteObjectRegistryInternal.h"
    4040#import "WKWebViewConfiguration.h"
     
    111111
    112112#if PLATFORM(MAC) && !PLATFORM(IOS)
    113     _wkView = [[WKView alloc] initWithFrame:bounds configuration:_configuration.get()];
     113    WebKit::WebPageConfiguration webPageConfiguration;
     114    webPageConfiguration.preferences = [_configuration preferences]->_preferences.get();
     115
     116    _wkView = [[WKView alloc] initWithFrame:bounds context:*[_configuration.get() processClass]->_context configuration:std::move(webPageConfiguration)];
    114117    [self addSubview:_wkView.get()];
    115118    _page = WebKit::toImpl([_wkView pageRef]);
  • trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm

    r163680 r163681  
    3636#import "WKGeolocationProviderIOS.h"
    3737#import "WKInteractionView.h"
     38#import "WKPreferencesInternal.h"
    3839#import "WKProcessGroupPrivate.h"
    3940#import "WKProcessClassInternal.h"
     
    105106
    106107    WebPageConfiguration webPageConfiguration;
     108    webPageConfiguration.preferences = [_configuration preferences]->_preferences.get();
    107109
    108110    _page = configuration.processClass->_context->createWebPage(*_pageClient, std::move(webPageConfiguration));
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r163673 r163681  
    6060#import "WKViewInternal.h"
    6161#import "WKViewPrivate.h"
    62 #import "WKWebViewConfiguration.h"
    6362#import "WebBackForwardList.h"
    6463#import "WebContext.h"
     
    258257
    259258#if WK_API_ENABLED
    260 
    261 - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
    262 {
    263     return [self initWithFrame:frame contextRef:toAPI(configuration.processClass->_context.get()) pageGroupRef:nullptr];
    264 }
    265259
    266260- (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
     
    28872881}
    28882882
    2889 @end
    2890 
    2891 @implementation WKView (Private)
    2892 
    2893 - (void)saveBackForwardSnapshotForCurrentItem
    2894 {
    2895     _data->_page->recordNavigationSnapshot();
    2896 }
    2897 
    2898 - (void)_registerDraggedTypes
    2899 {
    2900     NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()];
    2901     [types addObjectsFromArray:PasteboardTypes::forURL()];
    2902     [self registerForDraggedTypes:[types allObjects]];
    2903     [types release];
    2904 }
    2905 
    2906 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
    2907 {
    2908     return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
    2909 }
    2910 
    2911 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
     2883- (instancetype)initWithFrame:(NSRect)frame context:(WebContext&)context configuration:(WebPageConfiguration)webPageConfiguration
    29122884{
    29132885    self = [super initWithFrame:frame];
     
    29342906
    29352907    _data = [[WKViewData alloc] init];
    2936 
    2937     WebPageConfiguration webPageConfiguration;
    2938     webPageConfiguration.pageGroup = toImpl(pageGroupRef);
    2939     webPageConfiguration.relatedPage = toImpl(relatedPage);
    2940 
    29412908    _data->_pageClient = std::make_unique<PageClientImpl>(self);
    2942     _data->_page = toImpl(contextRef)->createWebPage(*_data->_pageClient, std::move(webPageConfiguration));
     2909    _data->_page = context.createWebPage(*_data->_pageClient, std::move(webPageConfiguration));
    29432910    _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
    29442911    _data->_page->initializeWebPage();
     
    29672934
    29682935    return self;
     2936}
     2937
     2938- (void)_registerDraggedTypes
     2939{
     2940    NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()];
     2941    [types addObjectsFromArray:PasteboardTypes::forURL()];
     2942    [self registerForDraggedTypes:[types allObjects]];
     2943    [types release];
     2944}
     2945
     2946@end
     2947
     2948@implementation WKView (Private)
     2949
     2950- (void)saveBackForwardSnapshotForCurrentItem
     2951{
     2952    _data->_page->recordNavigationSnapshot();
     2953}
     2954
     2955- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
     2956{
     2957    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
     2958}
     2959
     2960- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
     2961{
     2962    WebPageConfiguration webPageConfiguration;
     2963    webPageConfiguration.pageGroup = toImpl(pageGroupRef);
     2964    webPageConfiguration.relatedPage = toImpl(relatedPage);
     2965
     2966    return [self initWithFrame:frame context:*toImpl(contextRef) configuration:webPageConfiguration];
    29692967}
    29702968
  • trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h

    r163116 r163681  
    4444
    4545namespace WebKit {
    46     class DrawingAreaProxy;
    47     class FindIndicator;
    48     class LayerTreeContext;
    49     struct ColorSpaceData;
    50     struct EditorState;
     46class DrawingAreaProxy;
     47class FindIndicator;
     48class LayerTreeContext;
     49class WebContext;
     50struct ColorSpaceData;
     51struct EditorState;
     52struct WebPageConfiguration;
    5153}
    5254
     
    5557@interface WKView ()
    5658#if WK_API_ENABLED
    57 - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration;
     59- (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration;
    5860#endif
    5961
Note: See TracChangeset for help on using the changeset viewer.