Title: [188718] trunk
Revision
188718
Author
[email protected]
Date
2015-08-20 17:01:11 -0700 (Thu, 20 Aug 2015)

Log Message

Use WKPageConfigurationRef in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=147996

Reviewed by Tim Horton.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::initialize):
(WTR::TestController::createWebViewWithOptions):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(-[TestRunnerWKView initWithFrame:configurationRef:useThreadedScrolling:]):
(WTR::PlatformWebView::PlatformWebView):
(-[TestRunnerWKView initWithFrame:contextRef:pageGroupRef:relatedToPage:useThreadedScrolling:]): Deleted.

* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView _commonInitializationWithConfigurationRef:]):
(-[WKView initWithFrame:configurationRef:]):
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:configurationRef:]):
Make sure to copy the configuration, matching what we do in the modern API.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (188717 => 188718)


--- trunk/Source/WebKit2/ChangeLog	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-21 00:01:11 UTC (rev 188718)
@@ -1,3 +1,17 @@
+2015-08-20  Anders Carlsson  <[email protected]>
+
+        Use WKPageConfigurationRef in WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=147996
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/ios/WKViewIOS.mm:
+        (-[WKView _commonInitializationWithConfigurationRef:]):
+        (-[WKView initWithFrame:configurationRef:]):
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:configurationRef:]):
+        Make sure to copy the configuration, matching what we do in the modern API.
+        
 2015-08-20  Beth Dakin  <[email protected]>
 
         Standalone image documents should send their size to the UIClient just like 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (188717 => 188718)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h	2015-08-21 00:01:11 UTC (rev 188718)
@@ -38,6 +38,7 @@
 #if TARGET_OS_IPHONE
 - (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
 - (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage;
+- (id)initWithFrame:(CGRect)frame configurationRef:(WKPageConfigurationRef)configuration;
 #else
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage;

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (188717 => 188718)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2015-08-21 00:01:11 UTC (rev 188718)
@@ -35,6 +35,7 @@
 #import "WKAPICast.h"
 #import "WKBrowsingContextGroupPrivate.h"
 #import "WKContentView.h"
+#import "WKPageConfigurationRef.h"
 #import "WKProcessGroupPrivate.h"
 #import "WKScrollView.h"
 #import "WebPageGroup.h"
@@ -86,7 +87,12 @@
     if (!(self = [super initWithFrame:frame]))
         return nil;
 
-    [self _commonInitializationWithContextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:relatedView ? [relatedView pageRef] : nullptr];
+    auto configuration = API::PageConfiguration::create();
+    configuration->setProcessPool(toImpl(processGroup._contextRef));
+    configuration->setPageGroup(toImpl(browsingContextGroup._pageGroupRef));
+    configuration->setRelatedPage(relatedView ? toImpl([relatedView pageRef]) : nullptr);
+
+    [self _commonInitializationWithConfigurationRef:toAPI(configuration.ptr())];
     return self;
 }
 
@@ -214,7 +220,7 @@
 
 #pragma mark Internal
 
-- (void)_commonInitializationWithContextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
+- (void)_commonInitializationWithConfigurationRef:(WKPageConfigurationRef)configurationRef
 {
     ASSERT(!_scrollView);
     ASSERT(!_contentView);
@@ -226,12 +232,9 @@
 
     [self addSubview:_scrollView.get()];
 
-    auto configuration = API::PageConfiguration::create();
-    configuration->setProcessPool(toImpl(contextRef));
-    configuration->setPageGroup(toImpl(pageGroupRef));
-    configuration->setRelatedPage(toImpl(relatedPage));
+    auto configuration = toImpl(configurationRef)->copy();
 
-    _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds processPool:*toImpl(contextRef) configuration:WTF::move(configuration) wkView:self]);
+    _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds processPool:*configuration->processPool() configuration:WTF::move(configuration) wkView:self]);
 
     [[_contentView layer] setAnchorPoint:CGPointZero];
     [_contentView setFrame:bounds];
@@ -326,10 +329,20 @@
 
 - (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
 {
+    auto configuration = API::PageConfiguration::create();
+    configuration->setProcessPool(toImpl(contextRef));
+    configuration->setPageGroup(toImpl(pageGroupRef));
+    configuration->setRelatedPage(toImpl(relatedPage));
+
+    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
+}
+
+- (id)initWithFrame:(CGRect)frame configurationRef:(WKPageConfigurationRef)configuration
+{
     if (!(self = [super initWithFrame:frame]))
         return nil;
 
-    [self _commonInitializationWithContextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage];
+    [self _commonInitializationWithConfigurationRef:configuration];
     return self;
 }
 

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


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2015-08-21 00:01:11 UTC (rev 188718)
@@ -4004,7 +4004,7 @@
 
 - (id)initWithFrame:(NSRect)frame configurationRef:(WKPageConfigurationRef)configurationRef
 {
-    Ref<API::PageConfiguration> configuration = *toImpl(configurationRef);
+    Ref<API::PageConfiguration> configuration = toImpl(configurationRef)->copy();
     auto& processPool = *configuration->processPool();
 
     return [self initWithFrame:frame processPool:processPool configuration:WTF::move(configuration) webView:nil];

Modified: trunk/Tools/ChangeLog (188717 => 188718)


--- trunk/Tools/ChangeLog	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Tools/ChangeLog	2015-08-21 00:01:11 UTC (rev 188718)
@@ -1,3 +1,19 @@
+2015-08-20  Anders Carlsson  <[email protected]>
+
+        Use WKPageConfigurationRef in WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=147996
+
+        Reviewed by Tim Horton.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::initialize):
+        (WTR::TestController::createWebViewWithOptions):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (-[TestRunnerWKView initWithFrame:configurationRef:useThreadedScrolling:]):
+        (WTR::PlatformWebView::PlatformWebView):
+        (-[TestRunnerWKView initWithFrame:contextRef:pageGroupRef:relatedToPage:useThreadedScrolling:]): Deleted.
+
 2015-08-20  Brent Fulgham  <[email protected]>
 
         [Win] Update Windows tools for revised MIDL interfaces

Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (188717 => 188718)


--- trunk/Tools/WebKitTestRunner/PlatformWebView.h	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h	2015-08-21 00:01:11 UTC (rev 188718)
@@ -52,7 +52,7 @@
 
 class PlatformWebView {
 public:
-    PlatformWebView(WKContextRef, WKPageGroupRef, WKPageRef relatedPage, const ViewOptions&);
+    PlatformWebView(WKPageConfigurationRef, const ViewOptions&);
     ~PlatformWebView();
 
     WKPageRef page();

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (188717 => 188718)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2015-08-21 00:01:11 UTC (rev 188718)
@@ -197,17 +197,17 @@
     TestController::singleton().handleUserMediaPermissionRequest(permissionRequest);
 }
 
-WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void* clientInfo)
+WKPageRef TestController::createOtherPage(WKPageRef oldPpage, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
 {
     PlatformWebView* parentView = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
 
-    PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage), oldPage, parentView->options());
+    PlatformWebView* view = new PlatformWebView(configuration, parentView->options());
     WKPageRef newPage = view->page();
 
     view->resizeTo(800, 600);
 
-    WKPageUIClientV5 otherPageUIClient = {
-        { 5, view },
+    WKPageUIClientV6 otherPageUIClient = {
+        { 6, view },
         0, // createNewPage_deprecatedForUseWithV0
         0, // showPage
         closeOtherPage,
@@ -247,7 +247,7 @@
         0, // didCompleteRubberBandForMainFrame
         0, // saveDataToFileInDownloadsFolder
         0, // shouldInterruptJavaScript
-        createOtherPage,
+        0, // createNewPage_deprecatedForUseWithV1
         0, // mouseDidMoveOverElement
         0, // decidePolicyForNotificationPermissionRequest
         0, // unavailablePluginButtonClicked_deprecatedForUseWithV1
@@ -265,6 +265,7 @@
         0, // runJavaScriptConfirm
         0, // runJavaScriptPrompt
         0, // mediaSessionMetadataDidChange
+        createOtherPage,
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient.base);
     
@@ -430,15 +431,19 @@
     if (m_forceComplexText)
         WKContextSetAlwaysUsesComplexTextCodePath(m_context.get(), true);
 
+    m_configuration = adoptWK(WKPageConfigurationCreate());
+    WKPageConfigurationSetContext(m_configuration.get(), m_context.get());
+    WKPageConfigurationSetPageGroup(m_configuration.get(), m_pageGroup.get());
+
     // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now.
     resetPreferencesToConsistentValues();
 }
 
 void TestController::createWebViewWithOptions(const ViewOptions& options)
 {
-    m_mainWebView = std::make_unique<PlatformWebView>(m_context.get(), m_pageGroup.get(), nullptr, options);
-    WKPageUIClientV5 pageUIClient = {
-        { 5, m_mainWebView.get() },
+    m_mainWebView = std::make_unique<PlatformWebView>(m_configuration.get(), options);
+    WKPageUIClientV6 pageUIClient = {
+        { 6, m_mainWebView.get() },
         0, // createNewPage_deprecatedForUseWithV0
         0, // showPage
         0, // close
@@ -478,7 +483,7 @@
         0, // didCompleteRubberBandForMainFrame
         0, // saveDataToFileInDownloadsFolder
         0, // shouldInterruptJavaScript
-        createOtherPage,
+        0, // createNewPage_deprecatedForUseWithV1
         0, // mouseDidMoveOverElement
         decidePolicyForNotificationPermissionRequest, // decidePolicyForNotificationPermissionRequest
         0, // unavailablePluginButtonClicked_deprecatedForUseWithV1
@@ -496,6 +501,7 @@
         0, // runJavaScriptConfirm
         0, // runJavaScriptPrompt
         0, // mediaSessionMetadataDidChange
+        createOtherPage,
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
 

Modified: trunk/Tools/WebKitTestRunner/TestController.h (188717 => 188718)


--- trunk/Tools/WebKitTestRunner/TestController.h	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2015-08-21 00:01:11 UTC (rev 188718)
@@ -210,7 +210,7 @@
     static void didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef title, WKURLRef, WKFrameRef, const void*);
     void didUpdateHistoryTitle(WKStringRef title, WKURLRef, WKFrameRef);
 
-    static WKPageRef createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
+    static WKPageRef createOtherPage(WKPageRef, WKPageConfigurationRef, WKNavigationActionRef, WKWindowFeaturesRef, const void*);
 
     static void runModal(WKPageRef, const void* clientInfo);
     static void runModal(PlatformWebView*);
@@ -235,6 +235,7 @@
     std::unique_ptr<PlatformWebView> m_mainWebView;
     WKRetainPtr<WKContextRef> m_context;
     WKRetainPtr<WKPageGroupRef> m_pageGroup;
+    WKRetainPtr<WKPageConfigurationRef> m_configuration;
 
     enum State {
         Initial,

Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (188717 => 188718)


--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2015-08-21 00:01:11 UTC (rev 188718)
@@ -44,8 +44,6 @@
     BOOL _useTiledDrawing;
 }
 
-- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage useTiledDrawing:(BOOL)useTiledDrawing;
-
 @property (nonatomic, assign) BOOL useTiledDrawing;
 @end
 
@@ -53,10 +51,13 @@
 
 @synthesize useTiledDrawing = _useTiledDrawing;
 
-- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage useTiledDrawing:(BOOL)useTiledDrawing
+- (id)initWithFrame:(CGRect)frame configurationRef:(WKPageConfigurationRef)configuration useTiledDrawing:(BOOL)useTiledDrawing
 {
+    if (!(self = [super initWithFrame:frame configurationRef:configuration]))
+        return nil;
+
     _useTiledDrawing = useTiledDrawing;
-    return [super initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef];
+    return self;
 }
 
 - (BOOL)_shouldUseTiledDrawingArea
@@ -121,13 +122,15 @@
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, WKPageRef relatedPage, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     : m_windowIsKey(true)
     , m_options(options)
 {
     CGRect rect = CGRectMake(0, 0, TestController::viewWidth, TestController::viewHeight);
-    m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage useTiledDrawing:m_options.useTiledDrawing];
+    m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useTiledDrawing:m_options.useTiledDrawing];
 
+    WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration);
+
     WKPreferencesSetCompositingBordersVisible(WKPageGroupGetPreferences(pageGroupRef), YES);
     WKPreferencesSetCompositingRepaintCountersVisible(WKPageGroupGetPreferences(pageGroupRef), YES);
 

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (188717 => 188718)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2015-08-21 00:00:29 UTC (rev 188717)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2015-08-21 00:01:11 UTC (rev 188718)
@@ -50,8 +50,6 @@
     BOOL _useThreadedScrolling;
 }
 
-- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)context pageGroupRef:(WKPageGroupRef)pageGroup relatedToPage:(WKPageRef)relatedPage useThreadedScrolling:(BOOL)useThreadedScrolling;
-
 @property (nonatomic, assign) BOOL useThreadedScrolling;
 @end
 
@@ -59,10 +57,13 @@
 
 @synthesize useThreadedScrolling = _useThreadedScrolling;
 
-- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)context pageGroupRef:(WKPageGroupRef)pageGroup relatedToPage:(WKPageRef)relatedPage useThreadedScrolling:(BOOL)useThreadedScrolling
+- (id)initWithFrame:(NSRect)frame configurationRef:(WKPageConfigurationRef)configuration useThreadedScrolling:(BOOL)useThreadedScrolling
 {
+    if (!(self = [super initWithFrame:frame configurationRef:configuration]))
+        return nil;
+
     _useThreadedScrolling = useThreadedScrolling;
-    return [super initWithFrame:frame contextRef:context pageGroupRef:pageGroup relatedToPage:relatedPage];
+    return self;
 }
 
 - (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
@@ -119,10 +120,12 @@
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, WKPageRef relatedPage, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
     : m_windowIsKey(true)
     , m_options(options)
 {
+    WKPageGroupRef pageGroupRef = WKPageConfigurationGetPageGroup(configuration);
+
     // The tiled drawing specific tests also depend on threaded scrolling.
     WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroupRef);
     WKPreferencesSetThreadedScrollingEnabled(preferences, m_options.useThreadedScrolling);
@@ -132,7 +135,7 @@
         [[NSUserDefaults standardUserDefaults] setValue:@YES forKey:@"WebKit2UseRemoteLayerTreeDrawingArea"];
 
     NSRect rect = NSMakeRect(0, 0, TestController::viewWidth, TestController::viewHeight);
-    m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage useThreadedScrolling:m_options.useThreadedScrolling];
+    m_view = [[TestRunnerWKView alloc] initWithFrame:rect configurationRef:configuration useThreadedScrolling:options.useThreadedScrolling];
     [m_view setWindowOcclusionDetectionEnabled:NO];
 
     NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to