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

Unified Diff: Source/WebKit/chromium/src/WebFrameImpl.cpp

Issue 10541145: Merge 120219 - [Chromium] WebFrameImpl::find doesn't work for searching from a selection. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 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 | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/WebFrameImpl.cpp
===================================================================
--- Source/WebKit/chromium/src/WebFrameImpl.cpp (revision 120226)
+++ Source/WebKit/chromium/src/WebFrameImpl.cpp (working copy)
@@ -1566,12 +1566,14 @@
{
WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl();
- if (!options.findNext) {
+ if (!options.findNext)
frame()->page()->unmarkAllTextMatches();
- m_activeMatch = 0;
- } else
+ else
setMarkerActive(m_activeMatch.get(), false);
+ if (m_activeMatch && m_activeMatch->ownerDocument() != frame()->document())
+ m_activeMatch = 0;
+
// If the user has selected something since the last Find operation we want
// to start from there. Otherwise, we start searching from where the last Find
// operation left off (either a Find or a FindNext operation).
@@ -2185,6 +2187,14 @@
// a link focused, which is weird).
frame()->selection()->setSelection(m_activeMatch.get());
frame()->document()->setFocusedNode(0);
+
+ // Finally clear the active match, for two reasons:
+ // We just finished the find 'session' and we don't want future (potentially
+ // unrelated) find 'sessions' operations to start at the same place.
+ // The WebFrameImpl could get reused and the m_activeMatch could end up pointing
+ // to a document that is no longer valid. Keeping an invalid reference around
+ // is just asking for trouble.
+ m_activeMatch = 0;
}
}
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698