Title: [120219] trunk/Source/WebKit/chromium
Revision
120219
Author
[email protected]
Date
2012-06-13 09:41:08 -0700 (Wed, 13 Jun 2012)

Log Message

[Chromium] WebFrameImpl::find doesn't work for searching from a selection.
https://bugs.webkit.org/show_bug.cgi?id=88885

Patch by Martin Kosiba <[email protected]> on 2012-06-13
Reviewed by Adam Barth.

Remember the active match not just until the seatchText changes but for the entire find session.

* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::find):
(WebKit::WebFrameImpl::setFindEndstateFocusAndSelection):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (120218 => 120219)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-13 16:38:42 UTC (rev 120218)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-13 16:41:08 UTC (rev 120219)
@@ -1,3 +1,16 @@
+2012-06-13  Martin Kosiba  <[email protected]>
+
+        [Chromium] WebFrameImpl::find doesn't work for searching from a selection.
+        https://bugs.webkit.org/show_bug.cgi?id=88885
+
+        Reviewed by Adam Barth.
+
+        Remember the active match not just until the seatchText changes but for the entire find session.
+
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::find):
+        (WebKit::WebFrameImpl::setFindEndstateFocusAndSelection):
+
 2012-06-13  Peter Beverloo  <[email protected]>
 
         [Chromium] Fix Clang build with USE(NATIVE_FULLSCREEN_VIDEO)=1

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (120218 => 120219)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-06-13 16:38:42 UTC (rev 120218)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-06-13 16:41:08 UTC (rev 120219)
@@ -1572,12 +1572,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).
@@ -2220,6 +2222,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;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to