OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5219 } | 5219 } |
5220 | 5220 |
5221 // Send "no results" if this frame has no visible content. | 5221 // Send "no results" if this frame has no visible content. |
5222 if (!frame_->hasVisibleContent()) { | 5222 if (!frame_->hasVisibleContent()) { |
5223 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, | 5223 SendFindReply(request_id, 0 /* match_count */, 0 /* ordinal */, |
5224 gfx::Rect(), true /* final_status_update */ ); | 5224 gfx::Rect(), true /* final_status_update */ ); |
5225 return; | 5225 return; |
5226 } | 5226 } |
5227 | 5227 |
5228 WebRect selection_rect; | 5228 WebRect selection_rect; |
5229 bool active_now = false; | |
5230 | 5229 |
5231 // If something is selected when we start searching it means we cannot just | 5230 // If something is selected when we start searching it means we cannot just |
5232 // increment the current match ordinal; we need to re-generate it. | 5231 // increment the current match ordinal; we need to re-generate it. |
5233 WebRange current_selection = frame_->selectionRange(); | 5232 WebRange current_selection = frame_->selectionRange(); |
5234 | 5233 |
5235 bool result = frame_->find(request_id, search_text, options, | 5234 bool result = frame_->find(request_id, search_text, options, |
5236 false /* wrapWithinFrame */, &selection_rect, | 5235 false /* wrapWithinFrame */, &selection_rect); |
5237 &active_now); | |
5238 if (result && !options.findNext) { | 5236 if (result && !options.findNext) { |
5239 // Indicate that at least one match has been found. 1 here means possibly | 5237 // Indicate that at least one match has been found. 1 here means possibly |
5240 // more matches could be coming. -1 here means that the exact active match | 5238 // more matches could be coming. -1 here means that the exact active match |
5241 // ordinal is not yet known. | 5239 // ordinal is not yet known. |
5242 SendFindReply(request_id, 1 /* match_count */, -1 /* ordinal */, | 5240 SendFindReply(request_id, 1 /* match_count */, -1 /* ordinal */, |
5243 gfx::Rect(), false /* final_status_update */ ); | 5241 gfx::Rect(), false /* final_status_update */ ); |
5244 } | 5242 } |
5245 | 5243 |
5246 if (options.findNext && current_selection.isNull() && active_now) { | 5244 if (options.findNext && current_selection.isNull() && |
5245 !frame_->scopingInProgress()) { | |
dcheng
2016/07/28 02:11:45
Is this an urgent fix? I think we should explore m
| |
5247 // Force report of the actual count. | 5246 // Force report of the actual count. |
5248 frame_->increaseMatchCount(0, request_id); | 5247 frame_->increaseMatchCount(0, request_id); |
5249 return; | 5248 return; |
5250 } | 5249 } |
5251 | 5250 |
5252 // Scoping effort begins. | 5251 // Scoping effort begins. |
5253 frame_->resetMatchCount(); | 5252 frame_->resetMatchCount(); |
5254 | 5253 |
5255 // Cancel all old scoping requests before starting a new one. | 5254 // Cancel all old scoping requests before starting a new one. |
5256 frame_->cancelPendingScopingEffort(); | 5255 frame_->cancelPendingScopingEffort(); |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6366 // event target. Potentially a Pepper plugin will receive the event. | 6365 // event target. Potentially a Pepper plugin will receive the event. |
6367 // In order to tell whether a plugin gets the last mouse event and which it | 6366 // In order to tell whether a plugin gets the last mouse event and which it |
6368 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6367 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6369 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6368 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6370 // |pepper_last_mouse_event_target_|. | 6369 // |pepper_last_mouse_event_target_|. |
6371 pepper_last_mouse_event_target_ = nullptr; | 6370 pepper_last_mouse_event_target_ = nullptr; |
6372 #endif | 6371 #endif |
6373 } | 6372 } |
6374 | 6373 |
6375 } // namespace content | 6374 } // namespace content |
OLD | NEW |