[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:43:37 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2e2d29d7ec1bd279f7aa92fda6e0a2bba846585a
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 18 18:46:51 2010 +0000

    Add matchCountDidChange callback
    https://bugs.webkit.org/show_bug.cgi?id=47840
    
    Reviewed by Darin Adler.
    
    * UIProcess/API/C/WKPage.h:
    Add matchCountDidChange WKPageFindClient callback.
    
    * UIProcess/WebFindClient.cpp:
    (WebKit::WebFindClient::matchCountDidChange):
    Call the WKPageFindClient callback.
    
    * UIProcess/WebPageProxy.messages.in:
    Add MatchCountDidChange message.
    
    * WebProcess/WebPage/FindController.cpp:
    (WebKit::FindController::countStringMatches):
    Move code here from WebPage.
    
    (WebKit::FindController::findString):
    Send the MatchCountDidChange message.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::countStringMatches):
    Move this code over to FindController.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69978 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index b7a4829..a8470d1 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,34 @@
 
         Reviewed by Darin Adler.
 
+        Add matchCountDidChange callback
+        https://bugs.webkit.org/show_bug.cgi?id=47840
+
+        * UIProcess/API/C/WKPage.h:
+        Add matchCountDidChange WKPageFindClient callback.
+        
+        * UIProcess/WebFindClient.cpp:
+        (WebKit::WebFindClient::matchCountDidChange):
+        Call the WKPageFindClient callback.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Add MatchCountDidChange message.
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::countStringMatches):
+        Move code here from WebPage.
+
+        (WebKit::FindController::findString):
+        Send the MatchCountDidChange message.
+        
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::countStringMatches):
+        Move this code over to FindController.
+
+2010-10-18  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Darin Adler.
+
         Use nullptr instead of 0.
 
         * UIProcess/API/mac/FindIndicatorWindow.mm:
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index d0cc137..6e75a17 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -193,9 +193,9 @@ void WKPageSetPageAndTextZoomFactors(WKPageRef pageRef, double pageZoomFactor, d
     toImpl(pageRef)->setPageAndTextZoomFactors(pageZoomFactor, textZoomFactor);
 }
 
-void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxNumMatches)
+void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxMatchCount)
 {
-    toImpl(pageRef)->findString(toImpl(string)->string(), toFindDirection(findDirection), toFindOptions(findOptions), maxNumMatches);
+    toImpl(pageRef)->findString(toImpl(string)->string(), toFindDirection(findDirection), toFindOptions(findOptions), maxMatchCount);
 }
 
 void WKPageHideFindUI(WKPageRef pageRef)
@@ -203,9 +203,9 @@ void WKPageHideFindUI(WKPageRef pageRef)
     toImpl(pageRef)->hideFindUI();
 }
 
-void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, bool caseInsensitive, unsigned maxNumMatches)
+void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, bool caseInsensitive, unsigned maxMatchCount)
 {
-    toImpl(pageRef)->countStringMatches(toImpl(string)->string(), caseInsensitive, maxNumMatches);
+    toImpl(pageRef)->countStringMatches(toImpl(string)->string(), caseInsensitive, maxMatchCount);
 }
 
 void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClient* wkClient)
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 89b1cda..1452d06 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -165,11 +165,13 @@ struct WKPageUIClient {
 typedef struct WKPageUIClient WKPageUIClient;
 
 // Find client.
-typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned numMatches, const void* clientInfo);
+typedef void (*WKPageMatchCountDidChangeCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
+typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo);
 
 struct WKPageFindClient {
     int                                                                 version;
     const void *                                                        clientInfo;
+    WKPageMatchCountDidChangeCallback                                   matchCountDidChange;
     WKPageDidCountStringMatchesCallback                                 didCountStringMatches;
 };
 typedef struct WKPageFindClient WKPageFindClient;
@@ -234,9 +236,9 @@ enum {
 };
 typedef uint32_t WKFindOptions;
 
-WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxNumMatches);
+WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxMatchCount);
 WK_EXPORT void WKPageHideFindUI(WKPageRef page);
-WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, bool caseInsensitive, unsigned maxNumMatches);
+WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, bool caseInsensitive, unsigned maxMatchCount);
 
 WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client);
 WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client);
diff --git a/WebKit2/UIProcess/WebFindClient.cpp b/WebKit2/UIProcess/WebFindClient.cpp
index 4772121..80029e0 100644
--- a/WebKit2/UIProcess/WebFindClient.cpp
+++ b/WebKit2/UIProcess/WebFindClient.cpp
@@ -29,12 +29,20 @@
 
 namespace WebKit {
 
-void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t numMatches)
+void WebFindClient::matchCountDidChange(WebPageProxy* page, const String& string, uint32_t matchCount)
+{
+    if (!m_client.matchCountDidChange)
+        return;
+
+    m_client.matchCountDidChange(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo);
+}
+
+void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t matchCount)
 {
     if (!m_client.didCountStringMatches)
         return;
 
-    m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), numMatches, m_client.clientInfo);
+    m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebFindClient.h b/WebKit2/UIProcess/WebFindClient.h
index bebbbeb..3b7a561 100644
--- a/WebKit2/UIProcess/WebFindClient.h
+++ b/WebKit2/UIProcess/WebFindClient.h
@@ -36,7 +36,8 @@ class WebPageProxy;
 
 class WebFindClient : public APIClient<WKPageFindClient> {
 public:
-    void didCountStringMatches(WebPageProxy*, const String&, uint32_t numMatches);
+    void matchCountDidChange(WebPageProxy*, const String&, uint32_t matchCount);
+    void didCountStringMatches(WebPageProxy*, const String&, uint32_t matchCount);
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 1b5b861..3e9d1a7 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -505,9 +505,9 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
     process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); 
 }
 
-void WebPageProxy::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxNumMatches)
+void WebPageProxy::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxMatchCount)
 {
-    process()->send(Messages::WebPage::FindString(string, findDirection, findOptions, maxNumMatches), m_pageID);
+    process()->send(Messages::WebPage::FindString(string, findDirection, findOptions, maxMatchCount), m_pageID);
 }
 
 void WebPageProxy::hideFindUI()
@@ -515,9 +515,9 @@ void WebPageProxy::hideFindUI()
     process()->send(Messages::WebPage::HideFindUI(), m_pageID);
 }
 
-void WebPageProxy::countStringMatches(const String& string, bool caseInsensitive, unsigned maxNumMatches)
+void WebPageProxy::countStringMatches(const String& string, bool caseInsensitive, unsigned maxMatchCount)
 {
-    process()->send(Messages::WebPage::CountStringMatches(string, caseInsensitive, maxNumMatches), m_pageID);
+    process()->send(Messages::WebPage::CountStringMatches(string, caseInsensitive, maxMatchCount), m_pageID);
 }
     
 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptReturnValueCallback> prpCallback)
@@ -961,9 +961,9 @@ void WebPageProxy::clearAllEditCommands()
     m_pageClient->clearAllEditCommands();
 }
 
-void WebPageProxy::didCountStringMatches(const String& string, uint32_t numMatches)
+void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount)
 {
-    m_findClient.didCountStringMatches(this, string, numMatches);
+    m_findClient.didCountStringMatches(this, string, matchCount);
 }
 
 void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
@@ -972,6 +972,11 @@ void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector
     m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
 }
 
+void WebPageProxy::matchCountDidChange(const String& string, uint32_t matchCount)
+{
+    m_findClient.matchCountDidChange(this, string, matchCount);
+}
+
 void WebPageProxy::showPopupMenu(const IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex)
 {
     if (m_activePopupMenu)
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index dc413c1..c0c5cf0 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -179,9 +179,9 @@ public:
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
 
     // Find.
-    void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches);
+    void findString(const String&, FindDirection, FindOptions, unsigned maxMatchCount);
     void hideFindUI();
-    void countStringMatches(const String&, bool caseInsensitive, unsigned maxNumMatches);
+    void countStringMatches(const String&, bool caseInsensitive, unsigned maxMatchCount);
 
     void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptReturnValueCallback>);
     void getRenderTreeExternalRepresentation(PassRefPtr<RenderTreeExternalRepresentationCallback>);
@@ -285,8 +285,9 @@ private:
     void clearAllEditCommands();
 
     // Find.
-    void didCountStringMatches(const String&, uint32_t numMatches);
+    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);
 
     // Popup Menu.
     void showPopupMenu(const WebCore::IntRect& rect, const Vector<WebPopupItem>& items, int32_t selectedIndex);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index bed1e5e..e300acb 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -92,8 +92,9 @@ messages -> WebPageProxy {
     ClearAllEditCommands()
 
     # Find.
-    DidCountStringMatches(WTF::String string, uint32_t numMatches)
+    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)
 
     # PopupMenu.
     ShowPopupMenu(WebCore::IntRect rect, Vector<WebKit::WebPopupItem> items, int32_t selectedIndex)
diff --git a/WebKit2/WebProcess/WebPage/FindController.cpp b/WebKit2/WebProcess/WebPage/FindController.cpp
index e36a447..da84703 100644
--- a/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -46,6 +46,14 @@ FindController::FindController(WebPage* webPage)
 {
 }
 
+void FindController::countStringMatches(const String& string, bool caseInsensitive, unsigned maxMatchCount)
+{
+    unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, caseInsensitive ? TextCaseInsensitive : TextCaseSensitive, false, maxMatchCount);
+    m_webPage->corePage()->unmarkAllTextMatches();
+
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount), m_webPage->pageID());
+}
+
 static Frame* frameWithSelection(Page* page)
 {
     for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
@@ -56,7 +64,7 @@ static Frame* frameWithSelection(Page* page)
     return 0;
 }
 
-void FindController::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxNumMatches)
+void FindController::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxMatchCount)
 {
     m_webPage->corePage()->unmarkAllTextMatches();
 
@@ -75,15 +83,20 @@ void FindController::findString(const String& string, FindDirection findDirectio
             selectedFrame->selection()->clear();
 
         hideFindIndicator();
+
+        WebProcess::shared().connection()->send(Messages::WebPageProxy::MatchCountDidChange(string, 0), m_webPage->pageID());
+
     } else {
         shouldShowOverlay = findOptions & FindOptionsShowOverlay;
 
         if (shouldShowOverlay) {
-            unsigned numMatches = m_webPage->corePage()->markAllMatchesForText(string, caseSensitivity, false, maxNumMatches);
+            unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, caseSensitivity, false, maxMatchCount);
 
             // Check if we have more matches than allowed.
-            if (numMatches > maxNumMatches)
+            if (matchCount > maxMatchCount)
                 shouldShowOverlay = false;
+
+            WebProcess::shared().connection()->send(Messages::WebPageProxy::MatchCountDidChange(string, matchCount), m_webPage->pageID());
         }
 
         if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) {
diff --git a/WebKit2/WebProcess/WebPage/FindController.h b/WebKit2/WebProcess/WebPage/FindController.h
index 3aa8b10..7a54d34 100644
--- a/WebKit2/WebProcess/WebPage/FindController.h
+++ b/WebKit2/WebProcess/WebPage/FindController.h
@@ -45,9 +45,10 @@ class FindController {
 public:
     explicit FindController(WebPage*);
 
-    void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches);
+    void findString(const String&, FindDirection, FindOptions, unsigned maxMatchCount);
     void hideFindUI();
-
+    void countStringMatches(const String&, bool caseInsensitive, unsigned maxMatchCount);
+    
     void findPageOverlayDestroyed();
 
     void hideFindIndicator();
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 505c71b..082415c 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -787,9 +787,9 @@ void WebPage::setActivePopupMenu(WebPopupMenu* menu)
     m_activePopupMenu = menu;
 }
 
-void WebPage::findString(const String& string, uint32_t findDirection, uint32_t findOptions, uint32_t maxNumMatches)
+void WebPage::findString(const String& string, uint32_t findDirection, uint32_t findOptions, uint32_t maxMatchCount)
 {
-    m_findController.findString(string, static_cast<FindDirection>(findDirection), static_cast<FindOptions>(findOptions), maxNumMatches);
+    m_findController.findString(string, static_cast<FindDirection>(findDirection), static_cast<FindOptions>(findOptions), maxMatchCount);
 }
 
 void WebPage::hideFindUI()
@@ -797,12 +797,9 @@ void WebPage::hideFindUI()
     m_findController.hideFindUI();
 }
 
-void WebPage::countStringMatches(const String& string, bool caseInsensitive, uint32_t maxNumMatches)
+void WebPage::countStringMatches(const String& string, bool caseInsensitive, uint32_t maxMatchCount)
 {
-    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);
+    m_findController.countStringMatches(string, caseInsensitive, maxMatchCount);
 }
 
 void WebPage::didChangeSelectedIndexForActivePopupMenu(int32_t newIndex)
@@ -814,7 +811,6 @@ void WebPage::didChangeSelectedIndexForActivePopupMenu(int32_t newIndex)
     m_activePopupMenu = 0;
 }
 
-
 #if PLATFORM(MAC)
 void WebPage::addPluginView(PluginView* pluginView)
 {
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 607a17a..1b79c4c 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -226,9 +226,9 @@ private:
     void reapplyEditCommand(uint64_t commandID);
     void didRemoveEditCommand(uint64_t commandID);
 
-    void findString(const String&, uint32_t findDirection, uint32_t findOptions, uint32_t maxNumMatches);
+    void findString(const String&, uint32_t findDirection, uint32_t findOptions, uint32_t maxMatchCount);
     void hideFindUI();
-    void countStringMatches(const String&, bool caseInsensitive, uint32_t maxNumMatches);
+    void countStringMatches(const String&, bool caseInsensitive, uint32_t maxMatchCount);
 
     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index f144cff..411d7e3 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -69,9 +69,9 @@ messages -> WebPage {
     SetTextZoomFactor(double zoomFactor)
 
     # Find.
-    FindString(WTF::String string, uint32_t findDirection, uint32_t findOptions, unsigned maxNumMatches)
+    FindString(WTF::String string, uint32_t findDirection, uint32_t findOptions, unsigned maxMatchCount)
     HideFindUI()
-    CountStringMatches(WTF::String string, bool caseInsensitive, unsigned maxNumMatches)
+    CountStringMatches(WTF::String string, bool caseInsensitive, unsigned maxMatchCount)
 
     # Popup menu.
     DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list