Index: chrome/renderer/render_view.cc |
=================================================================== |
--- chrome/renderer/render_view.cc (revision 31004) |
+++ chrome/renderer/render_view.cc (working copy) |
@@ -74,6 +74,7 @@ |
#include "webkit/api/public/WebHistoryItem.h" |
#include "webkit/api/public/WebNode.h" |
#include "webkit/api/public/WebPoint.h" |
+#include "webkit/api/public/WebRange.h" |
#include "webkit/api/public/WebRect.h" |
#include "webkit/api/public/WebScriptSource.h" |
#include "webkit/api/public/WebSearchableFormData.h" |
@@ -2780,6 +2781,10 @@ |
WebRect selection_rect; |
bool result = false; |
+ // If something is selected when we start searching it means we cannot just |
+ // increment the current match ordinal; we need to re-generate it. |
+ WebRange current_selection = focused_frame->selectionRange(); |
+ |
do { |
result = search_frame->find( |
request_id, search_text, options, wrap_within_frame, &selection_rect); |
@@ -2816,7 +2821,7 @@ |
webview()->setFocusedFrame(search_frame); |
} while (!result && search_frame != focused_frame); |
- if (options.findNext) { |
+ if (options.findNext && current_selection.isNull()) { |
// Force the main_frame to report the actual count. |
main_frame->increaseMatchCount(0, request_id); |
} else { |