Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: content/renderer/render_view_impl.cc

Issue 1605863002: Restart search in page when new text is found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, clean-up Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 361940ed9257a00ccd7c6d498a7cb74738175deb..43f0c14c2c0665a8bfc664a58dee2f109dfa33a7 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2359,14 +2359,16 @@ void RenderViewImpl::OnFind(int request_id,
WebRect selection_rect;
bool result = false;
+ bool new_text_found;
// 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);
+ result =
+ search_frame->find(request_id, search_text, options, wrap_within_frame,
+ &selection_rect, new_text_found);
if (!result) {
// don't leave text selected as you move to the next frame.
@@ -2393,16 +2395,16 @@ void RenderViewImpl::OnFind(int request_id,
// reported matches, but no frames after the focused_frame contain a
// match for the search word(s).
if (multi_frame && search_frame == focused_frame) {
- result = search_frame->find(
- request_id, search_text, options, true, // Force wrapping.
- &selection_rect);
+ result = search_frame->find(request_id, search_text, options,
+ true, // Force wrapping.
+ &selection_rect, new_text_found);
}
}
webview()->setFocusedFrame(search_frame);
} while (!result && search_frame != focused_frame);
- if (options.findNext && current_selection.isNull()) {
+ if (options.findNext && current_selection.isNull() && !new_text_found) {
// Force the main_frame to report the actual count.
main_frame->increaseMatchCount(0, request_id);
} else {

Powered by Google App Engine
This is Rietveld 408576698