Title: [164349] trunk/Source/WebKit2
Revision
164349
Author
[email protected]
Date
2014-02-18 20:12:49 -0800 (Tue, 18 Feb 2014)

Log Message

Clean up WKContentView initialization
https://bugs.webkit.org/show_bug.cgi?id=129016

Reviewed by Benjamin Poulain.

WKContentView had too many initializers and duplicated init
code. Clean up by removing all but one initializer and and
doing all the setup in it.

* UIProcess/API/ios/WKContentView.h:
* UIProcess/API/ios/WKContentView.mm:
* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164348 => 164349)


--- trunk/Source/WebKit2/ChangeLog	2014-02-19 04:08:49 UTC (rev 164348)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-19 04:12:49 UTC (rev 164349)
@@ -1,3 +1,19 @@
+2014-02-18  Simon Fraser  <[email protected]>
+
+        Clean up WKContentView initialization
+        https://bugs.webkit.org/show_bug.cgi?id=129016
+
+        Reviewed by Benjamin Poulain.
+        
+        WKContentView had too many initializers and duplicated init
+        code. Clean up by removing all but one initializer and and
+        doing all the setup in it.
+
+        * UIProcess/API/ios/WKContentView.h:
+        * UIProcess/API/ios/WKContentView.mm:
+        * UIProcess/API/ios/WKViewIOS.mm:
+        (-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
+
 2014-02-18  Tim Horton  <[email protected]>
 
         Another 32-bit build fix.

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h (164348 => 164349)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h	2014-02-19 04:08:49 UTC (rev 164348)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h	2014-02-19 04:12:49 UTC (rev 164349)
@@ -60,10 +60,6 @@
 
 - (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration;
 
-- (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 processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup;
-
 - (void)setMinimumSize:(CGSize)size;
 - (void)setViewportSize:(CGSize)size;
 - (void)setMinimumLayoutSize:(CGSize)size;

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


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2014-02-19 04:08:49 UTC (rev 164348)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2014-02-19 04:12:49 UTC (rev 164349)
@@ -72,29 +72,6 @@
     WebCore::FloatPoint _currentExposedRectPosition;
 }
 
-- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
-{
-    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nullptr];
-}
-
-- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
-{
-    if (!(self = [super initWithFrame:frame]))
-        return nil;
-
-    [self _commonInitializationWithContextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage];
-    return self;
-}
-
-- (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
-{
-    if (!(self = [super initWithFrame:frame]))
-        return nil;
-
-    [self _commonInitializationWithContextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:nullptr];
-    return self;
-}
-
 - (instancetype)initWithFrame:(CGRect)frame context:(WebKit::WebContext&)context configuration:(WebKit::WebPageConfiguration)webPageConfiguration
 {
     if (!(self = [super initWithFrame:frame]))
@@ -252,37 +229,6 @@
 
 #pragma mark Internal
 
-- (void)_commonInitializationWithContextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
-{
-    InitializeWebKit2();
-
-    _pageClient = std::make_unique<PageClientImpl>(self);
-
-    WebPageConfiguration webPageConfiguration;
-    webPageConfiguration.pageGroup = toImpl(pageGroupRef);
-    webPageConfiguration.relatedPage = toImpl(relatedPage);
-
-    _page = toImpl(contextRef)->createWebPage(*_pageClient, std::move(webPageConfiguration));
-    _page->initializeWebPage();
-    _page->setIntrinsicDeviceScaleFactor([UIScreen mainScreen].scale);
-    _page->setUseFixedLayout(true);
-    _page->setDelegatesScrolling(true);
-
-    WebContext::statistics().wkViewCount++;
-
-    _rootContentView = adoptNS([[UIView alloc] init]);
-    [[_rootContentView layer] setMasksToBounds:NO];
-    [_rootContentView setUserInteractionEnabled:NO];
-
-    [self addSubview:_rootContentView.get()];
-
-    _interactionView = adoptNS([[WKInteractionView alloc] init]);
-    [_interactionView setPage:_page];
-    [self addSubview:_interactionView.get()];
-
-    self.layer.hitTestsAsOpaque = YES;
-}
-
 - (void)_windowDidMoveToScreenNotification:(NSNotification *)notification
 {
     ASSERT(notification.object == self.window);

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


--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2014-02-19 04:08:49 UTC (rev 164348)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm	2014-02-19 04:12:49 UTC (rev 164349)
@@ -239,7 +239,12 @@
 
     [self addSubview:_scrollView.get()];
 
-    _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage]);
+    WebKit::WebPageConfiguration webPageConfiguration;
+    webPageConfiguration.pageGroup = toImpl(pageGroupRef);
+    webPageConfiguration.relatedPage = toImpl(relatedPage);
+
+    _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:*toImpl(contextRef) configuration:std::move(webPageConfiguration)]);
+
     [_contentView setDelegate:self];
     [[_contentView layer] setAnchorPoint:CGPointZero];
     [_contentView setFrame:bounds];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to