Changeset 122428 in webkit
- Timestamp:
- Jul 12, 2012 1:38:16 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r122426 r122428 1 2012-07-12 Sergio Villar Senin <svillar@igalia.com> 2 3 [WK2] Performance issue in FindController::findString 4 https://bugs.webkit.org/show_bug.cgi?id=78132 5 6 Reviewed by Anders Carlsson. 7 8 FindController should not unmark all text matches by default. It 9 will be done only if the string is not found or if 10 markAllTextMatches() is called. This will allow clients to look 11 for the next/previous without having to unmark() + mark() all the 12 text matches for every single search operation. 13 14 * UIProcess/API/gtk/WebKitFindController.cpp: 15 (webKitFindControllerPerform): 16 (webkit_find_controller_search_next): 17 (webkit_find_controller_search_previous): 18 * WebProcess/WebPage/FindController.cpp: 19 (WebKit::FindController::updateFindUIAfterPageScroll): 20 (WebKit::FindController::findString): 21 1 22 2012-07-12 Christophe Dumez <christophe.dumez@intel.com> 2 23 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp
r109881 r122428 49 49 typedef enum { 50 50 FindOperation, 51 FindNextPrevOperation, 51 52 CountOperation 52 53 } WebKitFindControllerOperation; … … 346 347 WKPageRef wkPage = getWKPageFromWebKitWebView(findController->priv->webView); 347 348 348 if (operation == FindOperation) { 349 // Unconditionally highlight text matches. WK1 API was forcing 350 // clients to enable/disable highlighting. Since most of them 351 // (all?) where using highlighting we decided to simplify the 352 // WK2 API and unconditionally show highlights. 353 wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight); 354 WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); 349 if (operation == CountOperation) { 350 WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); 355 351 return; 356 352 } 357 353 358 WKPageCountStringMatches(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); 354 if (operation == FindOperation) 355 // Unconditionally highlight text matches when the search 356 // starts. WK1 API was forcing clients to enable/disable 357 // highlighting. Since most of them (all?) where using that 358 // feature we decided to simplify the WK2 API and 359 // unconditionally show highlights. Both search_next() and 360 // search_prev() should not enable highlighting to avoid an 361 // extra unmarkAllTextMatches() + markAllTextMatches() 362 wkFindOptions = static_cast<WKFindOptions>(findController->priv->findOptions | kWKFindOptionsShowHighlight); 363 364 WKPageFindString(wkPage, wkSearchText.get(), wkFindOptions, findController->priv->maxMatchCount); 359 365 } 360 366 … … 416 422 417 423 findController->priv->findOptions = findController->priv->findOptions & ~WEBKIT_FIND_OPTIONS_BACKWARDS; 418 webKitFindControllerPerform(findController, FindOperation); 424 findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight; 425 webKitFindControllerPerform(findController, FindNextPrevOperation); 419 426 } 420 427 … … 433 440 434 441 findController->priv->findOptions = findController->priv->findOptions | WEBKIT_FIND_OPTIONS_BACKWARDS; 435 webKitFindControllerPerform(findController, FindOperation); 442 findController->priv->findOptions = findController->priv->findOptions & ~kWKFindOptionsShowHighlight; 443 webKitFindControllerPerform(findController, FindNextPrevOperation); 436 444 } 437 445 -
trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp
r121015 r122428 98 98 99 99 if (!found) { 100 m_webPage->corePage()->unmarkAllTextMatches(); 101 100 102 // Clear the selection. 101 103 if (selectedFrame) … … 115 117 --maxMatchCount; 116 118 119 m_webPage->corePage()->unmarkAllTextMatches(); 117 120 matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1); 118 121 … … 153 156 void FindController::findString(const String& string, FindOptions options, unsigned maxMatchCount) 154 157 { 155 m_webPage->corePage()->unmarkAllTextMatches();156 157 158 bool found = m_webPage->corePage()->findString(string, core(options)); 158 159
Note: See TracChangeset
for help on using the changeset viewer.