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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2186113002: Fix find-in-page re-scope across frame boundaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix in test. Created 4 years, 4 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
« no previous file with comments | « content/test/data/find_in_long_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index b734fefd921d62a5cd3167a490ce17df12c925bb..e3f9d62db4c31023bc712dd2920c442af9077951 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -1989,7 +1989,6 @@ void WebLocalFrameImpl::requestFind(int identifier, const WebString& searchText,
}
WebRange currentSelection = selectionRange();
-
bool result = false;
bool activeNow = false;
@@ -2007,19 +2006,25 @@ void WebLocalFrameImpl::requestFind(int identifier, const WebString& searchText,
// There are three cases in which scoping is needed:
//
- // 1) This is an initial find request (|options.findNext| is false). This
+ // (1) This is an initial find request (|options.findNext| is false). This
// will be the first scoping effort for this find session.
//
- // 2) Something has been selected since the last search. This means that we
+ // (2) Something has been selected since the last search. This means that we
// cannot just increment the current match ordinal; we need to re-generate
// it.
//
- // 3) TextFinder::Find() could not locate the next active find match, so it
- // needs to be re-scoped.
+ // (3) TextFinder::Find() found what should be the next match (|result| is
+ // true), but was unable to activate it (|activeNow| is false). This means
+ // that the text containing this match was dynamically added since the last
+ // scope of the frame. The frame needs to be re-scoped so that any matches
+ // in the new text can be highlighted and included in the reported number of
+ // matches.
//
// If none of these cases are true, then we just report the current match
// count without scoping.
- if (options.findNext && currentSelection.isNull() && activeNow) {
+ if (/* (1) */ options.findNext
+ && /* (2) */ currentSelection.isNull()
+ && /* (3) */ !(result && !activeNow)) {
// Force report of the actual count.
increaseMatchCount(0, identifier);
return;
« no previous file with comments | « content/test/data/find_in_long_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698