Title: [236815] trunk/Source/WebKit
Revision
236815
Author
commit-qu...@webkit.org
Date
2018-10-03 16:34:25 -0700 (Wed, 03 Oct 2018)

Log Message

Search does not cancel after number of matching terms exceed set max limit
https://bugs.webkit.org/show_bug.cgi?id=190020
<rdar://problem/39585214>

Patch by Zamiul Haque <zha...@apple.com> on 2018-10-03
Reviewed by Andy Estes.

When searching a PDF document on MobileSafari, the maximum number of matching
terms are limited to a set constant. Beyond this limit, a PDF document should not
be searched, since the UI will not be updated correspondingly. To this effect,
a new SPI was made to cancel a search when the maximum limit of matching terms
is reached. This is done without clearing the highlighting for the all the terms
that were found under the limit. This bug was a result of not having implemented
the new SPI in WKPDFView.

This will be tested in a follow-up patch, after re-enabling WKPDFView tests
on iOS 12.

* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView pdfHostViewController:findStringUpdate:done:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (236814 => 236815)


--- trunk/Source/WebKit/ChangeLog	2018-10-03 23:24:10 UTC (rev 236814)
+++ trunk/Source/WebKit/ChangeLog	2018-10-03 23:34:25 UTC (rev 236815)
@@ -1,3 +1,25 @@
+2018-10-03  Zamiul Haque  <zha...@apple.com>
+
+        Search does not cancel after number of matching terms exceed set max limit
+        https://bugs.webkit.org/show_bug.cgi?id=190020
+        <rdar://problem/39585214>
+
+        Reviewed by Andy Estes.
+
+        When searching a PDF document on MobileSafari, the maximum number of matching
+        terms are limited to a set constant. Beyond this limit, a PDF document should not
+        be searched, since the UI will not be updated correspondingly. To this effect,
+        a new SPI was made to cancel a search when the maximum limit of matching terms
+        is reached. This is done without clearing the highlighting for the all the terms
+        that were found under the limit. This bug was a result of not having implemented 
+        the new SPI in WKPDFView.
+
+        This will be tested in a follow-up patch, after re-enabling WKPDFView tests
+        on iOS 12.
+
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
+
 2018-10-03  Brian Burg  <bb...@apple.com>
 
         [Cocoa] REGRESSION: web content process paused in debugger is considered to be unresponsive if WebKit client is sandboxed

Modified: trunk/Source/WebKit/Platform/spi/ios/PDFKitSPI.h (236814 => 236815)


--- trunk/Source/WebKit/Platform/spi/ios/PDFKitSPI.h	2018-10-03 23:24:10 UTC (rev 236814)
+++ trunk/Source/WebKit/Platform/spi/ios/PDFKitSPI.h	2018-10-03 23:34:25 UTC (rev 236815)
@@ -45,6 +45,7 @@
 
 - (void) findString:(NSString*) string withOptions:(NSStringCompareOptions) options;
 - (void) cancelFindString;
+- (void) cancelFindStringWithHighlightsCleared:(BOOL)cleared;
 - (void) focusOnSearchResultAtIndex:(NSUInteger) searchIndex;
 
 - (NSInteger) currentPageIndex;

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (236814 => 236815)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-10-03 23:24:10 UTC (rev 236814)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-10-03 23:34:25 UTC (rev 236815)
@@ -392,14 +392,18 @@
 
 - (void)pdfHostViewController:(PDFHostViewController *)controller findStringUpdate:(NSUInteger)numFound done:(BOOL)done
 {
-    // FIXME: We should stop searching once numFound exceeds _findStringMaxCount, but PDFKit doesn't
-    // allow us to stop the search without also clearing the search highlights. See <rdar://problem/39546973>.
+    if (numFound > _findStringMaxCount && !done) {
+        [controller cancelFindStringWithHighlightsCleared:NO];
+        done = YES;
+    }
+    
     if (!done)
         return;
-
-    _findStringCount = numFound;
-    if (auto findCompletion = std::exchange(_findCompletion, nil))
+    
+    if (auto findCompletion = std::exchange(_findCompletion, nil)) {
+        _findStringCount = numFound;
         findCompletion();
+    }
 }
 
 - (NSURL *)_URLWithPageIndex:(NSInteger)pageIndex
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to