Skip to content
Permalink
Browse files
Replace matchCountDidChange with didFindString/didFailToFindString
https://bugs.webkit.org/show_bug.cgi?id=48262
<rdar://problem/8568928>

Reviewed by Darin Adler.

* UIProcess/API/C/WKPage.h:
* UIProcess/WebFindClient.cpp:
(WebKit::WebFindClient::didFindString):
(WebKit::WebFindClient::didFailToFindString):
* UIProcess/WebFindClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFindString):
(WebKit::WebPageProxy::didFailToFindString):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::findString):

Canonical link: https://commits.webkit.org/61025@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Oct 25, 2010
1 parent ffd293b commit 709885fcddad4a7c9c41d56617e34d1d2274313e
Showing 8 changed files with 52 additions and 12 deletions.
@@ -1,3 +1,24 @@
2010-10-25 Anders Carlsson <andersca@apple.com>

Reviewed by Darin Adler.

Replace matchCountDidChange with didFindString/didFailToFindString
https://bugs.webkit.org/show_bug.cgi?id=48262
<rdar://problem/8568928>

* UIProcess/API/C/WKPage.h:
* UIProcess/WebFindClient.cpp:
(WebKit::WebFindClient::didFindString):
(WebKit::WebFindClient::didFailToFindString):
* UIProcess/WebFindClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFindString):
(WebKit::WebPageProxy::didFailToFindString):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::findString):

2010-10-25 Anders Carlsson <andersca@apple.com>

Reviewed by Adam Roben.
@@ -165,13 +165,15 @@ struct WKPageUIClient {
typedef struct WKPageUIClient WKPageUIClient;

// Find client.
typedef void (*WKPageMatchCountDidChangeCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
typedef void (*WKPageDidFindStringCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
typedef void (*WKPageDidFailToFindStringCallback)(WKPageRef page, WKStringRef string, const void* clientInfo);
typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);

struct WKPageFindClient {
int version;
const void * clientInfo;
WKPageMatchCountDidChangeCallback matchCountDidChange;
WKPageDidFindStringCallback didFindString;
WKPageDidFailToFindStringCallback didFailToFindString;
WKPageDidCountStringMatchesCallback didCountStringMatches;
};
typedef struct WKPageFindClient WKPageFindClient;
@@ -29,12 +29,21 @@

namespace WebKit {

void WebFindClient::matchCountDidChange(WebPageProxy* page, const String& string, uint32_t matchCount)
void WebFindClient::didFindString(WebPageProxy* page, const String& string, uint32_t matchCount)
{
if (!m_client.matchCountDidChange)
if (!m_client.didFindString)
return;

m_client.matchCountDidChange(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo);
m_client.didFindString(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo);

}

void WebFindClient::didFailToFindString(WebPageProxy* page, const String& string)
{
if (!m_client.didFailToFindString)
return;

m_client.didFailToFindString(toAPI(page), toAPI(string.impl()), m_client.clientInfo);
}

void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t matchCount)
@@ -36,7 +36,8 @@ class WebPageProxy;

class WebFindClient : public APIClient<WKPageFindClient> {
public:
void matchCountDidChange(WebPageProxy*, const String&, uint32_t matchCount);
void didFindString(WebPageProxy*, const String&, uint32_t matchCount);
void didFailToFindString(WebPageProxy*, const String&);
void didCountStringMatches(WebPageProxy*, const String&, uint32_t matchCount);
};

@@ -988,9 +988,14 @@ void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector
m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
}

void WebPageProxy::matchCountDidChange(const String& string, uint32_t matchCount)
void WebPageProxy::didFindString(const String& string, uint32_t matchCount)
{
m_findClient.matchCountDidChange(this, string, matchCount);
m_findClient.didFindString(this, string, matchCount);
}

void WebPageProxy::didFailToFindString(const String& string)
{
m_findClient.didFailToFindString(this, string);
}

void WebPageProxy::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex)
@@ -288,7 +288,8 @@ class WebPageProxy : public APIObject {
// Find.
void didCountStringMatches(const String&, uint32_t matchCount);
void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
void matchCountDidChange(const String&, uint32_t matchCount);
void didFindString(const String&, uint32_t matchCount);
void didFailToFindString(const String&);

// Popup Menu.
void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex);
@@ -94,7 +94,8 @@ messages -> WebPageProxy {
# Find.
DidCountStringMatches(WTF::String string, uint32_t matchCount)
SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle, bool fadeOut)
MatchCountDidChange(WTF::String string, uint32_t matchCount)
DidFindString(WTF::String string, uint32_t matchCount)
DidFailToFindString(WTF::String string)

# PopupMenu.
ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex)
@@ -84,7 +84,7 @@ void FindController::findString(const String& string, FindDirection findDirectio

hideFindIndicator();

WebProcess::shared().connection()->send(Messages::WebPageProxy::MatchCountDidChange(string, 0), m_webPage->pageID());
WebProcess::shared().connection()->send(Messages::WebPageProxy::DidFailToFindString(string), m_webPage->pageID());
} else {
shouldShowOverlay = findOptions & FindOptionsShowOverlay;

@@ -95,7 +95,7 @@ void FindController::findString(const String& string, FindDirection findDirectio
if (matchCount > maxMatchCount)
shouldShowOverlay = false;

WebProcess::shared().connection()->send(Messages::WebPageProxy::MatchCountDidChange(string, matchCount), m_webPage->pageID());
WebProcess::shared().connection()->send(Messages::WebPageProxy::DidFindString(string, matchCount), m_webPage->pageID());
}

if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) {

0 comments on commit 709885f

Please sign in to comment.