Diff
Modified: trunk/Source/WebKit2/ChangeLog (166657 => 166658)
--- trunk/Source/WebKit2/ChangeLog 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-02 19:51:43 UTC (rev 166658)
@@ -1,3 +1,64 @@
+2014-04-02 Alice Barraclough <[email protected]>
+
+ Adding Objective-C SPI for Find in Page.
+ https://bugs.webkit.org/show_bug.cgi?id=131000 Need an Objective-C API or SPI for Find in Page
+
+ Reviewed by Dan Bernstein.
+
+ Find-on-page SPI added to WKWebView, which funnels the messages through the WebPageProxy.
+ Returning messages are designated by _WKFindDelegate protocol.
+ Also provide FindDelegate access on WKWebView.
+ WebPageProxy gets a new-style API::FindClient.
+ Also had to replicate WKFindOptions as _WKFindOptions in Cocoa SPI. This is unfortunate, but it
+ does follow the pattern of other options & enums related to classes that are SPI-for-now.
+
+ PageClientImplIOS handles setFindIndicator function by forwarding to its WKContentView,
+ but WKContentView _setFindIndicator remains unimplemented for now.
+
+ * UIProcess/API/APIFindClient.h: Added.
+ (API::FindClient::~FindClient):
+ (API::FindClient::didCountStringMatches):
+ (API::FindClient::didFindString):
+ (API::FindClient::didFailToFindString):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageFindClient):
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ (-[WKWebView _findDelegate]):
+ (-[WKWebView _setFindDelegate:]):
+ (toFindOptions):
+ (-[WKWebView _countStringMatches:options:maxCount:]):
+ (-[WKWebView _findString:options:maxCount:]):
+ (-[WKWebView _hideFindUI]):
+ (-[WKWebView _hostForFindUI]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ (NS_OPTIONS):
+ * UIProcess/API/Cocoa/_WKFindDelegate.h: Added.
+ * UIProcess/Cocoa/FindClient.h: Added.
+ * UIProcess/Cocoa/FindClient.mm: Added.
+ (WebKit::FindClient::FindClient):
+ (WebKit::FindClient::delegate):
+ (WebKit::FindClient::setDelegate):
+ (WebKit::FindClient::didCountStringMatches):
+ (WebKit::FindClient::didFindString):
+ (WebKit::FindClient::didFailToFindString):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::setFindClient):
+ (WebKit::WebPageProxy::close):
+ (WebKit::WebPageProxy::didCountStringMatches):
+ (WebKit::WebPageProxy::didFindString):
+ (WebKit::WebPageProxy::didFailToFindString):
+ (WebKit::WebPageProxy::initializeFindClient): Deleted.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::findClient):
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::setFindIndicator):
+ * UIProcess/ios/WKContentView.h:
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView _setFindIndicator:WebKit::fadeOut:animate:]):
+ * WebKit2.xcodeproj/project.pbxproj:
+
2014-04-02 Anders Carlsson <[email protected]>
Rename -[WKBackForwardListItem originalURL] to -[WKBackForwardListItem initialURL]
Added: trunk/Source/WebKit2/UIProcess/API/APIFindClient.h (0 => 166658)
--- trunk/Source/WebKit2/UIProcess/API/APIFindClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIFindClient.h 2014-04-02 19:51:43 UTC (rev 166658)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef APIFindClient_h
+#define APIFindClient_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+class WebPageProxy;
+}
+
+namespace API {
+
+class FindClient {
+public:
+ virtual ~FindClient() { }
+
+ virtual void didCountStringMatches(WebKit::WebPageProxy*, const WTF::String&, uint32_t matchCount) { }
+ virtual void didFindString(WebKit::WebPageProxy*, const WTF::String&, uint32_t matchCount) { }
+ virtual void didFailToFindString(WebKit::WebPageProxy*, const WTF::String&) { }
+};
+
+} // namespace API
+
+#endif // APIFindClient_h
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2014-04-02 19:51:43 UTC (rev 166658)
@@ -29,6 +29,7 @@
#include "APIArray.h"
#include "APIData.h"
+#include "APIFindClient.h"
#include "APILoaderClient.h"
#include "APIPolicyClient.h"
#include "APIUIClient.h"
@@ -676,7 +677,40 @@
void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClientBase* wkClient)
{
- toImpl(pageRef)->initializeFindClient(wkClient);
+ class FindClient : public API::Client<WKPageFindClientBase>, public API::FindClient {
+ public:
+ explicit FindClient(const WKPageFindClientBase* client)
+ {
+ initialize(client);
+ }
+
+ private:
+ virtual void didFindString(WebPageProxy* page, const String& string, uint32_t matchCount) override
+ {
+ if (!m_client.didFindString)
+ return;
+
+ m_client.didFindString(toAPI(page), toAPI(string.impl()), matchCount, m_client.base.clientInfo);
+ }
+
+ virtual void didFailToFindString(WebPageProxy* page, const String& string) override
+ {
+ if (!m_client.didFailToFindString)
+ return;
+
+ m_client.didFailToFindString(toAPI(page), toAPI(string.impl()), m_client.base.clientInfo);
+ }
+
+ virtual void didCountStringMatches(WebPageProxy* page, const String& string, uint32_t matchCount) override
+ {
+ if (m_client.didCountStringMatches)
+ return;
+
+ m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), matchCount, m_client.base.clientInfo);
+ }
+ };
+
+ toImpl(pageRef)->setFindClient(std::make_unique<FindClient>(wkClient));
}
void WKPageSetPageFindMatchesClient(WKPageRef pageRef, const WKPageFindMatchesClientBase* wkClient)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-04-02 19:51:43 UTC (rev 166658)
@@ -28,6 +28,7 @@
#if WK_API_ENABLED
+#import "FindClient.h"
#import "NavigationState.h"
#import "RemoteLayerTreeTransaction.h"
#import "RemoteObjectRegistry.h"
@@ -53,6 +54,7 @@
#import "WebPageGroup.h"
#import "WebPageProxy.h"
#import "WebProcessProxy.h"
+#import "_WKFindDelegate.h"
#import "_WKRemoteObjectRegistryInternal.h"
#import "_WKUserContentController.h"
#import "_WKVisitedLinkProviderInternal.h"
@@ -197,9 +199,8 @@
_navigationState = std::make_unique<WebKit::NavigationState>(self);
_page->setPolicyClient(_navigationState->createPolicyClient());
_page->setLoaderClient(_navigationState->createLoaderClient());
-
_page->setUIClient(std::make_unique<WebKit::UIClient>(self));
-
+ _page->setFindClient(std::make_unique<WebKit::FindClient>(self));
return self;
}
@@ -1082,6 +1083,55 @@
_page->setPageZoomFactor(zoomFactor);
}
+- (id <_WKFindDelegate>)_findDelegate
+{
+ return [static_cast<WebKit::FindClient&>(_page->findClient()).delegate().leakRef() autorelease];
+}
+
+- (void)_setFindDelegate:(id<_WKFindDelegate>)findDelegate
+{
+ static_cast<WebKit::FindClient&>(_page->findClient()).setDelegate(findDelegate);
+}
+
+static inline WebKit::FindOptions toFindOptions(_WKFindOptions wkFindOptions)
+{
+ unsigned findOptions = 0;
+
+ if (wkFindOptions & _WKFindOptionsCaseInsensitive)
+ findOptions |= WebKit::FindOptionsCaseInsensitive;
+ if (wkFindOptions & _WKFindOptionsAtWordStarts)
+ findOptions |= WebKit::FindOptionsAtWordStarts;
+ if (wkFindOptions & _WKFindOptionsTreatMedialCapitalAsWordStart)
+ findOptions |= WebKit::FindOptionsTreatMedialCapitalAsWordStart;
+ if (wkFindOptions & _WKFindOptionsBackwards)
+ findOptions |= WebKit::FindOptionsBackwards;
+ if (wkFindOptions & _WKFindOptionsWrapAround)
+ findOptions |= WebKit::FindOptionsWrapAround;
+ if (wkFindOptions & _WKFindOptionsShowOverlay)
+ findOptions |= WebKit::FindOptionsShowOverlay;
+ if (wkFindOptions & _WKFindOptionsShowFindIndicator)
+ findOptions |= WebKit::FindOptionsShowFindIndicator;
+ if (wkFindOptions & _WKFindOptionsShowHighlight)
+ findOptions |= WebKit::FindOptionsShowHighlight;
+
+ return static_cast<WebKit::FindOptions>(findOptions);
+}
+
+- (void)_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount
+{
+ _page->countStringMatches(string, toFindOptions(options), maxCount);
+}
+
+- (void)_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount
+{
+ _page->findString(string, toFindOptions(options), maxCount);
+}
+
+- (void)_hideFindUI
+{
+ _page->hideFindUI();
+}
+
#pragma mark iOS-specific methods
#if PLATFORM(IOS)
@@ -1176,6 +1226,11 @@
});
}
+- (UIView *)_viewForFindUI
+{
+ return [self viewForZoomingInScrollView:[self scrollView]];
+}
+
- (BOOL)_isDisplayingPDF
{
return [_customContentView isKindOfClass:[WKPDFView class]];
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2014-04-02 19:51:43 UTC (rev 166658)
@@ -40,10 +40,22 @@
_WKPaginationModeBottomToTop,
};
+typedef NS_OPTIONS(NSUInteger, _WKFindOptions) {
+ _WKFindOptionsCaseInsensitive = 1 << 0,
+ _WKFindOptionsAtWordStarts = 1 << 1,
+ _WKFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
+ _WKFindOptionsBackwards = 1 << 3,
+ _WKFindOptionsWrapAround = 1 << 4,
+ _WKFindOptionsShowOverlay = 1 << 5,
+ _WKFindOptionsShowFindIndicator = 1 << 6,
+ _WKFindOptionsShowHighlight = 1 << 7,
+};
+
@class WKBrowsingContextHandle;
@class _WKRemoteObjectRegistry;
@protocol WKHistoryDelegatePrivate;
+@protocol _WKFindDelegate;
@protocol _WKScriptMessageHandler;
@interface WKWebView (WKPrivate)
@@ -97,6 +109,8 @@
- (void)_snapshotRect:(CGRect)rectInViewCoordinates intoImageOfWidth:(CGFloat)imageWidth completionHandler:(void(^)(CGImageRef))completionHandler;
+- (UIView *)_viewForFindUI;
+
// FIXME: Remove this once nobody uses it.
@property (nonatomic, readonly) NSURL *activeURL;
@@ -121,6 +135,11 @@
@property (nonatomic, setter=_setTextZoomFactor:) double _textZoomFactor;
@property (nonatomic, setter=_setPageZoomFactor:) double _pageZoomFactor;
+@property (nonatomic, weak, setter=_setFindDelegate:) id <_WKFindDelegate> _findDelegate;
+- (void)_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
+- (void)_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
+- (void)_hideFindUI;
+
@end
#endif
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKFindDelegate.h (0 => 166658)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKFindDelegate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKFindDelegate.h 2014-04-02 19:51:43 UTC (rev 166658)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 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/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+@protocol _WKFindDelegate <NSObject>
+
+@optional
+
+- (void)_webView:(WKWebView *)webView didCountMatches:(NSUInteger)matches forString:(NSString *)string;
+- (void)_webView:(WKWebView *)webView didFindMatches:(NSUInteger)matches forString:(NSString *)string;
+- (void)_webView:(WKWebView *)webView didFailToFindString:(NSString *)string;
+
+@end
+
+#endif
Added: trunk/Source/WebKit2/UIProcess/Cocoa/FindClient.h (0 => 166658)
--- trunk/Source/WebKit2/UIProcess/Cocoa/FindClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/FindClient.h 2014-04-02 19:51:43 UTC (rev 166658)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef FindClient_h
+#define FindClient_h
+
+#import "WKFoundation.h"
+
+#if WK_API_ENABLED
+
+#import "APIFindClient.h"
+#import "WeakObjCPtr.h"
+
+@class WKWebView;
+@protocol _WKFindDelegate;
+
+namespace WebKit {
+
+class FindClient final : public API::FindClient {
+public:
+ explicit FindClient(WKWebView *);
+
+ RetainPtr<id <_WKFindDelegate>> delegate();
+ void setDelegate(id <_WKFindDelegate>);
+
+private:
+ // From API::FindClient
+ virtual void didCountStringMatches(WebPageProxy*, const String&, uint32_t matchCount);
+ virtual void didFindString(WebPageProxy*, const String&, uint32_t matchCount);
+ virtual void didFailToFindString(WebPageProxy*, const String&);
+
+ WKWebView *m_webView;
+ WeakObjCPtr<id <_WKFindDelegate>> m_delegate;
+
+ struct {
+ bool webviewDidCountStringMatches : 1;
+ bool webviewDidFindString : 1;
+ bool webviewDidFailToFindString : 1;
+ } m_delegateMethods;
+};
+
+} // namespace WebKit
+
+#endif // WK_API_ENABLED
+
+#endif // FindClient_h
Added: trunk/Source/WebKit2/UIProcess/Cocoa/FindClient.mm (0 => 166658)
--- trunk/Source/WebKit2/UIProcess/Cocoa/FindClient.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/FindClient.mm 2014-04-02 19:51:43 UTC (rev 166658)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2014 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 "config.h"
+#import "FindClient.h"
+
+#if WK_API_ENABLED
+
+#import "_WKFindDelegate.h"
+
+namespace WebKit {
+
+FindClient::FindClient(WKWebView *webView)
+ : m_webView(webView)
+{
+}
+
+RetainPtr<id <_WKFindDelegate>> FindClient::delegate()
+{
+ return m_delegate.get();
+}
+
+void FindClient::setDelegate(id <_WKFindDelegate> delegate)
+{
+ m_delegate = delegate;
+
+ m_delegateMethods.webviewDidCountStringMatches = [delegate respondsToSelector:@selector(_webView:didCountMatches:forString:)];
+ m_delegateMethods.webviewDidFindString = [delegate respondsToSelector:@selector(_webView:didFindMatches:forString:)];
+ m_delegateMethods.webviewDidFailToFindString = [delegate respondsToSelector:@selector(_webView:didFailToFindString:)];
+}
+
+void FindClient::didCountStringMatches(WebPageProxy*, const String& string, uint32_t matchCount)
+{
+ if (m_delegateMethods.webviewDidCountStringMatches)
+ [m_delegate.get() _webView:m_webView didCountMatches:matchCount forString:string];
+}
+
+void FindClient::didFindString(WebPageProxy*, const String& string, uint32_t matchCount)
+{
+ if (m_delegateMethods.webviewDidFindString)
+ [m_delegate.get() _webView:m_webView didFindMatches:matchCount forString:string];
+}
+
+void FindClient::didFailToFindString(WebPageProxy*, const String& string)
+{
+ if (m_delegateMethods.webviewDidFailToFindString)
+ [m_delegate.get() _webView:m_webView didFailToFindString:string];
+}
+
+} // namespace WebKit
+
+#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-04-02 19:51:43 UTC (rev 166658)
@@ -28,6 +28,7 @@
#include "WebPageProxy.h"
#include "APIArray.h"
+#include "APIFindClient.h"
#include "APILoaderClient.h"
#include "APIPolicyClient.h"
#include "APIUIClient.h"
@@ -257,6 +258,7 @@
, m_loaderClient(std::make_unique<API::LoaderClient>())
, m_policyClient(std::make_unique<API::PolicyClient>())
, m_uiClient(std::make_unique<API::UIClient>())
+ , m_findClient(std::make_unique<API::FindClient>())
, m_process(process)
, m_pageGroup(*configuration.pageGroup)
, m_preferences(*configuration.preferences)
@@ -473,9 +475,14 @@
setCanRunModal(m_uiClient->canRunModal());
}
-void WebPageProxy::initializeFindClient(const WKPageFindClientBase* client)
+void WebPageProxy::setFindClient(std::unique_ptr<API::FindClient> findClient)
{
- m_findClient.initialize(client);
+ if (!findClient) {
+ m_findClient = std::make_unique<API::FindClient>();
+ return;
+ }
+
+ m_findClient = std::move(findClient);
}
void WebPageProxy::initializeFindMatchesClient(const WKPageFindMatchesClientBase* client)
@@ -606,7 +613,7 @@
#if PLATFORM(EFL)
m_uiPopupMenuClient.initialize(0);
#endif
- m_findClient.initialize(0);
+ m_findClient = std::make_unique<API::FindClient>();
m_findMatchesClient.initialize(0);
#if ENABLE(CONTEXT_MENUS)
m_contextMenuClient.initialize(0);
@@ -3191,7 +3198,7 @@
void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
{
- m_findClient.didCountStringMatches(this, string, matchCount);
+ m_findClient->didCountStringMatches(this, string, matchCount);
}
void WebPageProxy::didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex)
@@ -3207,7 +3214,7 @@
void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
{
- m_findClient.didFindString(this, string, matchCount);
+ m_findClient->didFindString(this, string, matchCount);
}
void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect>> matchRects, int32_t firstIndexAfterSelection)
@@ -3230,7 +3237,7 @@
void WebPageProxy::didFailToFindString(const String& string)
{
- m_findClient.didFailToFindString(this, string);
+ m_findClient->didFailToFindString(this, string);
}
bool WebPageProxy::sendMessage(std::unique_ptr<IPC::MessageEncoder> encoder, unsigned messageSendFlags)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-04-02 19:51:43 UTC (rev 166658)
@@ -104,6 +104,7 @@
#endif
namespace API {
+class FindClient;
class LoaderClient;
class PolicyClient;
class UIClient;
@@ -476,7 +477,8 @@
#if ENABLE(CONTEXT_MENUS)
void initializeContextMenuClient(const WKPageContextMenuClientBase*);
#endif
- void initializeFindClient(const WKPageFindClientBase*);
+ API::FindClient& findClient() { return *m_findClient; }
+ void setFindClient(std::unique_ptr<API::FindClient>);
void initializeFindMatchesClient(const WKPageFindMatchesClientBase*);
void initializeFormClient(const WKPageFormClientBase*);
void setLoaderClient(std::unique_ptr<API::LoaderClient>);
@@ -1373,7 +1375,7 @@
#if PLATFORM(EFL)
WebUIPopupMenuClient m_uiPopupMenuClient;
#endif
- WebFindClient m_findClient;
+ std::unique_ptr<API::FindClient> m_findClient;
WebFindMatchesClient m_findMatchesClient;
#if ENABLE(CONTEXT_MENUS)
WebPageContextMenuClient m_contextMenuClient;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2014-04-02 19:51:43 UTC (rev 166658)
@@ -31,6 +31,7 @@
#import "_WKDownloadInternal.h"
#import "DataReference.h"
#import "DownloadProxy.h"
+#import "FindIndicator.h"
#import "NativeWebKeyboardEvent.h"
#import "InteractionInformationAtPosition.h"
#import "WKContentView.h"
@@ -303,9 +304,9 @@
return 0;
}
-void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator>, bool, bool)
+void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
{
- notImplemented();
+ [m_contentView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate];
}
void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h 2014-04-02 19:51:43 UTC (rev 166658)
@@ -35,6 +35,7 @@
namespace WebKit {
class DrawingAreaProxy;
+class FindIndicator;
class GeolocationPermissionRequestProxy;
class RemoteLayerTreeTransaction;
class WebContext;
@@ -84,4 +85,6 @@
- (BOOL)_zoomToRect:(CGRect)targetRect withOrigin:(CGPoint)origin fitEntireRect:(BOOL)fitEntireRect minimumScale:(double)minimumScale maximumScale:(double)maximumScale minimumScrollDistance:(CGFloat)minimumScrollDistance;
- (void)_zoomOutWithOrigin:(CGPoint)origin;
+- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
+
@end
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (166657 => 166658)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2014-04-02 19:51:43 UTC (rev 166658)
@@ -47,6 +47,7 @@
#import "WebSystemInterface.h"
#import "WebKitSystemInterfaceIOS.h"
#import <WebCore/FrameView.h>
+#import <WebCore/NotImplemented.h>
#import <UIKit/UIWindow_Private.h>
#import <wtf/CurrentTime.h>
#import <wtf/RetainPtr.h>
@@ -484,6 +485,11 @@
_page->applicationDidBecomeActive();
}
+- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
+{
+ notImplemented();
+}
+
@end
#endif // PLATFORM(IOS)
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (166657 => 166658)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-04-02 19:34:17 UTC (rev 166657)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-04-02 19:51:43 UTC (rev 166658)
@@ -47,6 +47,10 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 005D158F18E4C4EB00734619 /* _WKFindDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 005D158E18E4C4EB00734619 /* _WKFindDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 00B9661618E24CBA00CE1F88 /* APIFindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B9661518E24CBA00CE1F88 /* APIFindClient.h */; };
+ 00B9661918E25AE100CE1F88 /* FindClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00B9661718E25AE100CE1F88 /* FindClient.mm */; };
+ 00B9661A18E25AE100CE1F88 /* FindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 00B9661818E25AE100CE1F88 /* FindClient.h */; };
0F0C365818C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F0C365718C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm */; };
0F0C365A18C0555800F607D7 /* LayerRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0C365918C0555800F607D7 /* LayerRepresentation.h */; };
0F0C365C18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F0C365B18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm */; };
@@ -1788,6 +1792,10 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 005D158E18E4C4EB00734619 /* _WKFindDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFindDelegate.h; sourceTree = "<group>"; };
+ 00B9661518E24CBA00CE1F88 /* APIFindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIFindClient.h; sourceTree = "<group>"; };
+ 00B9661718E25AE100CE1F88 /* FindClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindClient.mm; sourceTree = "<group>"; };
+ 00B9661818E25AE100CE1F88 /* FindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindClient.h; sourceTree = "<group>"; };
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
0F0C365718C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteLayerTreeHostIOS.mm; path = ios/RemoteLayerTreeHostIOS.mm; sourceTree = "<group>"; };
@@ -4246,6 +4254,8 @@
children = (
A1DF631118E0B7C8003A3E2A /* DownloadClient.h */,
A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */,
+ 00B9661818E25AE100CE1F88 /* FindClient.h */,
+ 00B9661718E25AE100CE1F88 /* FindClient.mm */,
1A422F8D18B29C6400D8CD96 /* HistoryClient.h */,
1A422F8C18B29C6400D8CD96 /* HistoryClient.mm */,
0F0C365918C0555800F607D7 /* LayerRepresentation.h */,
@@ -4630,6 +4640,7 @@
A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */,
A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */,
A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */,
+ 005D158E18E4C4EB00734619 /* _WKFindDelegate.h */,
A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */,
379A873818BBFE0F00588AF2 /* _WKElementAction.h */,
379A873718BBFE0F00588AF2 /* _WKElementAction.mm */,
@@ -5494,6 +5505,7 @@
2DA944771884E3AB00ED86DB /* ios */,
BC111B47112F616900337BAB /* mac */,
1F7D36C018DA513F00D9D659 /* APIDownloadClient.h */,
+ 00B9661518E24CBA00CE1F88 /* APIFindClient.h */,
1A6637D618B2831F00C0BCF3 /* APIHistoryClient.h */,
1A2464F21891E45100234C5B /* APILoaderClient.h */,
1AFDD3141891B54000153970 /* APIPolicyClient.h */,
@@ -6912,6 +6924,7 @@
1A422F8B18B29B5400D8CD96 /* WKHistoryDelegatePrivate.h in Headers */,
370F34A71829CFF3009027C8 /* WKBrowsingContextHistoryDelegate.h in Headers */,
1AF05D8714688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h in Headers */,
+ 00B9661A18E25AE100CE1F88 /* FindClient.h in Headers */,
1A64245E12DE29A100CAAE2C /* UpdateInfo.h in Headers */,
BCB0B0E012305AB100B1341E /* UserMessageCoders.h in Headers */,
1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */,
@@ -6955,6 +6968,7 @@
BC032D7710F4378D0058C15A /* WebContextMenuClient.h in Headers */,
75E749EC180DBB9800088BA6 /* WebOriginDataManagerProxyMessages.h in Headers */,
512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */,
+ 00B9661618E24CBA00CE1F88 /* APIFindClient.h in Headers */,
510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */,
51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */,
1AB8A1F418400B8F00E9AE69 /* WKPageFindClient.h in Headers */,
@@ -7253,6 +7267,7 @@
7CD5EBB91746A15B000C1C45 /* WKObjCTypeWrapperRef.h in Headers */,
378E1A40181EDA010031007A /* WKObject.h in Headers */,
BC857FE612B843D800EDEB2E /* WKOpenPanelParameters.h in Headers */,
+ 005D158F18E4C4EB00734619 /* _WKFindDelegate.h in Headers */,
BC1DFE8F12B31CA8005DF730 /* WKOpenPanelResultListener.h in Headers */,
BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */,
2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */,
@@ -8192,6 +8207,7 @@
DF58C6361371ACA000F9A37C /* NativeWebWheelEventMac.mm in Sources */,
1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */,
1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
+ 00B9661918E25AE100CE1F88 /* FindClient.mm in Sources */,
1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,