Commit 0e131da2 authored by weinig@apple.com's avatar weinig@apple.com
Browse files

[Cocoa] Make WKBrowsingContextController work with WKObject wrapping

https://bugs.webkit.org/show_bug.cgi?id=125022

Reviewed by Dan Bernstein.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
        
* Shared/mac/ObjCObjectGraphCoders.mm:
Add support for WKProcessGroup.

(WebKit::WebContextObjCObjectGraphDecoderImpl::decode):
Replace call to _browsingContextControllerForPageRef: with wrapper.

* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
Convert from wrapping the C-SPI type to storing the bits of the wrapped object inline.

(-[WKBrowsingContextController dealloc]):
Add explicit destructor call.

(-[WKBrowsingContextController setLoadDelegate:]):
(-[WKBrowsingContextController setPolicyDelegate:]):
Lazily set up the load and policy clients only once a delegate has been set to allow
continued use of the C-SPI clients for WebKitTestRunner.

(-[WKBrowsingContextController _finishInitialization]):
Move remaining work that was done in the initialize (setting up the observer) here,
and have the WebPageProxy call it.

* UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
(WebKit::wrapper):
Add wrapper() helper and declare conformance to the WKObject protocol. Remove no longer used
_initWithPageRef: and _browsingContextControllerForPageRef: helpers.

* UIProcess/API/Cocoa/WKProcessGroup.mm:
(didNavigateWithNavigationData):
(didPerformClientRedirect):
(didPerformServerRedirect):
(didUpdateHistoryTitle):
Switch to using wrapper().

* UIProcess/API/ios/WKContentView.mm:
* UIProcess/API/mac/WKView.mm:
Stop caching the WKBrowsingContextController, as it no long makes sense since it is the same object
as the WebPageProxy.

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::platformInitialize):
Inform the wrapper that it is safe to finish initialization.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec6a0371
2013-11-29 Sam Weinig <sam@webkit.org>
[Cocoa] Make WKBrowsingContextController work with WKObject wrapping
https://bugs.webkit.org/show_bug.cgi?id=125022
Reviewed by Dan Bernstein.
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* Shared/mac/ObjCObjectGraphCoders.mm:
Add support for WKProcessGroup.
(WebKit::WebContextObjCObjectGraphDecoderImpl::decode):
Replace call to _browsingContextControllerForPageRef: with wrapper.
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
Convert from wrapping the C-SPI type to storing the bits of the wrapped object inline.
(-[WKBrowsingContextController dealloc]):
Add explicit destructor call.
(-[WKBrowsingContextController setLoadDelegate:]):
(-[WKBrowsingContextController setPolicyDelegate:]):
Lazily set up the load and policy clients only once a delegate has been set to allow
continued use of the C-SPI clients for WebKitTestRunner.
(-[WKBrowsingContextController _finishInitialization]):
Move remaining work that was done in the initialize (setting up the observer) here,
and have the WebPageProxy call it.
* UIProcess/API/Cocoa/WKBrowsingContextControllerInternal.h:
(WebKit::wrapper):
Add wrapper() helper and declare conformance to the WKObject protocol. Remove no longer used
_initWithPageRef: and _browsingContextControllerForPageRef: helpers.
* UIProcess/API/Cocoa/WKProcessGroup.mm:
(didNavigateWithNavigationData):
(didPerformClientRedirect):
(didPerformServerRedirect):
(didUpdateHistoryTitle):
Switch to using wrapper().
* UIProcess/API/ios/WKContentView.mm:
* UIProcess/API/mac/WKView.mm:
Stop caching the WKBrowsingContextController, as it no long makes sense since it is the same object
as the WebPageProxy.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::platformInitialize):
Inform the wrapper that it is safe to finish initialization.
2013-11-29 Dan Bernstein <mitz@apple.com>
[Cocoa] Add a way to recover from load errors
......
......@@ -30,14 +30,15 @@
#import "WKBackForwardListInternal.h"
#import "WKBackForwardListItemInternal.h"
#import "WKBrowsingContextControllerInternal.h"
#import "WKBrowsingContextGroupInternal.h"
#import "WKProcessGroupInternal.h"
#import "WKNSArray.h"
#import "WKNSDictionary.h"
#import "WKNSError.h"
#import "WKNSString.h"
#import "WKNSURL.h"
#import "WKNavigationDataInternal.h"
#import "WKProcessGroupInternal.h"
namespace API {
......@@ -88,6 +89,10 @@ void* Object::newObject(size_t size, Type type)
wrapper = [WKNavigationData alloc];
break;
case Type::Page:
wrapper = [WKBrowsingContextController alloc];
break;
case Type::PageGroup:
wrapper = [WKBrowsingContextGroup alloc];
break;
......
......@@ -32,7 +32,6 @@
// For UIProcess side encoding/decoding
#import "WKAPICast.h"
#import "WKBrowsingContextControllerInternal.h"
#import "WKBrowsingContextControllerPrivate.h"
#import "WebContextUserMessageCoders.h"
#import "WebPageProxy.h"
#import "WebProcessProxy.h"
......@@ -343,7 +342,7 @@ public:
if (!webPage)
coder.m_root = [NSNull null];
else
coder.m_root = [WKBrowsingContextController _browsingContextControllerForPageRef:toAPI(webPage)];
coder.m_root = wrapper(*webPage);
break;
}
case WKTypeRefWrapperType: {
......
......@@ -109,24 +109,29 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
@end
@implementation WKBrowsingContextController {
// Underlying WKPageRef.
WKRetainPtr<WKPageRef> _pageRef;
std::aligned_storage<sizeof(WebPageProxy), std::alignment_of<WebPageProxy>::value>::type _page;
std::unique_ptr<PageLoadStateObserver> _pageLoadStateObserver;
}
@synthesize loadDelegate = _loadDelegate;
@synthesize policyDelegate = _policyDelegate;
- (void)dealloc
{
toImpl(_pageRef.get())->pageLoadState().removeObserver(*_pageLoadStateObserver);
WKPageSetPageLoaderClient(_pageRef.get(), nullptr);
WKPageSetPagePolicyClient(_pageRef.get(), nullptr);
reinterpret_cast<WebPageProxy*>(&_page)->~WebPageProxy();
[super dealloc];
}
- (void)_finishInitialization
{
_pageLoadStateObserver = std::make_unique<PageLoadStateObserver>(self);
reinterpret_cast<WebPageProxy*>(&_page)->pageLoadState().addObserver(*_pageLoadStateObserver);
}
- (WKProcessGroup *)processGroup
{
WebContext* context = toImpl(_pageRef.get())->process()->context();
WebContext* context = reinterpret_cast<WebPageProxy*>(&_page)->process()->context();
if (!context)
return nil;
return wrapper(*context);
......@@ -134,7 +139,7 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
- (WKBrowsingContextGroup *)browsingContextGroup
{
WebPageGroup* pageGroup = toImpl(_pageRef.get())->pageGroup();
WebPageGroup* pageGroup = reinterpret_cast<WebPageProxy*>(&_page)->pageGroup();
if (!pageGroup)
return nil;
return wrapper(*pageGroup);
......@@ -142,7 +147,7 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
- (WKPageRef)_pageRef
{
return _pageRef.get();
return toAPI(reinterpret_cast<WebPageProxy*>(&_page));
}
#pragma mark Loading
......@@ -180,7 +185,7 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
if (userData)
wkUserData = ObjCObjectGraph::create(userData);
WKPageLoadURLRequestWithUserData(_pageRef.get(), wkRequest.get(), (WKTypeRef)wkUserData.get());
WKPageLoadURLRequestWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), wkRequest.get(), (WKTypeRef)wkUserData.get());
}
- (void)loadFileURL:(NSURL *)URL restrictToFilesWithin:(NSURL *)allowedDirectory
......@@ -200,7 +205,7 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
if (userData)
wkUserData = ObjCObjectGraph::create(userData);
WKPageLoadFileWithUserData(_pageRef.get(), wkURL.get(), wkAllowedDirectory.get(), (WKTypeRef)wkUserData.get());
WKPageLoadFileWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), wkURL.get(), wkAllowedDirectory.get(), (WKTypeRef)wkUserData.get());
}
- (void)loadHTMLString:(NSString *)HTMLString baseURL:(NSURL *)baseURL
......@@ -222,7 +227,7 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
if (userData)
wkUserData = ObjCObjectGraph::create(userData);
WKPageLoadHTMLStringWithUserData(_pageRef.get(), wkHTMLString.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
WKPageLoadHTMLStringWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), wkHTMLString.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
}
- (void)loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL
......@@ -233,7 +238,7 @@ static NSString * const frameErrorKey = @"WKBrowsingContextFrameErrorKey";
CString unreachableURLString;
getURLBytes((CFURLRef)unreachableURL, unreachableURLString);
toImpl(_pageRef.get())->loadAlternateHTMLString(string, String::fromUTF8(baseURLString), String::fromUTF8(unreachableURLString));
reinterpret_cast<WebPageProxy*>(&_page)->loadAlternateHTMLString(string, String::fromUTF8(baseURLString), String::fromUTF8(unreachableURLString));
}
- (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL
......@@ -270,54 +275,54 @@ static void releaseNSData(unsigned char*, const void* data)
if (userData)
wkUserData = ObjCObjectGraph::create(userData);
WKPageLoadDataWithUserData(_pageRef.get(), toAPI(wkData.get()), wkMIMEType.get(), wkEncodingName.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
WKPageLoadDataWithUserData(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), toAPI(wkData.get()), wkMIMEType.get(), wkEncodingName.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
}
- (void)stopLoading
{
WKPageStopLoading(_pageRef.get());
WKPageStopLoading(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)reload
{
WKPageReload(_pageRef.get());
WKPageReload(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)reloadFromOrigin
{
WKPageReloadFromOrigin(_pageRef.get());
WKPageReloadFromOrigin(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
#pragma mark Back/Forward
- (void)goForward
{
WKPageGoForward(_pageRef.get());
WKPageGoForward(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (BOOL)canGoForward
{
return WKPageCanGoForward(_pageRef.get());
return WKPageCanGoForward(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)goBack
{
WKPageGoBack(_pageRef.get());
WKPageGoBack(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (BOOL)canGoBack
{
return WKPageCanGoBack(_pageRef.get());
return WKPageCanGoBack(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)goToBackForwardListItem:(WKBackForwardListItem *)item
{
toImpl(_pageRef.get())->goToBackForwardItem(&item._item);
reinterpret_cast<WebPageProxy*>(&_page)->goToBackForwardItem(&item._item);
}
- (WKBackForwardList *)backForwardList
{
WebBackForwardList* list = toImpl(_pageRef.get())->backForwardList();
WebBackForwardList* list = reinterpret_cast<WebPageProxy*>(&_page)->backForwardList();
if (!list)
return nil;
......@@ -328,56 +333,56 @@ static void releaseNSData(unsigned char*, const void* data)
- (NSURL *)activeURL
{
return autoreleased(WKPageCopyActiveURL(_pageRef.get()));
return autoreleased(WKPageCopyActiveURL(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
}
- (NSURL *)provisionalURL
{
return autoreleased(WKPageCopyProvisionalURL(_pageRef.get()));
return autoreleased(WKPageCopyProvisionalURL(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
}
- (NSURL *)committedURL
{
return autoreleased(WKPageCopyCommittedURL(_pageRef.get()));
return autoreleased(WKPageCopyCommittedURL(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
}
- (NSURL *)unreachableURL
{
return [NSURL _web_URLWithWTFString:toImpl(_pageRef.get())->pageLoadState().unreachableURL() relativeToURL:nil];
return [NSURL _web_URLWithWTFString:reinterpret_cast<WebPageProxy*>(&_page)->pageLoadState().unreachableURL() relativeToURL:nil];
}
- (double)estimatedProgress
{
return toImpl(_pageRef.get())->estimatedProgress();
return reinterpret_cast<WebPageProxy*>(&_page)->estimatedProgress();
}
#pragma mark Active Document Introspection
- (NSString *)title
{
return autoreleased(WKPageCopyTitle(_pageRef.get()));
return autoreleased(WKPageCopyTitle(toAPI(reinterpret_cast<WebPageProxy*>(&_page))));
}
#pragma mark Zoom
- (CGFloat)textZoom
{
return WKPageGetTextZoomFactor(_pageRef.get());
return WKPageGetTextZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)setTextZoom:(CGFloat)textZoom
{
return WKPageSetTextZoomFactor(_pageRef.get(), textZoom);
return WKPageSetTextZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), textZoom);
}
- (CGFloat)pageZoom
{
return WKPageGetPageZoomFactor(_pageRef.get());
return WKPageGetPageZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)setPageZoom:(CGFloat)pageZoom
{
return WKPageSetPageZoomFactor(_pageRef.get(), pageZoom);
return WKPageSetPageZoomFactor(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), pageZoom);
}
static NSError *createErrorWithRecoveryAttempter(WKErrorRef wkError, WKFrameRef frame, WKBrowsingContextController *browsingContext)
......@@ -602,28 +607,22 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
WKPageSetPagePolicyClient(pageRef, &policyClient);
}
/* This should only be called from associate view. */
- (id)_initWithPageRef:(WKPageRef)pageRef
- (void)setLoadDelegate:(id<WKBrowsingContextLoadDelegate>)loadDelegate
{
self = [super init];
if (!self)
return nil;
_pageRef = pageRef;
_pageLoadStateObserver = std::make_unique<PageLoadStateObserver>(self);
toImpl(_pageRef.get())->pageLoadState().addObserver(*_pageLoadStateObserver);
setUpPageLoaderClient(self, pageRef);
setUpPagePolicyClient(self, pageRef);
return self;
_loadDelegate = loadDelegate;
if (_loadDelegate)
setUpPageLoaderClient(self, toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
else
WKPageSetPageLoaderClient(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), nullptr);;
}
+ (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef
-(void)setPolicyDelegate:(id<WKBrowsingContextPolicyDelegate>)policyDelegate
{
return (WKBrowsingContextController *)WebKit::toImpl(pageRef)->loaderClient().client().clientInfo;
_policyDelegate = policyDelegate;
if (_policyDelegate)
setUpPagePolicyClient(self, toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
else
WKPageSetPagePolicyClient(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), nullptr);;
}
+ (NSMutableSet *)customSchemes
......@@ -655,6 +654,13 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
return YES;
}
#pragma mark WKObject protocol implementation
- (API::Object&)_apiObject
{
return *reinterpret_cast<API::Object*>(&_page);
}
@end
@implementation WKBrowsingContextController (Private)
......@@ -682,12 +688,12 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
return;
}
WKPageSetPaginationMode(_pageRef.get(), mode);
WKPageSetPaginationMode(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), mode);
}
- (WKBrowsingContextPaginationMode)paginationMode
{
switch (WKPageGetPaginationMode(_pageRef.get())) {
switch (WKPageGetPaginationMode(toAPI(reinterpret_cast<WebPageProxy*>(&_page)))) {
case kWKPaginationModeUnpaginated:
return WKPaginationModeUnpaginated;
case kWKPaginationModeLeftToRight:
......@@ -706,42 +712,42 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
- (void)setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns
{
WKPageSetPaginationBehavesLikeColumns(_pageRef.get(), behavesLikeColumns);
WKPageSetPaginationBehavesLikeColumns(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), behavesLikeColumns);
}
- (BOOL)paginationBehavesLikeColumns
{
return WKPageGetPaginationBehavesLikeColumns(_pageRef.get());
return WKPageGetPaginationBehavesLikeColumns(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)setPageLength:(CGFloat)pageLength
{
WKPageSetPageLength(_pageRef.get(), pageLength);
WKPageSetPageLength(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), pageLength);
}
- (CGFloat)pageLength
{
return WKPageGetPageLength(_pageRef.get());
return WKPageGetPageLength(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (void)setGapBetweenPages:(CGFloat)gapBetweenPages
{
WKPageSetGapBetweenPages(_pageRef.get(), gapBetweenPages);
WKPageSetGapBetweenPages(toAPI(reinterpret_cast<WebPageProxy*>(&_page)), gapBetweenPages);
}
- (CGFloat)gapBetweenPages
{
return WKPageGetGapBetweenPages(_pageRef.get());
return WKPageGetGapBetweenPages(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (NSUInteger)pageCount
{
return WKPageGetPageCount(_pageRef.get());
return WKPageGetPageCount(toAPI(reinterpret_cast<WebPageProxy*>(&_page)));
}
- (WKBrowsingContextHandle *)handle
{
return [[[WKBrowsingContextHandle alloc] _initWithPageID:toImpl(_pageRef.get())->pageID()] autorelease];
return [[[WKBrowsingContextHandle alloc] _initWithPageID:reinterpret_cast<WebPageProxy*>(&_page)->pageID()] autorelease];
}
@end
......
......@@ -27,14 +27,22 @@
#if WK_API_ENABLED
@interface WKBrowsingContextController ()
#import "WKObject.h"
#import "WebPageProxy.h"
/* This should only be called from associate view. */
- (id)_initWithPageRef:(WKPageRef)pageRef;
namespace WebKit {
/* Returns a WKBrowsingContextController associated with the WKPageRef. */
+ (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef;
inline WKBrowsingContextController *wrapper(WebPageProxy& page)
{
ASSERT([page.wrapper() isKindOfClass:[WKBrowsingContextController class]]);
return (WKBrowsingContextController *)page.wrapper();
}
}
@interface WKBrowsingContextController () <WKObject>
- (void)_finishInitialization;
+ (NSMutableSet *)customSchemes;
@end
......
......@@ -109,7 +109,7 @@ static void didNavigateWithNavigationData(WKContextRef, WKPageRef pageRef, WKNav
if (!toImpl(frameRef)->isMainFrame())
return;
WKBrowsingContextController *controller = [WKBrowsingContextController _browsingContextControllerForPageRef:pageRef];
WKBrowsingContextController *controller = wrapper(*toImpl(pageRef));
if ([controller.historyDelegate respondsToSelector:@selector(browsingContextController:didNavigateWithNavigationData:)])
[controller.historyDelegate browsingContextController:controller didNavigateWithNavigationData:wrapper(*toImpl(navigationDataRef))];
}
......@@ -119,7 +119,7 @@ static void didPerformClientRedirect(WKContextRef, WKPageRef pageRef, WKURLRef s
if (!toImpl(frameRef)->isMainFrame())
return;
WKBrowsingContextController *controller = [WKBrowsingContextController _browsingContextControllerForPageRef:pageRef];
WKBrowsingContextController *controller = wrapper(*toImpl(pageRef));
if ([controller.historyDelegate respondsToSelector:@selector(browsingContextController:didPerformClientRedirectFromURL:toURL:)])
[controller.historyDelegate browsingContextController:controller didPerformClientRedirectFromURL:wrapper(*toImpl(sourceURLRef)) toURL:wrapper(*toImpl(destinationURLRef))];
}
......@@ -129,7 +129,7 @@ static void didPerformServerRedirect(WKContextRef, WKPageRef pageRef, WKURLRef s
if (!toImpl(frameRef)->isMainFrame())
return;
WKBrowsingContextController *controller = [WKBrowsingContextController _browsingContextControllerForPageRef:pageRef];
WKBrowsingContextController *controller = wrapper(*toImpl(pageRef));
if ([controller.historyDelegate respondsToSelector:@selector(browsingContextController:didPerformServerRedirectFromURL:toURL:)])
[controller.historyDelegate browsingContextController:controller didPerformServerRedirectFromURL:wrapper(*toImpl(sourceURLRef)) toURL:wrapper(*toImpl(destinationURLRef))];
}
......@@ -139,7 +139,7 @@ static void didUpdateHistoryTitle(WKContextRef, WKPageRef pageRef, WKStringRef t
if (!toImpl(frameRef)->isMainFrame())
return;
WKBrowsingContextController *controller = [WKBrowsingContextController _browsingContextControllerForPageRef:pageRef];
WKBrowsingContextController *controller = wrapper(*toImpl(pageRef));
if ([controller.historyDelegate respondsToSelector:@selector(browsingContextController:didUpdateHistoryTitle:forURL:)])
[controller.historyDelegate browsingContextController:controller didUpdateHistoryTitle:wrapper(*toImpl(titleRef)) forURL:wrapper(*toImpl(urlRef))];
}
......
......@@ -52,8 +52,6 @@ using namespace WebKit;
std::unique_ptr<PageClientImpl> _pageClient;
RefPtr<WebPageProxy> _page;
RetainPtr<WKBrowsingContextController> _browsingContextController;
RetainPtr<UIView> _rootContentView;
RetainPtr<WKInteractionView> _interactionView;
}
......@@ -104,9 +102,7 @@ using namespace WebKit;
- (WKBrowsingContextController *)browsingContextController
{
if (!_browsingContextController)
_browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:toAPI(_page.get())]);
return _browsingContextController.get();
return wrapper(*_page);
}
- (WKContentType)contentType
......
......@@ -153,9 +153,6 @@ struct WKViewInterpretKeyEventsParameters {
@public
std::unique_ptr<PageClientImpl> _pageClient;
RefPtr<WebPageProxy> _page;
// Cache of the associated WKBrowsingContextController.
RetainPtr<WKBrowsingContextController> _browsingContextController;
// For ToolTips.
NSToolTipTag _lastToolTipTag;
......@@ -300,9 +297,7 @@ struct WKViewInterpretKeyEventsParameters {
- (WKBrowsingContextController *)browsingContextController
{
if (!_data->_browsingContextController)
_data->_browsingContextController = adoptNS([[WKBrowsingContextController alloc] _initWithPageRef:[self pageRef]]);
return _data->_browsingContextController.get();
return wrapper(*_data->_page);
}
#endif // WK_API_ENABLED
......
......@@ -32,11 +32,12 @@
#import "DictionaryPopupInfo.h"
#import "EditorState.h"
#import "NativeWebKeyboardEvent.h"
#import "PluginComplexTextInputState.h"
#import "PageClient.h"
#import "PageClientImpl.h"
#import "PluginComplexTextInputState.h"
#import "StringUtilities.h"
#import "TextChecker.h"
#import "WKBrowsingContextControllerInternal.h"
#import "WebPageMessages.h"
#import "WebProcessProxy.h"
#import <WebCore/DictationAlternative.h>
......@@ -45,8 +46,8 @@
#import <WebCore/SystemVersionMac.h>
#import <WebCore/TextAlternativeWithRange.h>
#import <WebKitSystemInterface.h>
#import <wtf/text/StringConcatenate.h>
#import <mach-o/dyld.h>
#import <wtf/text/StringConcatenate.h>
@interface NSApplication (Details)
- (void)speakString:(NSString *)string;
......@@ -67,6 +68,10 @@ static bool shouldUseLegacyImplicitRubberBandControl()
void WebPageProxy::platformInitialize()
{
m_useLegacyImplicitRubberBandControl = shouldUseLegacyImplicitRubberBandControl();
#if WK_API_ENABLED