Title: [159859] trunk/Source/WebKit2
Revision
159859
Author
wei...@apple.com
Date
2013-11-28 13:01:11 -0800 (Thu, 28 Nov 2013)

Log Message

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):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (159858 => 159859)


--- trunk/Source/WebKit2/ChangeLog	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-28 21:01:11 UTC (rev 159859)
@@ -1,3 +1,60 @@
+2013-11-27  Sam Weinig  <s...@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....@stud.u-szeged.hu>
 
         Buildfix after r159824 for GCC 4.6

Modified: trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -35,12 +35,10 @@
     
 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 @@
     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;

Modified: trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/ios/PageClientImplIOS.mm	2013-11-28 21:01:11 UTC (rev 159859)
@@ -42,20 +42,15 @@
 
 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 @@
     return true;
 }
 
+void PageClientImpl::didCommitLoadForMainFrame()
+{
+    [m_view _didCommitLoadForMainFrame];
+}
+
 void PageClientImpl::didChangeContentSize(const IntSize& contentsSize)
 {
     [m_view _didChangeContentSize:contentsSize];
@@ -318,7 +318,7 @@
 
 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)

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


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -38,10 +38,9 @@
 };
 
 @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 @@
 
 WK_API_CLASS
 @interface WKContentView : UIView
+
 @property (readonly, nonatomic) WKBrowsingContextController *browsingContextController;
 
 @property (nonatomic, assign) id <WKContentViewDelegate> delegate;

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


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm	2013-11-28 21:01:11 UTC (rev 159859)
@@ -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"
@@ -48,13 +48,8 @@
 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,24 +60,17 @@
 
 - (id)initWithCoder:(NSCoder *)coder
 {
-    if (!(self = [super initWithCoder:coder]))
-        return nil;
-
-    [self _commonInitWithProcessGroup:nil browsingContextGroup:nil];
-    return self;
+    // FIXME: Implement.
+    [self release];
+    return nil;
 }
 
-- (id)initWithFrame:(CGRect)frame
-{
-    return [self initWithFrame:frame processGroup:nil browsingContextGroup:nil];
-}
-
 - (id)initWithFrame:(CGRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
 {
     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 @@
 
 - (WKBrowsingContextController *)browsingContextController
 {
+    if (!_browsingContextController)
+        _browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(_page.get())]);
     return _browsingContextController.get();
 }
 
@@ -148,12 +138,9 @@
     _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 @@
     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 @@
     _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 @@
     // 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 @@
         [_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 @@
     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

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewInternal.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -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 @@
 - (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 @@
 - (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;
 

Added: trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewPrivate.h (0 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewPrivate.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentViewPrivate.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -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

Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKView.mm	2013-11-28 21:01:11 UTC (rev 159859)
@@ -24,9 +24,12 @@
  */
 
 #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 @@
 - (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 @@
     }];
 }
 
-- (void)contentViewdidCommitLoadForMainFrame:(WKContentView *)contentView
+- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
 {
     _userHasChangedPageScale = NO;
 
@@ -156,6 +150,7 @@
 }
 
 #pragma mark - _UIWebViewportHandlerDelegate
+
 - (void)viewportHandlerDidChangeScales:(_UIWebViewportHandler *)viewportHandler
 {
     ASSERT(viewportHandler == _viewportHandler);
@@ -180,6 +175,7 @@
 
 
 #pragma mark - UIScrollViewDelegate
+
 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
 {
     ASSERT(_scrollView == scrollView);
@@ -217,7 +213,7 @@
 
 #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 @@
 
     [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 @@
 }
 
 @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

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -69,6 +69,7 @@
     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&);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-11-28 21:01:11 UTC (rev 159859)
@@ -264,6 +264,10 @@
     [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)];
 }
 
+void PageClientImpl::didCommitLoadForMainFrame()
+{
+}
+
 void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
 {
     if (![NSApp _cursorRectCursor])

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm	2013-11-28 21:01:11 UTC (rev 159859)
@@ -398,10 +398,6 @@
         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];
 }

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -27,19 +27,8 @@
 
 #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;
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -23,9 +23,11 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#import <WebKit2/WKBase.h>
 #import <WebKit2/WKView.h>
-#import <WebKit2/WKBase.h>
 
+#if !TARGET_OS_IPHONE
+
 typedef enum {
     WKContentAnchorTopLeft,
     WKContentAnchorTopRight,
@@ -33,16 +35,26 @@
     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 @@
 - (void)forceAsyncDrawingAreaSizeUpdate:(NSSize)size;
 - (void)waitForAsyncDrawingAreaSizeUpdate;
 
+#endif
+
 @end

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2013-11-28 21:01:11 UTC (rev 159859)
@@ -125,6 +125,8 @@
         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;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (159858 => 159859)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-11-28 20:59:06 UTC (rev 159858)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-11-28 21:01:11 UTC (rev 159859)
@@ -2158,8 +2158,10 @@
     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.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to