Changeset 69978 in webkit
- Timestamp:
- Oct 18, 2010 11:46:51 AM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r69973 r69978 1 2010-10-18 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Add matchCountDidChange callback 6 https://bugs.webkit.org/show_bug.cgi?id=47840 7 8 * UIProcess/API/C/WKPage.h: 9 Add matchCountDidChange WKPageFindClient callback. 10 11 * UIProcess/WebFindClient.cpp: 12 (WebKit::WebFindClient::matchCountDidChange): 13 Call the WKPageFindClient callback. 14 15 * UIProcess/WebPageProxy.messages.in: 16 Add MatchCountDidChange message. 17 18 * WebProcess/WebPage/FindController.cpp: 19 (WebKit::FindController::countStringMatches): 20 Move code here from WebPage. 21 22 (WebKit::FindController::findString): 23 Send the MatchCountDidChange message. 24 25 * WebProcess/WebPage/WebPage.cpp: 26 (WebKit::WebPage::countStringMatches): 27 Move this code over to FindController. 28 1 29 2010-10-18 Anders Carlsson <andersca@apple.com> 2 30 -
trunk/WebKit2/UIProcess/API/C/WKPage.cpp
r69559 r69978 194 194 } 195 195 196 void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned max NumMatches)197 { 198 toImpl(pageRef)->findString(toImpl(string)->string(), toFindDirection(findDirection), toFindOptions(findOptions), max NumMatches);196 void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxMatchCount) 197 { 198 toImpl(pageRef)->findString(toImpl(string)->string(), toFindDirection(findDirection), toFindOptions(findOptions), maxMatchCount); 199 199 } 200 200 … … 204 204 } 205 205 206 void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, bool caseInsensitive, unsigned max NumMatches)207 { 208 toImpl(pageRef)->countStringMatches(toImpl(string)->string(), caseInsensitive, max NumMatches);206 void WKPageCountStringMatches(WKPageRef pageRef, WKStringRef string, bool caseInsensitive, unsigned maxMatchCount) 207 { 208 toImpl(pageRef)->countStringMatches(toImpl(string)->string(), caseInsensitive, maxMatchCount); 209 209 } 210 210 -
trunk/WebKit2/UIProcess/API/C/WKPage.h
r69892 r69978 166 166 167 167 // Find client. 168 typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned numMatches, const void* clientInfo); 168 typedef void (*WKPageMatchCountDidChangeCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); 169 typedef void (*WKPageDidCountStringMatchesCallback)(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo); 169 170 170 171 struct WKPageFindClient { 171 172 int version; 172 173 const void * clientInfo; 174 WKPageMatchCountDidChangeCallback matchCountDidChange; 173 175 WKPageDidCountStringMatchesCallback didCountStringMatches; 174 176 }; … … 235 237 typedef uint32_t WKFindOptions; 236 238 237 WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned max NumMatches);239 WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxMatchCount); 238 240 WK_EXPORT void WKPageHideFindUI(WKPageRef page); 239 WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, bool caseInsensitive, unsigned max NumMatches);241 WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, bool caseInsensitive, unsigned maxMatchCount); 240 242 241 243 WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client); -
trunk/WebKit2/UIProcess/WebFindClient.cpp
r69343 r69978 30 30 namespace WebKit { 31 31 32 void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t numMatches) 32 void WebFindClient::matchCountDidChange(WebPageProxy* page, const String& string, uint32_t matchCount) 33 { 34 if (!m_client.matchCountDidChange) 35 return; 36 37 m_client.matchCountDidChange(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo); 38 } 39 40 void WebFindClient::didCountStringMatches(WebPageProxy* page, const String& string, uint32_t matchCount) 33 41 { 34 42 if (!m_client.didCountStringMatches) 35 43 return; 36 44 37 m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), numMatches, m_client.clientInfo);45 m_client.didCountStringMatches(toAPI(page), toAPI(string.impl()), matchCount, m_client.clientInfo); 38 46 } 39 47 -
trunk/WebKit2/UIProcess/WebFindClient.h
r69343 r69978 37 37 class WebFindClient : public APIClient<WKPageFindClient> { 38 38 public: 39 void didCountStringMatches(WebPageProxy*, const String&, uint32_t numMatches); 39 void matchCountDidChange(WebPageProxy*, const String&, uint32_t matchCount); 40 void didCountStringMatches(WebPageProxy*, const String&, uint32_t matchCount); 40 41 }; 41 42 -
trunk/WebKit2/UIProcess/WebPageProxy.cpp
r69899 r69978 506 506 } 507 507 508 void WebPageProxy::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned max NumMatches)509 { 510 process()->send(Messages::WebPage::FindString(string, findDirection, findOptions, max NumMatches), m_pageID);508 void WebPageProxy::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxMatchCount) 509 { 510 process()->send(Messages::WebPage::FindString(string, findDirection, findOptions, maxMatchCount), m_pageID); 511 511 } 512 512 … … 516 516 } 517 517 518 void WebPageProxy::countStringMatches(const String& string, bool caseInsensitive, unsigned max NumMatches)519 { 520 process()->send(Messages::WebPage::CountStringMatches(string, caseInsensitive, max NumMatches), m_pageID);518 void WebPageProxy::countStringMatches(const String& string, bool caseInsensitive, unsigned maxMatchCount) 519 { 520 process()->send(Messages::WebPage::CountStringMatches(string, caseInsensitive, maxMatchCount), m_pageID); 521 521 } 522 522 … … 962 962 } 963 963 964 void WebPageProxy::didCountStringMatches(const String& string, uint32_t numMatches)965 { 966 m_findClient.didCountStringMatches(this, string, numMatches);964 void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCount) 965 { 966 m_findClient.didCountStringMatches(this, string, matchCount); 967 967 } 968 968 … … 971 971 RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle); 972 972 m_pageClient->setFindIndicator(findIndicator.release(), fadeOut); 973 } 974 975 void WebPageProxy::matchCountDidChange(const String& string, uint32_t matchCount) 976 { 977 m_findClient.matchCountDidChange(this, string, matchCount); 973 978 } 974 979 -
trunk/WebKit2/UIProcess/WebPageProxy.h
r69899 r69978 180 180 181 181 // Find. 182 void findString(const String&, FindDirection, FindOptions, unsigned max NumMatches);182 void findString(const String&, FindDirection, FindOptions, unsigned maxMatchCount); 183 183 void hideFindUI(); 184 void countStringMatches(const String&, bool caseInsensitive, unsigned max NumMatches);184 void countStringMatches(const String&, bool caseInsensitive, unsigned maxMatchCount); 185 185 186 186 void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptReturnValueCallback>); … … 286 286 287 287 // Find. 288 void didCountStringMatches(const String&, uint32_t numMatches);288 void didCountStringMatches(const String&, uint32_t matchCount); 289 289 void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut); 290 void matchCountDidChange(const String&, uint32_t matchCount); 290 291 291 292 // Popup Menu. -
trunk/WebKit2/UIProcess/WebPageProxy.messages.in
r69899 r69978 93 93 94 94 # Find. 95 DidCountStringMatches(WTF::String string, uint32_t numMatches)95 DidCountStringMatches(WTF::String string, uint32_t matchCount) 96 96 SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle, bool fadeOut) 97 MatchCountDidChange(WTF::String string, uint32_t matchCount) 97 98 98 99 # PopupMenu. -
trunk/WebKit2/WebProcess/WebPage/FindController.cpp
r69877 r69978 47 47 } 48 48 49 void FindController::countStringMatches(const String& string, bool caseInsensitive, unsigned maxMatchCount) 50 { 51 unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, caseInsensitive ? TextCaseInsensitive : TextCaseSensitive, false, maxMatchCount); 52 m_webPage->corePage()->unmarkAllTextMatches(); 53 54 WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount), m_webPage->pageID()); 55 } 56 49 57 static Frame* frameWithSelection(Page* page) 50 58 { … … 57 65 } 58 66 59 void FindController::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned max NumMatches)67 void FindController::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxMatchCount) 60 68 { 61 69 m_webPage->corePage()->unmarkAllTextMatches(); … … 76 84 77 85 hideFindIndicator(); 86 87 WebProcess::shared().connection()->send(Messages::WebPageProxy::MatchCountDidChange(string, 0), m_webPage->pageID()); 88 78 89 } else { 79 90 shouldShowOverlay = findOptions & FindOptionsShowOverlay; 80 91 81 92 if (shouldShowOverlay) { 82 unsigned numMatches = m_webPage->corePage()->markAllMatchesForText(string, caseSensitivity, false, maxNumMatches);93 unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, caseSensitivity, false, maxMatchCount); 83 94 84 95 // Check if we have more matches than allowed. 85 if ( numMatches > maxNumMatches)96 if (matchCount > maxMatchCount) 86 97 shouldShowOverlay = false; 98 99 WebProcess::shared().connection()->send(Messages::WebPageProxy::MatchCountDidChange(string, matchCount), m_webPage->pageID()); 87 100 } 88 101 -
trunk/WebKit2/WebProcess/WebPage/FindController.h
r69877 r69978 46 46 explicit FindController(WebPage*); 47 47 48 void findString(const String&, FindDirection, FindOptions, unsigned max NumMatches);48 void findString(const String&, FindDirection, FindOptions, unsigned maxMatchCount); 49 49 void hideFindUI(); 50 50 void countStringMatches(const String&, bool caseInsensitive, unsigned maxMatchCount); 51 51 52 void findPageOverlayDestroyed(); 52 53 -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r69899 r69978 788 788 } 789 789 790 void WebPage::findString(const String& string, uint32_t findDirection, uint32_t findOptions, uint32_t max NumMatches)791 { 792 m_findController.findString(string, static_cast<FindDirection>(findDirection), static_cast<FindOptions>(findOptions), max NumMatches);790 void WebPage::findString(const String& string, uint32_t findDirection, uint32_t findOptions, uint32_t maxMatchCount) 791 { 792 m_findController.findString(string, static_cast<FindDirection>(findDirection), static_cast<FindOptions>(findOptions), maxMatchCount); 793 793 } 794 794 … … 798 798 } 799 799 800 void WebPage::countStringMatches(const String& string, bool caseInsensitive, uint32_t maxNumMatches) 801 { 802 unsigned numMatches = m_page->markAllMatchesForText(string, caseInsensitive ? TextCaseInsensitive : TextCaseSensitive, false, maxNumMatches); 803 m_page->unmarkAllTextMatches(); 804 805 WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCountStringMatches(string, numMatches), m_pageID); 800 void WebPage::countStringMatches(const String& string, bool caseInsensitive, uint32_t maxMatchCount) 801 { 802 m_findController.countStringMatches(string, caseInsensitive, maxMatchCount); 806 803 } 807 804 … … 814 811 m_activePopupMenu = 0; 815 812 } 816 817 813 818 814 #if PLATFORM(MAC) -
trunk/WebKit2/WebProcess/WebPage/WebPage.h
r69899 r69978 227 227 void didRemoveEditCommand(uint64_t commandID); 228 228 229 void findString(const String&, uint32_t findDirection, uint32_t findOptions, uint32_t max NumMatches);229 void findString(const String&, uint32_t findDirection, uint32_t findOptions, uint32_t maxMatchCount); 230 230 void hideFindUI(); 231 void countStringMatches(const String&, bool caseInsensitive, uint32_t max NumMatches);231 void countStringMatches(const String&, bool caseInsensitive, uint32_t maxMatchCount); 232 232 233 233 void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex); -
trunk/WebKit2/WebProcess/WebPage/WebPage.messages.in
r69899 r69978 70 70 71 71 # Find. 72 FindString(WTF::String string, uint32_t findDirection, uint32_t findOptions, unsigned max NumMatches)72 FindString(WTF::String string, uint32_t findDirection, uint32_t findOptions, unsigned maxMatchCount) 73 73 HideFindUI() 74 CountStringMatches(WTF::String string, bool caseInsensitive, unsigned max NumMatches)74 CountStringMatches(WTF::String string, bool caseInsensitive, unsigned maxMatchCount) 75 75 76 76 # Popup menu.
Note: See TracChangeset
for help on using the changeset viewer.