⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 88204 in webkit


Ignore:
Timestamp:
Jun 6, 2011, 5:07:10 PM (15 years ago)
Author:
sullivan@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r88171 r88204  
     12011-06-06  John Sullivan  <sullivan@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        <https://bugs.webkit.org/show_bug.cgi?id=62165>
     6        <rdar://problem/9555835>
     7        WebKit2 find-on-page callback doesn’t handle kWKMoreThanMaximumMatchCount on PDF pages
     8
     9        * UIProcess/API/mac/PDFViewController.mm:
     10        (WebKit::PDFViewController::findString):
     11        Return kWKMoreThanMaximumMatchCount when appropriate, a la FindController::countStringMatches().
     12        Also, skip counting all the matches if maxMatchCount is 0, to avoid (perhaps slowly) computing a
     13        number that would be ignored.
     14
    1152011-06-06  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm

    r84118 r88204  
    610610
    611611    PDFSelection *selection = [m_wkPDFView.get() _nextMatchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag fromSelection:[m_pdfView currentSelection] startInSelection:NO];
    612     NSUInteger matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
    613     if (matchCount > maxMatchCount)
    614         matchCount = maxMatchCount;
    615 
    616612    if (!selection) {
    617613        page()->didFailToFindString(string);
    618614        return;
     615    }
     616
     617    NSUInteger matchCount;
     618    if (!maxMatchCount) {
     619        // If the max was zero, any result means we exceeded the max. We can skip computing the actual count.
     620        matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
     621    } else {
     622        matchCount = [m_wkPDFView.get() _countMatches:string caseSensitive:caseFlag];
     623        if (matchCount > maxMatchCount)
     624            matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
    619625    }
    620626
Note: See TracChangeset for help on using the changeset viewer.