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

Side by Side Diff: content/browser/find_request_manager.cc

Issue 2802283002: Fix find-in-page "1 of 0" bug. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/find_request_manager.h" 5 #include "content/browser/find_request_manager.h"
6 6
7 #include "content/browser/frame_host/render_frame_host_impl.h" 7 #include "content/browser/frame_host/render_frame_host_impl.h"
8 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/common/frame_messages.h" 9 #include "content/common/frame_messages.h"
10 #include "content/common/input_messages.h" 10 #include "content/common/input_messages.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Check for an update to the number of matches. 151 // Check for an update to the number of matches.
152 if (number_of_matches != -1) { 152 if (number_of_matches != -1) {
153 DCHECK_GE(number_of_matches, 0); 153 DCHECK_GE(number_of_matches, 0);
154 auto matches_per_frame_it = matches_per_frame_.find(rfh); 154 auto matches_per_frame_it = matches_per_frame_.find(rfh);
155 if (int matches_delta = number_of_matches - matches_per_frame_it->second) { 155 if (int matches_delta = number_of_matches - matches_per_frame_it->second) {
156 // Increment the global number of matches by the number of additional 156 // Increment the global number of matches by the number of additional
157 // matches found for this frame. 157 // matches found for this frame.
158 number_of_matches_ += matches_delta; 158 number_of_matches_ += matches_delta;
159 matches_per_frame_it->second = number_of_matches; 159 matches_per_frame_it->second = number_of_matches;
160 160
161 // All matches may have been removed since the last find reply.
162 if (rfh == active_frame_ && !number_of_matches)
163 relative_active_match_ordinal_ = 0;
164
161 // The active match ordinal may need updating since the number of matches 165 // The active match ordinal may need updating since the number of matches
162 // before the active match may have changed. 166 // before the active match may have changed.
163 if (rfh != active_frame_) 167 if (rfh != active_frame_ || !number_of_matches)
164 UpdateActiveMatchOrdinal(); 168 UpdateActiveMatchOrdinal();
165 } 169 }
166 } 170 }
167 171
168 // Check for an update to the selection rect. 172 // Check for an update to the selection rect.
169 if (!selection_rect.IsEmpty()) 173 if (!selection_rect.IsEmpty())
170 selection_rect_ = selection_rect; 174 selection_rect_ = selection_rect;
171 175
172 // Check for an update to the active match ordinal. 176 // Check for an update to the active match ordinal.
173 if (active_match_ordinal > 0) { 177 if (active_match_ordinal > 0) {
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 aggregate_rects.end(), frame_rects.begin(), frame_rects.end()); 640 aggregate_rects.end(), frame_rects.begin(), frame_rects.end());
637 } 641 }
638 } 642 }
639 contents_->NotifyFindMatchRectsReply( 643 contents_->NotifyFindMatchRectsReply(
640 match_rects_.known_version, aggregate_rects, match_rects_.active_rect); 644 match_rects_.known_version, aggregate_rects, match_rects_.active_rect);
641 } 645 }
642 } 646 }
643 #endif 647 #endif
644 648
645 } // namespace content 649 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698