Perform some spring cleaning to WKContentView and WKView
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Nov 2013 21:01:11 +0000 (21:01 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Nov 2013 21:01:11 +0000 (21:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124961

Reviewed by Dan Bernstein.

- Store the PageClientImpl in a std::unique_ptr.
- Remove the WKBrowsingContextController internal load delegate. Replace its use with
  a new PageClient function, didCommitLoadForMainFrame.
- Fix typo in the WKContentViewDelegate. contentViewdidCommitLoadForMainFrame -> contentViewDidCommitLoadForMainFrame.
- Add initializers for WKContentView and WKView that take WKContextRefs and WKPageGroupRefs to match the Mac WKView.
  These are needed for WebKitTestRunner.
- Require a WKProcessGroup (or WKContextRef) and a WKBrowsingContextGroup (or WKPageGroupRef).
- Stop caching the WKProcessGroup and WKBrowsingContextGroup on the WKContentView.
- Remove incorrect implementations of initWithCoder.
- Make WKContentView lazily create its WKBrowsingContextController wrapper.

* UIProcess/API/ios/PageClientImplIOS.h:
* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
(WebKit::PageClientImpl::mainDocumentDidReceiveMobileDocType):
* UIProcess/API/ios/WKContentView.h:
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView initWithCoder:]):
(-[WKContentView initWithFrame:processGroup:browsingContextGroup:]):
(-[WKContentView browsingContextController]):
(-[WKContentView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
(-[WKContentView _didCommitLoadForMainFrame]):
(-[WKContentView _didReceiveMobileDocTypeForMainFrame]):
(-[WKContentView _didChangeViewportArguments:WebCore::]):
(-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
(-[WKContentView _pageRef]):
(-[WKContentView initWithFrame:contextRef:pageGroupRef:]):
(-[WKContentView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
* UIProcess/API/ios/WKContentViewInternal.h:
* UIProcess/API/ios/WKContentViewPrivate.h: Added.
* UIProcess/API/ios/WKView.mm:
(-[WKView initWithFrame:processGroup:browsingContextGroup:]):
(-[WKView initWithFrame:processGroup:browsingContextGroup:relatedToView:]):
(-[WKView contentViewDidCommitLoadForMainFrame:]):
(-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
(-[WKView pageRef]):
(-[WKView initWithFrame:contextRef:pageGroupRef:]):
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didCommitLoadForMainFrame):
* UIProcess/API/mac/WKBrowsingContextController.mm:
(didCommitLoadForFrame):
* UIProcess/API/mac/WKBrowsingContextControllerInternal.h:
* UIProcess/API/mac/WKViewPrivate.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h
Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm
Source/WebKit2/UIProcess/API/ios/WKContentView.h
Source/WebKit2/UIProcess/API/ios/WKContentView.mm
Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h
Source/WebKit2/UIProcess/API/ios/WKContentViewPrivate.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/ios/WKView.mm
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp

index 4c962f4..b15715a 100644 (file)
@@ -1,3 +1,60 @@
+2013-11-27  Sam Weinig  <sam@webkit.org>
+
+        Perform some spring cleaning to WKContentView and WKView
+        https://bugs.webkit.org/show_bug.cgi?id=124961
+
+        Reviewed by Dan Bernstein.
+
+        - Store the PageClientImpl in a std::unique_ptr.
+        - Remove the WKBrowsingContextController internal load delegate. Replace its use with
+          a new PageClient function, didCommitLoadForMainFrame.
+        - Fix typo in the WKContentViewDelegate. contentViewdidCommitLoadForMainFrame -> contentViewDidCommitLoadForMainFrame.
+        - Add initializers for WKContentView and WKView that take WKContextRefs and WKPageGroupRefs to match the Mac WKView.
+          These are needed for WebKitTestRunner.
+        - Require a WKProcessGroup (or WKContextRef) and a WKBrowsingContextGroup (or WKPageGroupRef).
+        - Stop caching the WKProcessGroup and WKBrowsingContextGroup on the WKContentView.
+        - Remove incorrect implementations of initWithCoder.
+        - Make WKContentView lazily create its WKBrowsingContextController wrapper.
+
+        * UIProcess/API/ios/PageClientImplIOS.h:
+        * UIProcess/API/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::PageClientImpl):
+        (WebKit::PageClientImpl::didCommitLoadForMainFrame):
+        (WebKit::PageClientImpl::mainDocumentDidReceiveMobileDocType):
+        * UIProcess/API/ios/WKContentView.h:
+        * UIProcess/API/ios/WKContentView.mm:
+        (-[WKContentView initWithCoder:]):
+        (-[WKContentView initWithFrame:processGroup:browsingContextGroup:]):
+        (-[WKContentView browsingContextController]):
+        (-[WKContentView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
+        (-[WKContentView _didCommitLoadForMainFrame]):
+        (-[WKContentView _didReceiveMobileDocTypeForMainFrame]):
+        (-[WKContentView _didChangeViewportArguments:WebCore::]):
+        (-[WKContentView _decidePolicyForGeolocationRequestFromOrigin:frame:request:]):
+        (-[WKContentView _pageRef]):
+        (-[WKContentView initWithFrame:contextRef:pageGroupRef:]):
+        (-[WKContentView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
+        * UIProcess/API/ios/WKContentViewInternal.h:
+        * UIProcess/API/ios/WKContentViewPrivate.h: Added.
+        * UIProcess/API/ios/WKView.mm:
+        (-[WKView initWithFrame:processGroup:browsingContextGroup:]):
+        (-[WKView initWithFrame:processGroup:browsingContextGroup:relatedToView:]):
+        (-[WKView contentViewDidCommitLoadForMainFrame:]):
+        (-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
+        (-[WKView pageRef]):
+        (-[WKView initWithFrame:contextRef:pageGroupRef:]):
+        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didCommitLoadForMainFrame):
+        * UIProcess/API/mac/WKBrowsingContextController.mm:
+        (didCommitLoadForFrame):
+        * UIProcess/API/mac/WKBrowsingContextControllerInternal.h:
+        * UIProcess/API/mac/WKViewPrivate.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didCommitLoadForFrame):
+
 2013-11-28  Éva Balázsfalvi  <balazsfalvi.eva@stud.u-szeged.hu>
 
         Buildfix after r159824 for GCC 4.6
index 8109128..3c3dead 100644 (file)
@@ -35,12 +35,10 @@ namespace WebKit {
     
 class PageClientImpl : public PageClient {
 public:
-    static PassOwnPtr<PageClientImpl> create(WKContentView *);
+    explicit PageClientImpl(WKContentView *);
     virtual ~PageClientImpl();
     
 private:
-    explicit PageClientImpl(WKContentView *);
-    
     virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() OVERRIDE;
     virtual void setViewNeedsDisplay(const WebCore::IntRect&) OVERRIDE;
     virtual void displayView() OVERRIDE;
@@ -58,6 +56,7 @@ private:
     virtual void preferencesDidChange() OVERRIDE;
     virtual void toolTipChanged(const String&, const String&) OVERRIDE;
     virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&) OVERRIDE;
+    virtual void didCommitLoadForMainFrame() OVERRIDE;
     virtual void didChangeContentSize(const WebCore::IntSize&) OVERRIDE;
     virtual void setCursor(const WebCore::Cursor&) OVERRIDE;
     virtual void setCursorHiddenUntilMouseMoves(bool) OVERRIDE;
index 471ad2d..27c3f3a 100644 (file)
@@ -42,20 +42,15 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassOwnPtr<PageClientImpl> PageClientImpl::create(WKContentView *view)
+PageClientImpl::PageClientImpl(WKContentView *view)
+    : m_view(view)
 {
-    return adoptPtr(new PageClientImpl(view));
 }
 
 PageClientImpl::~PageClientImpl()
 {
 }
-    
-PageClientImpl::PageClientImpl(WKContentView *view)
-    : m_view(view)
-{
-}
-    
+
 std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
 {
     return [m_view _createDrawingAreaProxy];
@@ -150,6 +145,11 @@ bool PageClientImpl::decidePolicyForGeolocationPermissionRequest(WebFrameProxy&
     return true;
 }
 
+void PageClientImpl::didCommitLoadForMainFrame()
+{
+    [m_view _didCommitLoadForMainFrame];
+}
+
 void PageClientImpl::didChangeContentSize(const IntSize& contentsSize)
 {
     [m_view _didChangeContentSize:contentsSize];
@@ -318,7 +318,7 @@ void PageClientImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
 
 void PageClientImpl::mainDocumentDidReceiveMobileDocType()
 {
-    [m_view _mainDocumentDidReceiveMobileDocType];
+    [m_view _didReceiveMobileDocTypeForMainFrame];
 }
 
 void PageClientImpl::didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius)
index f8efa8d..7bb6c48 100644 (file)
@@ -38,10 +38,9 @@ typedef NS_ENUM(unsigned, WKContentType)
 };
 
 @protocol WKContentViewDelegate <NSObject>
-
 @optional
 - (void)contentView:(WKContentView *)contentView contentsSizeDidChange:(CGSize)newSize;
-- (void)contentViewdidCommitLoadForMainFrame:(WKContentView *)contentView;
+- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView;
 - (void)contentViewDidReceiveMobileDocType:(WKContentView *)contentView;
 - (void)contentView:(WKContentView *)contentView didChangeViewportArgumentsSize:(CGSize)newSize initialScale:(float)initialScale minimumScale:(float)minimumScale maximumScale:(float)maximumScale allowsUserScaling:(float)allowsUserScaling;
 
@@ -49,6 +48,7 @@ typedef NS_ENUM(unsigned, WKContentType)
 
 WK_API_CLASS
 @interface WKContentView : UIView
+
 @property (readonly, nonatomic) WKBrowsingContextController *browsingContextController;
 
 @property (nonatomic, assign) id <WKContentViewDelegate> delegate;
index f070cfe..5cd9004 100644 (file)
@@ -34,7 +34,7 @@
 #import "WKBrowsingContextGroupPrivate.h"
 #import "WKGeolocationProviderIOS.h"
 #import "WKInteractionView.h"
-#import "WKProcessGroupPrivate.h"
+#import "WKProcessGroupInternal.h"
 #import "WebContext.h"
 #import "WebFrameProxy.h"
 #import "WebPageGroup.h"
 using namespace WebCore;
 using namespace WebKit;
 
-@interface WKContentView (Internal) <WKBrowsingContextLoadDelegateInternal>
-@end
-
 @implementation WKContentView {
-    RetainPtr<WKProcessGroup> _processGroup;
-    RetainPtr<WKBrowsingContextGroup> _browsingContextGroup;
-    OwnPtr<PageClientImpl> _pageClient;
+    std::unique_ptr<PageClientImpl> _pageClient;
     RefPtr<WebPageProxy> _page;
 
     RetainPtr<WKBrowsingContextController> _browsingContextController;
@@ -65,16 +60,9 @@ using namespace WebKit;
 
 - (id)initWithCoder:(NSCoder *)coder
 {
-    if (!(self = [super initWithCoder:coder]))
-        return nil;
-
-    [self _commonInitWithProcessGroup:nil browsingContextGroup:nil];
-    return self;
-}
-
-- (id)initWithFrame:(CGRect)frame
-{
-    return [self initWithFrame:frame processGroup:nil browsingContextGroup:nil];
+    // FIXME: Implement.
+    [self release];
+    return nil;
 }
 
 - (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
@@ -82,7 +70,7 @@ using namespace WebKit;
     if (!(self = [super initWithFrame:frame]))
         return nil;
 
-    [self _commonInitWithProcessGroup:processGroup browsingContextGroup:browsingContextGroup];
+    [self _commonInitializationWithContextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:nullptr];
     return self;
 }
 
@@ -116,6 +104,8 @@ using namespace WebKit;
 
 - (WKBrowsingContextController *)browsingContextController
 {
+    if (!_browsingContextController)
+        _browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(_page.get())]);
     return _browsingContextController.get();
 }
 
@@ -148,12 +138,9 @@ using namespace WebKit;
     _page->didFinishZooming(scale);
 }
 
-- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin&)origin frame:(WebFrameProxy&)frame request:(GeolocationPermissionRequestProxy&)permissionRequest
-{
-    [[_processGroup _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&origin) frame:toAPI(&frame) request:toAPI(&permissionRequest) window:[self window]];
-}
+#pragma mark Internal
 
-- (void)_commonInitWithProcessGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
+- (void)_commonInitializationWithContextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
 {
     // FIXME: This should not be necessary, find why hit testing does not work otherwise.
     // <rdar://problem/12287363>
@@ -163,18 +150,12 @@ using namespace WebKit;
     InitWebCoreSystemInterface();
     RunLoop::initializeMainRunLoop();
 
-    _processGroup = processGroup ? processGroup : adoptNS([[WKProcessGroup alloc] init]);
-    _browsingContextGroup = browsingContextGroup ? browsingContextGroup : adoptNS([[WKBrowsingContextGroup alloc] initWithIdentifier:nil]);
-    _pageClient = PageClientImpl::create(self);
-    WebContext* processContext = toImpl([_processGroup _contextRef]);
-    _page = processContext->createWebPage(_pageClient.get(), toImpl([_browsingContextGroup _pageGroupRef]));
+    _pageClient = std::make_unique<PageClientImpl>(self);
+    _page = toImpl(contextRef)->createWebPage(_pageClient.get(), toImpl(pageGroupRef), toImpl(relatedPage));
     _page->initializeWebPage();
     _page->setIntrinsicDeviceScaleFactor([UIScreen mainScreen].scale);
     _page->setUseFixedLayout(true);
 
-    _browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(_page.get())]);
-    [_browsingContextController setLoadDelegateInternal:self];
-
     WebContext::statistics().wkViewCount++;
 
     _rootContentView = adoptNS([[UIView alloc] init]);
@@ -202,17 +183,6 @@ using namespace WebKit;
     _page->setIntrinsicDeviceScaleFactor(screen.scale);
 }
 
-- (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)arguments
-{
-    if ([_delegate respondsToSelector:@selector(contentView:didChangeViewportArgumentsSize:initialScale:minimumScale:maximumScale:allowsUserScaling:)])
-        [_delegate contentView:self
-didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height)
-                  initialScale:arguments.zoom
-                  minimumScale:arguments.minZoom
-                  maximumScale:arguments.maxZoom
-             allowsUserScaling:arguments.userZoom];
-}
-
 #pragma mark PageClientImpl methods
 
 - (std::unique_ptr<DrawingAreaProxy>)_createDrawingAreaProxy
@@ -230,11 +200,10 @@ didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height)
     // FIXME: Implement.
 }
 
-- (void)browsingContextControllerDidCommitLoad:(WKBrowsingContextController *)sender
+- (void)_didCommitLoadForMainFrame
 {
-    ASSERT(sender == _browsingContextController);
-    if ([_delegate respondsToSelector:@selector(contentViewdidCommitLoadForMainFrame:)])
-        [_delegate contentViewdidCommitLoadForMainFrame:self];
+    if ([_delegate respondsToSelector:@selector(contentViewDidCommitLoadForMainFrame:)])
+        [_delegate contentViewDidCommitLoadForMainFrame:self];
 }
 
 - (void)_didChangeContentSize:(CGSize)contentsSize
@@ -247,11 +216,16 @@ didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height)
         [_delegate contentView:self contentsSizeDidChange:contentsSize];
 }
 
-- (void)_mainDocumentDidReceiveMobileDocType
+- (void)_didReceiveMobileDocTypeForMainFrame
 {
     if ([_delegate respondsToSelector:@selector(contentViewDidReceiveMobileDocType:)])
         [_delegate contentViewDidReceiveMobileDocType:self];
+}
 
+- (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)arguments
+{
+    if ([_delegate respondsToSelector:@selector(contentView:didChangeViewportArgumentsSize:initialScale:minimumScale:maximumScale:allowsUserScaling:)])
+        [_delegate contentView:self didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height) initialScale:arguments.zoom minimumScale:arguments.minZoom maximumScale:arguments.maxZoom allowsUserScaling:arguments.userZoom];
 }
 
 - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const Color&)color quads:(const Vector<FloatQuad>&)highlightedQuads topLeftRadius:(const IntSize&)topLeftRadius topRightRadius:(const IntSize&)topRightRadius bottomLeftRadius:(const IntSize&)bottomLeftRadius bottomRightRadius:(const IntSize&)bottomRightRadius
@@ -285,4 +259,32 @@ didChangeViewportArgumentsSize:CGSizeMake(arguments.width, arguments.height)
     return [_interactionView _interpretKeyEvent:theEvent isCharEvent:isCharEvent];
 }
 
+- (void)_decidePolicyForGeolocationRequestFromOrigin:(WebSecurityOrigin&)origin frame:(WebFrameProxy&)frame request:(GeolocationPermissionRequestProxy&)permissionRequest
+{
+    [[wrapper(*_page->process()->context()) _geolocationProvider] decidePolicyForGeolocationRequestFromOrigin:toAPI(&origin) frame:toAPI(&frame) request:toAPI(&permissionRequest) window:[self window]];
+}
+
+@end
+
+@implementation WKContentView (Private)
+
+- (WKPageRef)_pageRef
+{
+    return toAPI(_page.get());
+}
+
+- (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;
+}
+
 @end
index b63bf0b..2396ee7 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WKContentView.h"
-
+#import "WKContentViewPrivate.h"
 #import <wtf/Forward.h>
 #import <wtf/Vector.h>
 
@@ -50,10 +49,12 @@ class WebSecurityOrigin;
 - (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
 - (void)_processDidCrash;
 - (void)_didRelaunchProcess;
-- (void)_didChangeContentSize:(CGSize)contentsSize;
 - (void)_setAcceleratedCompositingRootLayer:(CALayer *)rootLayer;
 
-- (void)_mainDocumentDidReceiveMobileDocType;
+- (void)_didCommitLoadForMainFrame;
+- (void)_didChangeContentSize:(CGSize)contentsSize;
+- (void)_didReceiveMobileDocTypeForMainFrame;
+- (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)viewportArguments;
 
 - (void)_didGetTapHighlightForRequest:(uint64_t)requestID color:(const WebCore::Color&)color quads:(const Vector<WebCore::FloatQuad>&)highlightedQuads topLeftRadius:(const WebCore::IntSize&)topLeftRadius topRightRadius:(const WebCore::IntSize&)topRightRadius bottomLeftRadius:(const WebCore::IntSize&)bottomLeftRadius bottomRightRadius:(const WebCore::IntSize&)bottomRightRadius;
 
@@ -61,7 +62,6 @@ class WebSecurityOrigin;
 - (void)_stopAssistingNode;
 - (void)_selectionChanged;
 - (BOOL)_interpretKeyEvent:(WebIOSEvent *)theEvent isCharEvent:(BOOL)isCharEvent;
-- (void)_didChangeViewportArguments:(const WebCore::ViewportArguments&)viewportArguments;
 
 - (void)_decidePolicyForGeolocationRequestFromOrigin:(WebKit::WebSecurityOrigin&)origin frame:(WebKit::WebFrameProxy&)frame request:(WebKit::GeolocationPermissionRequestProxy&)permissionRequest;
 
diff --git a/Source/WebKit2/UIProcess/API/ios/WKContentViewPrivate.h b/Source/WebKit2/UIProcess/API/ios/WKContentViewPrivate.h
new file mode 100644 (file)
index 0000000..5627829
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2013 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 <WebKit2/WKBase.h>
+#import <WebKit2/WKContentView.h>
+
+@interface WKContentView (Private)
+
+@property (readonly) WKPageRef _pageRef;
+
+- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
+- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage;
+
+@end
index 21d4c43..c916178 100644 (file)
  */
 
 #import "config.h"
-#import "WKView.h"
+#import "WKViewPrivate.h"
 
+#import "WKBrowsingContextGroupPrivate.h"
 #import "WKContentView.h"
+#import "WKContentViewPrivate.h"
+#import "WKProcessGroupPrivate.h"
 #import "WKScrollView.h"
 #import <UIKit/UIScreen.h>
 #import <UIKit/UIScrollView_Private.h>
@@ -52,33 +55,24 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
 - (id)initWithCoder:(NSCoder *)coder
 {
     // FIXME: Implement.
+    [self release];
     return nil;
 }
 
-- (id)initWithFrame:(CGRect)frame
+- (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
 {
-    if (!(self = [super initWithFrame:frame]))
-        return nil;
-
-    [self _commonInitializationWithProcessGroup:nil browsingContextGroup:nil];
-    return self;
+    return [self initWithFrame:frame processGroup:processGroup browsingContextGroup:browsingContextGroup relatedToView:nil];
 }
 
-- (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
+- (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup relatedToView:(WKView *)relatedView
 {
     if (!(self = [super initWithFrame:frame]))
         return nil;
 
-    [self _commonInitializationWithProcessGroup:processGroup browsingContextGroup:browsingContextGroup];
+    [self _commonInitializationWithContextRef:processGroup._contextRef pageGroupRef:browsingContextGroup._pageGroupRef relatedToPage:relatedView ? [relatedView pageRef] : nullptr];
     return self;
 }
 
-- (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup relatedToView:(WKView *)relatedView
-{
-    // FIXME: Implement.
-    return nil;
-}
-
 - (void)setFrame:(CGRect)frame
 {
     CGRect oldFrame = [self frame];
@@ -115,7 +109,7 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
     }];
 }
 
-- (void)contentViewdidCommitLoadForMainFrame:(WKContentView *)contentView
+- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
 {
     _userHasChangedPageScale = NO;
 
@@ -156,6 +150,7 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
 }
 
 #pragma mark - _UIWebViewportHandlerDelegate
+
 - (void)viewportHandlerDidChangeScales:(_UIWebViewportHandler *)viewportHandler
 {
     ASSERT(viewportHandler == _viewportHandler);
@@ -180,6 +175,7 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
 
 
 #pragma mark - UIScrollViewDelegate
+
 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
 {
     ASSERT(_scrollView == scrollView);
@@ -217,7 +213,7 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
 
 #pragma mark Internal
 
-- (void)_commonInitializationWithProcessGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
+- (void)_commonInitializationWithContextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage
 {
     ASSERT(!_scrollView);
     ASSERT(!_contentView);
@@ -230,7 +226,7 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
 
     [self addSubview:_scrollView.get()];
 
-    _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds processGroup:processGroup browsingContextGroup:browsingContextGroup]);
+    _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:relatedPage]);
     [_contentView setDelegate:self];
     [[_contentView layer] setAnchorPoint:CGPointZero];
     [_contentView setFrame:bounds];
@@ -264,3 +260,26 @@ static struct _UIWebViewportConfiguration standardViewportConfiguration = { { UI
 }
 
 @end
+
+@implementation WKView (Private)
+
+- (WKPageRef)pageRef
+{
+    return [_contentView _pageRef];
+}
+
+- (id)initWithFrame:(CGRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef
+{
+    return [self initWithFrame:frame contextRef:contextRef pageGroupRef:pageGroupRef relatedToPage:nil];
+}
+
+- (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;
+}
+
+@end
index f22a5e4..fe7291f 100644 (file)
@@ -69,6 +69,7 @@ private:
     virtual void didRelaunchProcess();
     virtual void preferencesDidChange() OVERRIDE;
     virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
+    virtual void didCommitLoadForMainFrame() OVERRIDE;
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);
     virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
index 6b08f64..91f682e 100644 (file)
@@ -264,6 +264,10 @@ void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newT
     [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)];
 }
 
+void PageClientImpl::didCommitLoadForMainFrame()
+{
+}
+
 void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
 {
     if (![NSApp _cursorRectCursor])
index 2ca59da..f586cd6 100644 (file)
@@ -398,10 +398,6 @@ static void didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us
         return;
 
     WKBrowsingContextController *browsingContext = (WKBrowsingContextController *)clientInfo;
-#if PLATFORM(IOS)
-    if ([browsingContext.loadDelegateInternal respondsToSelector:@selector(browsingContextControllerDidCommitLoad:)])
-        [browsingContext.loadDelegateInternal browsingContextControllerDidCommitLoad:browsingContext];
-#endif // PLATFORM(IOS)
     if ([browsingContext.loadDelegate respondsToSelector:@selector(browsingContextControllerDidCommitLoad:)])
         [browsingContext.loadDelegate browsingContextControllerDidCommitLoad:browsingContext];
 }
index 4b70d27..a2145d5 100644 (file)
 
 #if WK_API_ENABLED
 
-#if PLATFORM(IOS)
-@protocol WKBrowsingContextLoadDelegateInternal <NSObject>
-@optional
-- (void)browsingContextControllerDidCommitLoad:(WKBrowsingContextController *)sender;
-@end
-#endif // PLATFORM(IOS)
-
 @interface WKBrowsingContextController ()
 
-#if PLATFORM(IOS)
-@property (assign) id <WKBrowsingContextLoadDelegateInternal> loadDelegateInternal;
-#endif // PLATFORM(IOS)
-
 /* This should only be called from associate view. */
 - (id)_initWithPageRef:(WKPageRef)pageRef;
 
index d376bb8..8c0fea9 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKit2/WKView.h>
 #import <WebKit2/WKBase.h>
+#import <WebKit2/WKView.h>
+
+#if !TARGET_OS_IPHONE
 
 typedef enum {
     WKContentAnchorTopLeft,
@@ -33,15 +35,25 @@ typedef enum {
     WKContentAnchorBottomRight,
 } WKContentAnchor;
 
+#endif
+
 @interface WKView (Private)
 
 /* C SPI support. */
 
-@property(readonly) WKPageRef pageRef;
-@property WKContentAnchor contentAnchor;
+@property (readonly) WKPageRef pageRef;
 
+#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;
+#else
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef relatedToPage:(WKPageRef)relatedPage;
+#endif
+
+#if !TARGET_OS_IPHONE
+
+@property WKContentAnchor contentAnchor;
 
 - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
 - (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef;
@@ -82,4 +94,6 @@ typedef enum {
 - (void)forceAsyncDrawingAreaSizeUpdate:(NSSize)size;
 - (void)waitForAsyncDrawingAreaSizeUpdate;
 
+#endif
+
 @end
index d2c6725..e4b9195 100644 (file)
@@ -125,6 +125,8 @@ public:
         return false;
     }
 
+    virtual void didCommitLoadForMainFrame() = 0;
+
 #if USE(TILED_BACKING_STORE)
     virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
     virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0;
index 9c198e6..5336e49 100644 (file)
@@ -2158,8 +2158,10 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp
     WebFrameProxy* frame = m_process->webFrame(frameID);
     MESSAGE_CHECK(frame);
 
-    if (frame->isMainFrame())
+    if (frame->isMainFrame()) {
         m_pageLoadState.didCommitLoad();
+        m_pageClient->didCommitLoadForMainFrame();
+    }
 
 #if USE(APPKIT)
     // FIXME (bug 59111): didCommitLoadForFrame comes too late when restoring a page from b/f cache, making us disable secure event mode in password fields.