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

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

Issue 2236403004: Handling new frames and frame navigations with find-in-page during a find session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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: third_party/WebKit/Source/web/TextFinder.cpp
diff --git a/third_party/WebKit/Source/web/TextFinder.cpp b/third_party/WebKit/Source/web/TextFinder.cpp
index ceeadf3169d765159d7f38b9941c047527427e99..8d55b6a72a4eaa423ba1a06535d1765d273feaf2 100644
--- a/third_party/WebKit/Source/web/TextFinder.cpp
+++ b/third_party/WebKit/Source/web/TextFinder.cpp
@@ -200,6 +200,7 @@ bool TextFinder::find(int identifier, const WebString& searchText, const WebFind
reportFindInPageSelection(selectionRect, m_activeMatchIndex + 1, identifier);
}
+ m_lastFindRequestCompletedWithNoMatches = false;
dcheng 2016/09/21 07:15:44 Ditto: what is the significance behind these two c
paulmeyer 2016/09/21 15:40:52 First change: By this point in this function, at
return true;
}
@@ -207,6 +208,7 @@ void TextFinder::clearActiveFindMatch()
{
m_currentActiveMatchFrame = false;
setMarkerActive(m_activeMatch.get(), false);
+ resetActiveMatch();
}
void TextFinder::stopFindingAndClearSelection()
@@ -284,7 +286,7 @@ void TextFinder::scopeStringMatches(int identifier, const WebString& searchText,
return;
}
- if (!shouldScopeMatches(searchText)) {
+ if (!shouldScopeMatches(searchText, options)) {
finishCurrentScopingEffort(identifier);
return;
}
@@ -672,17 +674,23 @@ void TextFinder::unmarkAllTextMatches()
frame->document()->markers().removeMarkers(DocumentMarker::TextMatch);
}
-bool TextFinder::shouldScopeMatches(const String& searchText)
+bool TextFinder::shouldScopeMatches(const String& searchText, const WebFindOptions& options)
{
// Don't scope if we can't find a frame or a view.
// The user may have closed the tab/application, so abort.
LocalFrame* frame = ownerFrame().frame();
- if (!frame || !frame->view() || !frame->page() || !ownerFrame().hasVisibleContent())
+ if (!frame || !frame->view() || !frame->page())
return false;
DCHECK(frame->document());
DCHECK(frame->view());
+ if (options.force)
+ return true;
+
+ if (!ownerFrame().hasVisibleContent())
+ return false;
+
// If the frame completed the scoping operation and found 0 matches the last
// time it was searched, then we don't have to search it again if the user is
// just adding to the search string or sending the same search string again.

Powered by Google App Engine
This is Rietveld 408576698