Commit 8d7aa843 authored by paulmeyer's avatar paulmeyer Committed by Commit bot

Don't report single find match after all matches have already been reported.

There is a place in RenderFrameImpl::OnFind where after one find match is found, it reports that single match just to indicate that there is at least one match in the frame. This is useful when searching the frame for the first time, but pretty meaningless during a "find next" request since the whole frame will have already been searched and all of the matches reported beforehand. It's also detrimental since it will temporarily lower the global match count and then have to recalculate various things when it goes back up.

This patch prevents this single match reply during "find next" requests.

BUG=457440

Review-Url: https://codereview.chromium.org/2122263004
Cr-Commit-Position: refs/heads/master@{#406008}
parent d3fd3ee3
......@@ -5204,8 +5204,10 @@ void RenderFrameImpl::OnFind(int request_id,
// increment the current match ordinal; we need to re-generate it.
WebRange current_selection = frame_->selectionRange();
if (frame_->find(request_id, search_text, options,
false /* wrapWithinFrame */, &selection_rect, &active_now)) {
bool result = frame_->find(request_id, search_text, options,
false /* wrapWithinFrame */, &selection_rect,
&active_now);
if (result && !options.findNext) {
// Indicate that at least one match has been found. 1 here means possibly
// more matches could be coming. -1 here means that the exact active match
// ordinal is not yet known.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment