Title: [148762] trunk/Source/WebKit/blackberry
Revision
148762
Author
[email protected]
Date
2013-04-19 13:29:23 -0700 (Fri, 19 Apr 2013)

Log Message

[BlackBerry] Find-on-page should do the scoping again when highlight policy changed
https://bugs.webkit.org/show_bug.cgi?id=114885

Patch by Andy Chen <[email protected]> on 2013-04-19
Reviewed by Rob Buis.

PR 195773
Internally reviewed by Mike Fenton.
For find on page, we need to treat it as a new search if highlightAllMatches
changes but the text is not changed.

* WebKitSupport/InPageSearchManager.cpp:
(BlackBerry::WebKit::InPageSearchManager::findNextString):
(BlackBerry::WebKit::InPageSearchManager::findAndMarkText):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (148761 => 148762)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-04-19 20:26:08 UTC (rev 148761)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-04-19 20:29:23 UTC (rev 148762)
@@ -1,3 +1,19 @@
+2013-04-19  Andy Chen  <[email protected]>
+
+        [BlackBerry] Find-on-page should do the scoping again when highlight policy changed 
+        https://bugs.webkit.org/show_bug.cgi?id=114885
+
+        Reviewed by Rob Buis.
+
+        PR 195773
+        Internally reviewed by Mike Fenton.
+        For find on page, we need to treat it as a new search if highlightAllMatches
+        changes but the text is not changed.
+
+        * WebKitSupport/InPageSearchManager.cpp:
+        (BlackBerry::WebKit::InPageSearchManager::findNextString):
+        (BlackBerry::WebKit::InPageSearchManager::findAndMarkText):
+
 2013-04-19  Xuefei Ren  <[email protected]>
 
         fixed debug broken from previous patch 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp (148761 => 148762)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp	2013-04-19 20:26:08 UTC (rev 148761)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InPageSearchManager.cpp	2013-04-19 20:29:23 UTC (rev 148762)
@@ -86,6 +86,7 @@
 
 bool InPageSearchManager::findNextString(const String& text, FindOptions findOptions, bool wrap, bool highlightAllMatches)
 {
+    bool highlightAllMatchesStateChanged = m_highlightAllMatches != highlightAllMatches;
     m_highlightAllMatches = highlightAllMatches;
 
     if (!text.length()) {
@@ -108,7 +109,7 @@
 
     ExceptionCode ec = 0;
     RefPtr<Range> searchStartingPoint = m_activeMatch ? m_activeMatch->cloneRange(ec) : 0;
-    bool newSearch = m_activeSearchString != text;
+    bool newSearch = highlightAllMatchesStateChanged || (m_activeSearchString != text);
     bool forward = !(findOptions & WebCore::Backwards);
     if (newSearch) { // Start a new search.
         m_activeSearchString = text;
@@ -184,6 +185,13 @@
         setActiveMatchAndMarker(match);
         if (isNewSearch) {
             scopeStringMatches(text, true /* reset */, false /* locateActiveMatchOnly */);
+            if (!m_highlightAllMatches) {
+                // Not highlighting all matches, we need to add the marker here,
+                // because scopeStringMatches does not add any markers, it only counts the number.
+                // No need to unmarkAllTextMatches, it is already done from the caller because of newSearch
+                m_activeMatch->ownerDocument()->markers()->addTextMatchMarker(m_activeMatch.get(), true);
+                frame->editor()->setMarkedTextMatchesAreHighlighted(true /* highlight */);
+            }
             return true;
         }
         if (startFromSelection || m_locatingActiveMatch) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to