Title: [88204] trunk/Source/WebKit2
- Revision
- 88204
- Author
- [email protected]
- Date
- 2011-06-06 17:07:10 -0700 (Mon, 06 Jun 2011)
Log Message
<https://bugs.webkit.org/show_bug.cgi?id=62165>
<rdar://problem/9555835>
WebKit2 find-on-page callback doesn’t handle kWKMoreThanMaximumMatchCount on PDF pages
Reviewed by Dan Bernstein.
* 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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (88203 => 88204)
--- trunk/Source/WebKit2/ChangeLog 2011-06-07 00:03:16 UTC (rev 88203)
+++ trunk/Source/WebKit2/ChangeLog 2011-06-07 00:07:10 UTC (rev 88204)
@@ -1,3 +1,17 @@
+2011-06-06 John Sullivan <[email protected]>
+
+ 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-06 Carlos Garcia Campos <[email protected]>
Reviewed by Anders Carlsson.
Modified: trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm (88203 => 88204)
--- trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm 2011-06-07 00:03:16 UTC (rev 88203)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm 2011-06-07 00:07:10 UTC (rev 88204)
@@ -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
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes