[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 14:24:11 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit ba6ea117fb99fa8b564a2fff8e99e2078067c25b
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 7 21:49:47 2010 +0000
Add a WKPageFindClient, hook up WKPageCountStringMatches
https://bugs.webkit.org/show_bug.cgi?id=47373
Reviewed by Sam Weinig.
WebCore:
Export find related symbols needed by WebKit2.
* WebCore.exp.in:
WebKit2:
* Shared/APIClient.h: Added.
Add an APIClient class template which can be used to reduce duplicated
code in the client wrappers.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageFindClient):
Initialize the page find client.
* UIProcess/API/C/WKPage.h:
* UIProcess/WebFindClient.cpp: Added.
(WebKit::WebFindClient::didCountStringMatches):
Call the WKPageFindClient function.
* UIProcess/WebFindClient.h: Added.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeFindClient):
Initialize the WebFindClient.
(WebKit::WebPageProxy::findString):
Send a FindString message.
(WebKit::WebPageProxy::hideFindUI):
Send a HideFindUI message.
(WebKit::WebPageProxy::countStringMatches):
Send a CountStringMatches message.
(WebKit::WebPageProxy::didCountStringMatches):
Call the find client.
* UIProcess/WebPageProxy.messages.in:
Add new message.
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
Add new files.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::findString):
(WebKit::WebPage::hideFindUI):
Add stubs.
(WebKit::WebPage::countStringMatches):
Figure out the number of matches and send them back in the DidCountStringMatches msessage.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Add new messages.
* win/WebKit2.vcproj:
Add new files.
WebKitTools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Remove hard coded paths.
* TestWebKitAPI/Tests/WTF/VectorBasic.cpp:
(TestWebKitAPI::TEST):
Fix expected result.
* TestWebKitAPI/Tests/WebKit2/Find.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::didCountStringMatches):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/find.html: Added.
Add test for WKPageCountStringMatches.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7e3cfe2..d55d0de 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-07 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add a WKPageFindClient, hook up WKPageCountStringMatches
+ https://bugs.webkit.org/show_bug.cgi?id=47373
+
+ Export find related symbols needed by WebKit2.
+
+ * WebCore.exp.in:
+
2010-10-07 David Hyatt <hyatt at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 65d2ae9..328baff 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -568,6 +568,8 @@ __ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page17willMoveOffscreenEv
__ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
__ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy
+__ZN7WebCore4Page20unmarkAllTextMatchesEv
+__ZN7WebCore4Page21markAllMatchesForTextERKN3WTF6StringENS1_19TextCaseSensitivityEbj
__ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE
__ZN7WebCore4Page23clearUndoRedoOperationsEv
__ZN7WebCore4Page27setJavaScriptURLsAreAllowedEb
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 9fded02..04605c6 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,62 @@
+2010-10-07 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add a WKPageFindClient, hook up WKPageCountStringMatches
+ https://bugs.webkit.org/show_bug.cgi?id=47373
+
+ * Shared/APIClient.h: Added.
+ Add an APIClient class template which can be used to reduce duplicated
+ code in the client wrappers.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageFindClient):
+ Initialize the page find client.
+
+ * UIProcess/API/C/WKPage.h:
+ * UIProcess/WebFindClient.cpp: Added.
+ (WebKit::WebFindClient::didCountStringMatches):
+ Call the WKPageFindClient function.
+
+ * UIProcess/WebFindClient.h: Added.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::initializeFindClient):
+ Initialize the WebFindClient.
+
+ (WebKit::WebPageProxy::findString):
+ Send a FindString message.
+
+ (WebKit::WebPageProxy::hideFindUI):
+ Send a HideFindUI message.
+
+ (WebKit::WebPageProxy::countStringMatches):
+ Send a CountStringMatches message.
+
+ (WebKit::WebPageProxy::didCountStringMatches):
+ Call the find client.
+
+ * UIProcess/WebPageProxy.messages.in:
+ Add new message.
+
+ * WebKit2.pro:
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add new files.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::findString):
+ (WebKit::WebPage::hideFindUI):
+ Add stubs.
+
+ (WebKit::WebPage::countStringMatches):
+ Figure out the number of matches and send them back in the DidCountStringMatches msessage.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ Add new messages.
+
+ * win/WebKit2.vcproj:
+ Add new files.
+
2010-10-07 Sam Weinig <sam at webkit.org>
Update unit tests results.
diff --git a/WebKit2/Shared/APIClient.h b/WebKit2/Shared/APIClient.h
new file mode 100644
index 0000000..a84e2aa
--- /dev/null
+++ b/WebKit2/Shared/APIClient.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 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 APIClient_h
+#define APIClient_h
+
+namespace WebKit {
+
+template<typename T> class APIClient {
+public:
+ APIClient()
+ {
+ }
+
+ void initialize(const T* client)
+ {
+ if (client && !client->version)
+ m_client = *client;
+ else
+ memset(&m_client, 0, sizeof(m_client));
+ }
+
+protected:
+ T m_client;
+};
+
+} // namespace WebKit
+
+#endif // APIClient_h
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 7abf1e3..acd2dad 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -224,13 +224,20 @@ void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClient* wkClient
toImpl(pageRef)->initializeFormClient(wkClient);
}
-void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient * wkClient)
+void WKPageSetPageUIClient(WKPageRef pageRef, const WKPageUIClient* wkClient)
{
if (wkClient && wkClient->version)
return;
toImpl(pageRef)->initializeUIClient(wkClient);
}
+void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClient* wkClient)
+{
+ if (wkClient && wkClient->version)
+ return;
+ toImpl(pageRef)->initializeFindClient(wkClient);
+}
+
void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback)
{
toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), ScriptReturnValueCallback::create(context, callback));
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index ae3f3e0..af77c31 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -155,6 +155,16 @@ struct WKPageUIClient {
};
typedef struct WKPageUIClient WKPageUIClient;
+// Find client.
+typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned numMatches, const void* clientInfo);
+
+struct WKPageFindClient {
+ int version;
+ const void * clientInfo;
+ WKPageDidCountStringMatchesCallback didCountStringMatches;
+};
+typedef struct WKPageFindClient WKPageFindClient;
+
WK_EXPORT WKTypeID WKPageGetTypeID();
WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
@@ -220,6 +230,7 @@ WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClien
WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client);
WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClient* client);
WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClient* client);
+WK_EXPORT void WKPageSetPageFindClient(WKPageRef page, const WKPageFindClient* client);
typedef void (*WKPageRunJavaScriptFunction)(WKStringRef, WKErrorRef, void*);
WK_EXPORT void WKPageRunJavaScriptInMainFrame(WKPageRef page, WKStringRef script, void *context, WKPageRunJavaScriptFunction function);
diff --git a/WebKit2/UIProcess/WebFindClient.cpp b/WebKit2/UIProcess/WebFindClient.cpp
new file mode 100644
index 0000000..4772121
--- /dev/null
+++ b/WebKit2/UIProcess/WebFindClient.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "WebFindClient.h"
+#include "WKAPICast.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t numMatches)
+{
+ if (!m_client.didCountStringMatches)
+ return;
+
+ m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), numMatches, m_client.clientInfo);
+}
+
+} // namespace WebKit
+
diff --git a/WebKit2/UIProcess/WebFindClient.h b/WebKit2/UIProcess/WebFindClient.h
new file mode 100644
index 0000000..bebbbeb
--- /dev/null
+++ b/WebKit2/UIProcess/WebFindClient.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 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 WebFindClient_h
+#define WebFindClient_h
+
+#include "APIClient.h"
+#include "WKPage.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebFindClient : public APIClient<WKPageFindClient> {
+public:
+ void didCountStringMatches(WebPageProxy*, const String&, uint32_t numMatches);
+};
+
+} // namespace WebKit
+
+#endif // WebFindClient_h
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 2b6fb84..4b76fba 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -138,6 +138,11 @@ void WebPageProxy::initializeUIClient(const WKPageUIClient* client)
m_uiClient.initialize(client);
}
+void WebPageProxy::initializeFindClient(const WKPageFindClient* client)
+{
+ m_findClient.initialize(client);
+}
+
void WebPageProxy::revive()
{
m_valid = true;
@@ -494,19 +499,19 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID);
}
-void WebPageProxy::findString(const String&, WKFindDirection, WKFindOptions, unsigned maxNumMatches)
+void WebPageProxy::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxNumMatches)
{
- // FIXME: Implement.
+ process()->send(Messages::WebPage::FindString(string, findDirection, findOptions, maxNumMatches), m_pageID);
}
void WebPageProxy::hideFindUI()
{
- // FIXME: Implement.
+ process()->send(Messages::WebPage::HideFindUI(), m_pageID);
}
void WebPageProxy::countStringMatches(const String& string, bool caseInsensitive, unsigned maxNumMatches)
{
- // FIXME: Implement.
+ process()->send(Messages::WebPage::CountStringMatches(string, caseInsensitive, maxNumMatches), m_pageID);
}
void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptReturnValueCallback> prpCallback)
@@ -919,6 +924,11 @@ void WebPageProxy::clearAllEditCommands()
m_pageClient->clearAllEditCommands();
}
+void WebPageProxy::didCountStringMatches(const String& string, uint32_t numMatches)
+{
+ m_findClient.didCountStringMatches(this, string, numMatches);
+}
+
void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
{
m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 4281b3e..be81d48 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -32,6 +32,7 @@
#include "GenericCallback.h"
#include "WKBase.h"
#include "WebEvent.h"
+#include "WebFindClient.h"
#include "WebFormClient.h"
#include "WebFrameProxy.h"
#include "WebHistoryClient.h"
@@ -106,7 +107,7 @@ public:
void initializePolicyClient(const WKPagePolicyClient*);
void initializeFormClient(const WKPageFormClient*);
void initializeUIClient(const WKPageUIClient*);
-
+ void initializeFindClient(const WKPageFindClient*);
void revive();
void initializeWebPage(const WebCore::IntSize&);
@@ -172,7 +173,7 @@ public:
void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
// Find.
- void findString(const String&, WKFindDirection, WKFindOptions, unsigned maxNumMatches);
+ void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches);
void hideFindUI();
void countStringMatches(const String&, bool caseInsensitive, unsigned maxNumMatches);
@@ -269,6 +270,9 @@ private:
void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
void clearAllEditCommands();
+ // Find.
+ void didCountStringMatches(const String&, uint32_t numMatches);
+
void takeFocus(bool direction);
void setToolTip(const String&);
void setCursor(const WebCore::Cursor&);
@@ -291,6 +295,7 @@ private:
WebPolicyClient m_policyClient;
WebFormClient m_formClient;
WebUIClient m_uiClient;
+ WebFindClient m_findClient;
OwnPtr<DrawingAreaProxy> m_drawingArea;
RefPtr<WebPageNamespace> m_pageNamespace;
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index 1849875..2ef5f37 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -82,10 +82,13 @@ messages -> WebPageProxy {
BackForwardBackListCount() -> (int32_t itemID)
BackForwardForwardListCount() -> (int32_t itemID)
- # UndoRedo messages.
+ # Undo/Redo messages.
RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction)
ClearAllEditCommands()
+ # Find.
+ DidCountStringMatches(WTF::String string, uint32_t numMatches)
+
#if USE(ACCELERATED_COMPOSITING)
# Accelerated compsiting messages.
DidChangeAcceleratedCompositing(bool compositing) -> (WebKit::DrawingAreaBase::DrawingAreaInfo newDrawingArea)
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index acbda9b..e783820 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -240,6 +240,7 @@ HEADERS += \
UIProcess/WebContextInjectedBundleClient.h \
UIProcess/WebContextUserMessageCoders.h \
UIProcess/WebEditCommandProxy.h \
+ UIProcess/WebFindClient.h \
UIProcess/WebFormClient.h \
UIProcess/WebFormSubmissionListenerProxy.h \
UIProcess/WebFrameListenerProxy.h \
@@ -367,6 +368,7 @@ SOURCES += \
UIProcess/WebContext.cpp \
UIProcess/WebContextInjectedBundleClient.cpp \
UIProcess/WebEditCommandProxy.cpp \
+ UIProcess/WebFindClient.cpp \
UIProcess/WebFormClient.cpp \
UIProcess/WebFormSubmissionListenerProxy.cpp \
UIProcess/WebFrameListenerProxy.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 1bee936..c2125c1 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -85,6 +85,9 @@
1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */; };
1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */; };
+ 1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */; };
+ 1A3DD202125E5A1F004515E6 /* WebFindClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD201125E5A1F004515E6 /* WebFindClient.h */; };
+ 1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3DD205125E5A2F004515E6 /* APIClient.h */; };
1A3E736111CC2659007BD539 /* WebPlatformStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */; };
1A3E736211CC2659007BD539 /* WebPlatformStrategies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */; };
1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A433F0C113C53DD00FACDE9 /* WebErrors.h */; };
@@ -529,6 +532,9 @@
1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryMac.cpp; sourceTree = "<group>"; };
1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
1A30EAC5115D7DA30053E937 /* ConnectionMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionMac.cpp; sourceTree = "<group>"; };
+ 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFindClient.cpp; sourceTree = "<group>"; };
+ 1A3DD201125E5A1F004515E6 /* WebFindClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFindClient.h; sourceTree = "<group>"; };
+ 1A3DD205125E5A2F004515E6 /* APIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIClient.h; sourceTree = "<group>"; };
1A3E735F11CC2659007BD539 /* WebPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPlatformStrategies.h; sourceTree = "<group>"; };
1A3E736011CC2659007BD539 /* WebPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlatformStrategies.cpp; sourceTree = "<group>"; };
1A433F0C113C53DD00FACDE9 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; };
@@ -1115,6 +1121,7 @@
BCDDB314124EBCEF0048D13C /* API */,
BC111B5F112F635E00337BAB /* CoreIPCSupport */,
BC111B5A112F628200337BAB /* mac */,
+ 1A3DD205125E5A2F004515E6 /* APIClient.h */,
BCF04C8C11FF9B7D00F86A58 /* APIObject.h */,
1A043D79124FEFC100FFBFB5 /* BackingStore.cpp */,
1A043D78124FEFC100FFBFB5 /* BackingStore.h */,
@@ -1318,6 +1325,8 @@
BCB0B0DB12305A2500B1341E /* WebContextUserMessageCoders.h */,
BCA0EF9E12332642007D3CFB /* WebEditCommandProxy.cpp */,
BCA0EF9D12332642007D3CFB /* WebEditCommandProxy.h */,
+ 1A3DD1FC125E59F3004515E6 /* WebFindClient.cpp */,
+ 1A3DD201125E5A1F004515E6 /* WebFindClient.h */,
BCE4694F1214E6CB000B98EB /* WebFormClient.cpp */,
BCE469501214E6CB000B98EB /* WebFormClient.h */,
BCE469511214E6CB000B98EB /* WebFormSubmissionListenerProxy.cpp */,
@@ -1950,6 +1959,8 @@
51A7F2F3125BF820008AEB1D /* Logging.h in Headers */,
BCBD3915125BB1A800D2C29F /* WebPageProxyMessages.h in Headers */,
BCBD3C3B125BFA7A00D2C29F /* StringPairVector.h in Headers */,
+ 1A3DD202125E5A1F004515E6 /* WebFindClient.h in Headers */,
+ 1A3DD206125E5A2F004515E6 /* APIClient.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2249,6 +2260,7 @@
BC306825125A6B9400E71278 /* WebProcessCreationParameters.cpp in Sources */,
51A7F2F5125BF8D4008AEB1D /* Logging.cpp in Sources */,
BCBD3914125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp in Sources */,
+ 1A3DD1FD125E59F3004515E6 /* WebFindClient.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 312a2fc..819146f 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -758,6 +758,24 @@ void WebPage::didRemoveEditCommand(uint64_t commandID)
removeWebEditCommand(commandID);
}
+void WebPage::findString(const String&, uint32_t findDirection, uint32_t findOption, uint32_t maxNumMatches)
+{
+ // FIXME: Implement.
+}
+
+void WebPage::hideFindUI()
+{
+ // FIXME: Implement.
+}
+
+void WebPage::countStringMatches(const String& string, bool caseInsensitive, uint32_t maxNumMatches)
+{
+ unsigned numMatches = m_page->markAllMatchesForText(string, caseInsensitive ? TextCaseInsensitive : TextCaseSensitive, false, maxNumMatches);
+ m_page->unmarkAllTextMatches();
+
+ WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCountStringMatches(string, numMatches), m_pageID);
+}
+
#if PLATFORM(MAC)
void WebPage::addPluginView(PluginView* pluginView)
{
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index ce9abed..fb5ea5d 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -213,6 +213,10 @@ private:
void reapplyEditCommand(uint64_t commandID);
void didRemoveEditCommand(uint64_t commandID);
+ void findString(const String&, uint32_t findDirection, uint32_t findOption, uint32_t maxNumMatches);
+ void hideFindUI();
+ void countStringMatches(const String&, bool caseInsensitive, uint32_t maxNumMatches);
+
OwnPtr<WebCore::Page> m_page;
RefPtr<WebFrame> m_mainFrame;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index cec9a04..2148f4e 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -68,6 +68,11 @@ messages -> WebPage {
SetPageZoomFactor(double zoomFactor)
SetTextZoomFactor(double zoomFactor)
+ # Find.
+ FindString(WTF::String string, uint32_t findDirection, uint32_t findOptions, unsigned maxNumMatches)
+ HideFindUI()
+ CountStringMatches(WTF::String string, bool caseInsensitive, unsigned maxNumMatches)
+
SetWindowResizerSize(WebCore::IntSize intersectsView)
#if PLATFORM(MAC)
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 342c0a8..63023b4 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -393,6 +393,10 @@
Name="Shared"
>
<File
+ RelativePath="..\Shared\APIClient.h"
+ >
+ </File>
+ <File
RelativePath="..\Shared\APIObject.h"
>
</File>
@@ -1436,6 +1440,14 @@
>
</File>
<File
+ RelativePath="..\UIProcess\WebFindClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\UIProcess\WebFindClient.h"
+ >
+ </File>
+ <File
RelativePath="..\UIProcess\WebFormClient.cpp"
>
</File>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d188204..6d7e2c6 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,24 @@
+2010-10-07 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Add a WKPageFindClient, hook up WKPageCountStringMatches
+ https://bugs.webkit.org/show_bug.cgi?id=47373
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ Remove hard coded paths.
+
+ * TestWebKitAPI/Tests/WTF/VectorBasic.cpp:
+ (TestWebKitAPI::TEST):
+ Fix expected result.
+
+ * TestWebKitAPI/Tests/WebKit2/Find.cpp: Added.
+ (TestWebKitAPI::didFinishLoadForFrame):
+ (TestWebKitAPI::didCountStringMatches):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/find.html: Added.
+ Add test for WKPageCountStringMatches.
+
2010-09-21 Martin Robinson <mrobinson at igalia.com>
Reviewed by Chris Fleizach.
diff --git a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index d6b9727..82547e8 100644
--- a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
+ 1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A02C84E125D4A8400E3F4BD /* Find.cpp */; };
+ 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
BC131A9B1171316900B69727 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131A9A1171316900B69727 /* main.mm */; };
BC131AA9117131FC00B69727 /* TestsController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC131AA8117131FC00B69727 /* TestsController.cpp */; };
@@ -41,6 +43,7 @@
dstSubfolderSpec = 7;
files = (
BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */,
+ 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */,
BC909784125571CF00083756 /* simple.html in Copy Resources */,
);
name = "Copy Resources";
@@ -49,6 +52,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
+ 1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
BC131883117114A800B69727 /* PlatformUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformUtilities.h; sourceTree = "<group>"; };
BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformUtilitiesMac.mm; sourceTree = "<group>"; };
@@ -61,7 +66,7 @@
BC90957F12554CF900083756 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
BC90958012554CF900083756 /* TestWebKitAPI.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = TestWebKitAPI.xcconfig; sourceTree = "<group>"; };
BC90964B125561BF00083756 /* VectorBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VectorBasic.cpp; path = WTF/VectorBasic.cpp; sourceTree = "<group>"; };
- BC90964D1255620C00083756 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = ../../WebKitBuild/Debug/JavaScriptCore.framework; sourceTree = SOURCE_ROOT; };
+ BC90964D1255620C00083756 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BC909778125571AB00083756 /* simple.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = simple.html; sourceTree = "<group>"; };
BC909779125571AB00083756 /* PageLoadBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageLoadBasic.cpp; sourceTree = "<group>"; };
BC90995D12567BC100083756 /* WKString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKString.cpp; sourceTree = "<group>"; };
@@ -147,6 +152,7 @@
isa = PBXGroup;
children = (
BC90977B125571AE00083756 /* Resources */,
+ 1A02C84E125D4A8400E3F4BD /* Find.cpp */,
BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */,
BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */,
BC909779125571AB00083756 /* PageLoadBasic.cpp */,
@@ -168,6 +174,7 @@
isa = PBXGroup;
children = (
BCBD372E125ABBE600D2C29F /* icon.png */,
+ 1A02C84B125D4A5E00E3F4BD /* find.html */,
BC909778125571AB00083756 /* simple.html */,
);
name = Resources;
@@ -253,6 +260,7 @@
BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */,
BCBD3710125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp in Sources */,
BCBD3761125ABCFE00D2C29F /* FrameMIMETypePNG.cpp in Sources */,
+ 1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -263,10 +271,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BC90958012554CF900083756 /* TestWebKitAPI.xcconfig */;
buildSettings = {
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SRCROOT)/../../WebKitBuild/Debug\"",
- );
+ FRAMEWORK_SEARCH_PATHS = "$(inherited)";
};
name = Debug;
};
@@ -274,10 +279,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BC90958012554CF900083756 /* TestWebKitAPI.xcconfig */;
buildSettings = {
- FRAMEWORK_SEARCH_PATHS = (
- "$(inherited)",
- "\"$(SRCROOT)/../../WebKitBuild/Debug\"",
- );
+ FRAMEWORK_SEARCH_PATHS = "$(inherited)";
};
name = Release;
};
diff --git a/WebKitTools/TestWebKitAPI/Tests/WTF/VectorBasic.cpp b/WebKitTools/TestWebKitAPI/Tests/WTF/VectorBasic.cpp
index aa4fa27..012fa27 100644
--- a/WebKitTools/TestWebKitAPI/Tests/WTF/VectorBasic.cpp
+++ b/WebKitTools/TestWebKitAPI/Tests/WTF/VectorBasic.cpp
@@ -34,7 +34,7 @@ TEST(WTF, VectorBasic)
Vector<int> intVector;
TEST_ASSERT(intVector.isEmpty());
TEST_ASSERT(intVector.size() == 0);
- TEST_ASSERT(intVector.capacity() == 1);
+ TEST_ASSERT(intVector.capacity() == 0);
}
} // namespace TestWebKitAPI
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/Find.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/Find.cpp
new file mode 100644
index 0000000..63bcea8
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/Find.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "Test.h"
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WebKit2.h>
+
+namespace TestWebKitAPI {
+
+static bool didFinishLoad = false;
+static bool didCallCountStringMatches = false;
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ didFinishLoad = true;
+}
+
+static void didCountStringMatches(WKPageRef page, WKStringRef string, unsigned numMatches, const void* clientInfo)
+{
+ TEST_ASSERT(WKStringIsEqualToUTF8CString(string, "Hello"));
+ TEST_ASSERT(numMatches == 3);
+
+ didCallCountStringMatches = true;
+}
+
+TEST(WebKit2, Find)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+ WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
+
+ PlatformWebView webView(pageNamespace.get());
+
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+
+ loaderClient.version = 0;
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+ WKPageSetPageLoaderClient(webView.page(), &loaderClient);
+
+ WKPageFindClient findClient;
+ memset(&findClient, 0, sizeof(findClient));
+
+ findClient.version = 0;
+ findClient.didCountStringMatches = didCountStringMatches;
+ WKPageSetPageFindClient(webView.page(), &findClient);
+
+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("find", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&didFinishLoad);
+
+ WKRetainPtr<WKStringRef> findString(AdoptWK, WKStringCreateWithUTF8CString("Hello"));
+ WKPageCountStringMatches(webView.page(), findString.get(), true, 100);
+
+ Util::run(&didCallCountStringMatches);
+}
+
+} // namespace TestWebKitAPI
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/find.html b/WebKitTools/TestWebKitAPI/Tests/WebKit2/find.html
new file mode 100644
index 0000000..d965911
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/find.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+ Test search. Hello Hello Hello!
+</body>
+</html>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list