WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
143065
Implement iOS WebKit2 PDF Find-in-Page
https://bugs.webkit.org/show_bug.cgi?id=143065
Summary
Implement iOS WebKit2 PDF Find-in-Page
Tim Horton
Reported
2015-03-25 16:46:01 PDT
Implement iOS WebKit2 PDF Find-in-Page
Attachments
Patch
(27.59 KB, patch)
2015-03-25 16:47 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(28.12 KB, patch)
2015-03-26 17:45 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(29.02 KB, patch)
2015-03-27 14:47 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(28.96 KB, patch)
2015-03-27 15:04 PDT
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Tim Horton
Comment 1
2015-03-25 16:47:05 PDT
Created
attachment 249444
[details]
Patch
WebKit Commit Bot
Comment 2
2015-03-25 16:49:24 PDT
Attachment 249444
[details]
did not pass style-queue: ERROR: Source/WebKit2/UIProcess/ios/WKPDFView.mm:478: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/ios/WKPDFView.mm:526: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/API/Cocoa/_WKFindOptions.h:30: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 3 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 3
2015-03-26 17:45:10 PDT
Created
attachment 249546
[details]
Patch
WebKit Commit Bot
Comment 4
2015-03-26 17:47:56 PDT
Attachment 249546
[details]
did not pass style-queue: ERROR: Source/WebKit2/UIProcess/ios/WKPDFView.mm:478: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/ios/WKPDFView.mm:526: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/API/Cocoa/_WKFindOptions.h:30: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 3 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 5
2015-03-26 21:48:53 PDT
Comment on
attachment 249546
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=249546&action=review
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:402 > +- (NSStringCompareOptions)_stringCompareOptionsFromWKFindOptions:(_WKFindOptions)options > +{ > + NSStringCompareOptions findOptions = 0; > + if (options & _WKFindOptionsCaseInsensitive) > + findOptions |= NSCaseInsensitiveSearch; > + if (options & _WKFindOptionsBackwards) > + findOptions |= NSBackwardsSearch; > + return findOptions; > +}
Seem like this can be a static function.
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:404 > +- (void)_computeMatchesForString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount completionHandler:(void (^)(bool success))completionHandler
Not BOOL?
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:411 > + _WKFindOptions optionsAffectingResults = options & ~(_WKFindOptionsBackwards | _WKFindOptionsShowOverlay | _WKFindOptionsShowFindIndicator | _WKFindOptionsShowHighlight | _WKFindOptionsWrapAround | _WKFindOptionsDetermineMatchIndex);
Maybe this should be defined in _WKFindOptions.h so that when new options are added the person adding them can remember to update this value if needed.
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:432 > + unsigned computeMatchesOperationID = _nextComputeMatchesOperationID++;
I’d ++_nextComputedMatchesOperationID here…(*)
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:437 > + dispatch_async(_findQueue, ^{
I think we prefer lambdas with explicit captures to blocks in C++ code.
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:440 > + for (unsigned pageIndex = 0; pageIndex < pages.size(); pageIndex++) {
post++!
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:448 > + if (_nextComputeMatchesOperationID > computeMatchesOperationID + 1) {
* …and do a simple != here.
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:460 > + if (_nextComputeMatchesOperationID > computeMatchesOperationID + 1)
and here.
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:496 > + CGRect zoomRect = [pageInfo.view convertRectFromPDFPageSpace:[match bounds]];
.bounds
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:517 > + NSUInteger location = [_currentFindSelection startIndex];
Can this be zero?
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:518 > + previousFindSelection = adoptNS([[UIPDFSelection alloc] initWithPage:[_currentFindSelection page] fromIndex:location - 1 toIndex:location]);
What if location is zero?
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:531 > + for (unsigned i = 0; i < _pages.size(); i++) {
post++ again?
> Source/WebKit2/UIProcess/ios/WKPDFView.mm:532 > + UIPDFSelection *match = [_pages[pageIndex].page findString:string fromSelection:(pageIndex == previousFindPageIndex ? previousFindSelection.get() : nullptr) options:findOptions];
nil
Tim Horton
Comment 6
2015-03-27 12:26:25 PDT
(In reply to
comment #5
)
> Comment on
attachment 249546
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=249546&action=review
> > Source/WebKit2/UIProcess/ios/WKPDFView.mm:411 > > + _WKFindOptions optionsAffectingResults = options & ~(_WKFindOptionsBackwards | _WKFindOptionsShowOverlay | _WKFindOptionsShowFindIndicator | _WKFindOptionsShowHighlight | _WKFindOptionsWrapAround | _WKFindOptionsDetermineMatchIndex); > > Maybe this should be defined in _WKFindOptions.h so that when new options > are added the person adding them can remember to update this value if needed.
I'm not sure, because whether "Backwards" affects results or not depends on what you're doing. I do agree that it would be unfortunate if new options were added and not added to this list, though. Maybe _WKFindOptions.h can have the list except Backwards and we can add Backwards in?
Tim Horton
Comment 7
2015-03-27 14:47:54 PDT
Created
attachment 249609
[details]
Patch
WebKit Commit Bot
Comment 8
2015-03-27 14:50:39 PDT
Attachment 249609
[details]
did not pass style-queue: ERROR: Source/WebKit2/UIProcess/ios/WKPDFView.mm:487: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/ios/WKPDFView.mm:536: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/API/Cocoa/_WKFindOptions.h:30: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 3 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 9
2015-03-27 15:04:34 PDT
Created
attachment 249611
[details]
Patch
Tim Horton
Comment 10
2015-03-27 15:05:56 PDT
http://trac.webkit.org/changeset/182085
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug