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

John sullivan at opensource.apple.com
Thu Dec 8 11:44:15 PST 2005


sullivan    05/12/08 11:44:15

  Modified:    .        ChangeLog
               WebView.subproj WebPDFView.m
  Log:
          Reviewed by Tim O.
  
          - Added WebKit mechanism to help correctly pass the first responder into the PDF view hierarchy,
          in order to start addressing keyboard focus and selection highlight issues. Unfortunately this
          doesn't actually have any user effect yet due to problems that must be fixed in PDFKit.
  
          * WebView.subproj/WebPDFView.m:
          (-[WebPDFView acceptsFirstResponder]):
          Overridden to returns YES. Needed so NSClipView knows it's OK to pass focus down to this level.
          (-[WebPDFView becomeFirstResponder]):
          With setNextKeyView:, splices the PDF view into the focus-passing mechanism in much the same
          way as NSScrollView and NSClipView.
          (-[WebPDFView setNextKeyView:]):
          With becomeFirstResponder:, splices the PDF view into the focus-passing mechanism in much the same
          way as NSScrollView and NSClipView.
          (-[WebPDFView resignFirstResponder]):
          Removed this method because the WebPDFView itself is never first responder except transiently.
  
  Revision  Changes    Path
  1.3390    +20 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3389
  retrieving revision 1.3390
  diff -u -r1.3389 -r1.3390
  --- ChangeLog	8 Dec 2005 18:33:46 -0000	1.3389
  +++ ChangeLog	8 Dec 2005 19:44:08 -0000	1.3390
  @@ -1,3 +1,23 @@
  +2005-12-08  John Sullivan  <sullivan at apple.com>
  +
  +        Reviewed by Tim O.
  +        
  +        - Added WebKit mechanism to help correctly pass the first responder into the PDF view hierarchy,
  +        in order to start addressing keyboard focus and selection highlight issues. Unfortunately this 
  +        doesn't actually have any user effect yet due to problems that must be fixed in PDFKit.
  +
  +        * WebView.subproj/WebPDFView.m:
  +        (-[WebPDFView acceptsFirstResponder]):
  +        Overridden to returns YES. Needed so NSClipView knows it's OK to pass focus down to this level.
  +        (-[WebPDFView becomeFirstResponder]):
  +        With setNextKeyView:, splices the PDF view into the focus-passing mechanism in much the same
  +        way as NSScrollView and NSClipView.
  +        (-[WebPDFView setNextKeyView:]):
  +        With becomeFirstResponder:, splices the PDF view into the focus-passing mechanism in much the same
  +        way as NSScrollView and NSClipView.
  +        (-[WebPDFView resignFirstResponder]):
  +        Removed this method because the WebPDFView itself is never first responder except transiently.
  +
   2005-12-08  Maciej Stachowiak  <mjs at apple.com>
   
           Reviewed by John.
  
  
  
  1.29      +40 -10    WebKit/WebView.subproj/WebPDFView.m
  
  Index: WebPDFView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebPDFView.m,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- WebPDFView.m	5 Dec 2005 23:48:32 -0000	1.28
  +++ WebPDFView.m	8 Dec 2005 19:44:15 -0000	1.29
  @@ -735,24 +735,54 @@
       }
   }
   
  +- (BOOL)acceptsFirstResponder {
  +    return YES;
  +}
  +
   - (BOOL)becomeFirstResponder
   {
  -    BOOL result = [super becomeFirstResponder];
  -    if (result) {
  -        [[self _webView] _selectedFrameDidChange];
  +    // This works together with setNextKeyView to splice our PDFSubview into
  +    // the key loop similar to the way NSScrollView does this.
  +    NSWindow *window = [self window];
  +    id newFirstResponder = nil;
  +    
  +    if ([window keyViewSelectionDirection] == NSSelectingPrevious) {
  +        NSView *previousValidKeyView = [self previousValidKeyView];
  +        if ((previousValidKeyView != self) && (previousValidKeyView != PDFSubview))
  +            newFirstResponder = previousValidKeyView;
  +    } else {
  +        // FIXME 4370845: Passing first responder-ness down to the PDFSubview itself
  +        // should work, but doesn't due to missing first responder-passing code needed
  +        // in PDFKit. So this next line doesn't currently help (or hurt), but it should start
  +        // working when PDFKit fixes 4370845.
  +        newFirstResponder = PDFSubview;
       }
  -    return result;
  +    
  +    if (!newFirstResponder)
  +        return NO;
  +    
  +    if (![window makeFirstResponder:newFirstResponder])
  +        return NO;
  +    
  +    [[self _webView] _selectedFrameDidChange];
  +
  +    // FIXME 4265966: We don't currently have a way to notice when the PDFView (or subview) loses focus,
  +    // so sometimes a secondary selection is left behind in the PDFView when the primary selection moves elsewhere.    
  +    
  +    return YES;
   }
   
  -- (BOOL)resignFirstResponder
  +- (void)setNextKeyView:(NSView *)aView
   {
  -    BOOL resign = [super resignFirstResponder];
  -    if (resign && ![[self _web_parentWebView] maintainsInactiveSelection]) {
  -        [self deselectAll];
  -    }
  -    return resign;
  +    // This works together with becomeFirstResponder to splice PDFSubview into
  +    // the key loop similar to the way NSScrollView does this.
  +    if (PDFSubview)
  +        [PDFSubview setNextKeyView:aView];
  +    else
  +        [super setNextKeyView:aView];
   }
   
  +
   @end
   
   @implementation PDFPrefUpdatingProxy
  
  
  



More information about the webkit-changes mailing list