[webkit-changes] cvs commit: WebKit/WebView.subproj WebPDFView.h WebPDFView.m

John sullivan at opensource.apple.com
Fri Jul 15 15:59:18 PDT 2005


sullivan    05/07/15 15:59:18

  Modified:    .        ChangeLog
               WebView.subproj WebPDFView.h WebPDFView.m
  Log:
          Written by Trey Matteson
          Reviewed by me.
  
          Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4013
                  text find doesn't wrap in PDF files
  
          This just works once WebPDFView implements the WebDocumentText protocol, which is
          mostly just a matter of forwarding the methods to PDFKit appropriately.
  
          * WebView.subproj/WebPDFView.h:
          * WebView.subproj/WebPDFView.m:
          (-[WebPDFView supportsTextEncoding]):
          (-[WebPDFView string]):
          (-[WebPDFView attributedString]):
          (-[WebPDFView selectedString]):
          (-[WebPDFView selectedAttributedString]):
          (-[WebPDFView selectAll]):
          (-[WebPDFView deselectAll]):
  
  Revision  Changes    Path
  1.3231    +21 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3230
  retrieving revision 1.3231
  diff -u -r1.3230 -r1.3231
  --- ChangeLog	15 Jul 2005 22:16:01 -0000	1.3230
  +++ ChangeLog	15 Jul 2005 22:59:15 -0000	1.3231
  @@ -1,5 +1,26 @@
   2005-07-15  John Sullivan  <sullivan at apple.com>
   
  +        Written by Trey Matteson
  +        Reviewed by me.
  +
  +        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=4013
  +                text find doesn't wrap in PDF files
  +
  +        This just works once WebPDFView implements the WebDocumentText protocol, which is
  +        mostly just a matter of forwarding the methods to PDFKit appropriately.
  +
  +        * WebView.subproj/WebPDFView.h:
  +        * WebView.subproj/WebPDFView.m:
  +        (-[WebPDFView supportsTextEncoding]):
  +        (-[WebPDFView string]):
  +        (-[WebPDFView attributedString]):
  +        (-[WebPDFView selectedString]):
  +        (-[WebPDFView selectedAttributedString]):
  +        (-[WebPDFView selectAll]):
  +        (-[WebPDFView deselectAll]):
  +
  +2005-07-15  John Sullivan  <sullivan at apple.com>
  +
           Reviewed by Kevin Decker.
           
           - fixed <rdar://problem/4181884> Searching for text that overlaps selection works 
  
  
  
  1.8       +1 -1      WebKit/WebView.subproj/WebPDFView.h
  
  Index: WebPDFView.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebPDFView.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebPDFView.h	14 Jun 2005 18:06:00 -0000	1.7
  +++ WebPDFView.h	15 Jul 2005 22:59:18 -0000	1.8
  @@ -33,7 +33,7 @@
   
   @protocol _web_WebDocumentTextSizing;
   
  - at interface WebPDFView : NSView <WebDocumentView, WebDocumentSearching, _web_WebDocumentTextSizing>
  + at interface WebPDFView : NSView <WebDocumentView, WebDocumentSearching, WebDocumentText, _web_WebDocumentTextSizing>
   {
       PDFView *PDFSubview;
       WebDataSource *dataSource;
  
  
  
  1.20      +51 -0     WebKit/WebView.subproj/WebPDFView.m
  
  Index: WebPDFView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebPDFView.m,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- WebPDFView.m	15 Jul 2005 22:16:04 -0000	1.19
  +++ WebPDFView.m	15 Jul 2005 22:59:18 -0000	1.20
  @@ -503,6 +503,57 @@
       }
   }
   
  +/*** WebDocumentText protocol implementation ***/
  +
  +- (BOOL)supportsTextEncoding
  +{
  +    return NO;
  +}
  +
  +- (NSString *)string
  +{
  +    return [[PDFSubview document] string];
  +}
  +
  +- (NSAttributedString *)attributedString
  +{
  +    // changing the selection is a hack, but the only way to get an attr string is via PDFSelection
  +    
  +    // must copy this selection object because we change the selection which seems to release it
  +    PDFSelection *savedSelection = [[PDFSubview currentSelection] copy];
  +    [PDFSubview selectAll:nil];
  +    NSAttributedString *result = [[PDFSubview currentSelection] attributedString];
  +    if (savedSelection) {
  +        [PDFSubview setCurrentSelection:savedSelection];
  +        [savedSelection release];
  +    } else {
  +        // FIXME: behavior of setCurrentSelection:nil is not documented - check 4182934 for progress
  +        // Otherwise, we could collapse this code with the case above.
  +        [PDFSubview clearSelection];
  +    }
  +    return result;
  +}
  +
  +- (NSString *)selectedString
  +{
  +    return [[PDFSubview currentSelection] string];
  +}
  +
  +- (NSAttributedString *)selectedAttributedString
  +{
  +    return [[PDFSubview currentSelection] attributedString];
  +}
  +
  +- (void)selectAll
  +{
  +    [PDFSubview selectAll:nil];
  +}
  +
  +- (void)deselectAll
  +{
  +    [PDFSubview clearSelection];
  +}
  +
   @end
   
   #endif // OMIT_TIGER_FEATURES
  
  
  



More information about the webkit-changes mailing list