Title: [88300] branches/safari-534-branch/Source/WebKit2
Revision
88300
Author
lforsch...@apple.com
Date
2011-06-07 17:48:44 -0700 (Tue, 07 Jun 2011)

Log Message

Merge r88204.

Modified Paths

Diff

Modified: branches/safari-534-branch/Source/WebKit2/ChangeLog (88299 => 88300)


--- branches/safari-534-branch/Source/WebKit2/ChangeLog	2011-06-08 00:46:58 UTC (rev 88299)
+++ branches/safari-534-branch/Source/WebKit2/ChangeLog	2011-06-08 00:48:44 UTC (rev 88300)
@@ -1,5 +1,23 @@
 2011-06-07  Lucas Forschler  <lforsch...@apple.com>
 
+    Merged 88204.
+
+    2011-06-06  John Sullivan  <sulli...@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <https://bugs.webkit.org/show_bug.cgi?id=62165>
+        <rdar://problem/9555835>
+        WebKit2 find-on-page callback doesn’t handle kWKMoreThanMaximumMatchCount on PDF pages
+
+        * UIProcess/API/mac/PDFViewController.mm:
+        (WebKit::PDFViewController::findString):
+        Return kWKMoreThanMaximumMatchCount when appropriate, a la FindController::countStringMatches().
+        Also, skip counting all the matches if maxMatchCount is 0, to avoid (perhaps slowly) computing a
+        number that would be ignored.
+
+2011-06-07  Lucas Forschler  <lforsch...@apple.com>
+
     Merged 88127.
 
     2011-06-04  Sam Weinig  <s...@webkit.org>

Modified: branches/safari-534-branch/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm (88299 => 88300)


--- branches/safari-534-branch/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm	2011-06-08 00:46:58 UTC (rev 88299)
+++ branches/safari-534-branch/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm	2011-06-08 00:48:44 UTC (rev 88300)
@@ -609,15 +609,21 @@
     BOOL wrapFlag = options & FindOptionsWrapAround;
 
     PDFSelection *selection = [m_wkPDFView.get() _nextMatchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag fromSelection:[m_pdfView currentSelection] startInSelection:NO];
-    NSUInteger matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
-    if (matchCount > maxMatchCount)
-        matchCount = maxMatchCount;
-
     if (!selection) {
         page()->didFailToFindString(string);
         return;
     }
 
+    NSUInteger matchCount;
+    if (!maxMatchCount) {
+        // If the max was zero, any result means we exceeded the max. We can skip computing the actual count.
+        matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
+    } else {
+        matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
+        if (matchCount > maxMatchCount)
+            matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
+    }
+
     [m_pdfView setCurrentSelection:selection];
     [m_pdfView scrollSelectionToVisible:nil];
     page()->didFindString(string, matchCount);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to