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

John sullivan at opensource.apple.com
Thu Jul 14 16:52:56 PDT 2005


sullivan    05/07/14 16:52:55

  Modified:    .        ChangeLog
               WebCoreSupport.subproj WebBridge.m
               WebView.subproj WebHTMLView.m WebHTMLViewInternal.h
  Log:
          Reviewed by Dave Hyatt.
  
          - WebKit part of fix for:
          <rdar://problem/4181227> webpages incorrectly use standard instead of secondary highlighting in certain cases
  
          * WebCoreSupport.subproj/WebBridge.m:
          (-[WebBridge formControlIsResigningFirstResponder:]):
          Implementation of new method defined in WebCore, passes call along to WebHTMLView
  
          * WebView.subproj/WebHTMLViewInternal.h:
          declare _formControlIsResigningFirstResponder: so bridge can call it
  
          * WebView.subproj/WebHTMLView.m:
          (-[WebHTMLView updateFocusState]):
          just moved in file so it could be called from a different category
          (-[WebHTMLView _formControlIsResigningFirstResponder:]):
          new method, updates focus state
  
  Revision  Changes    Path
  1.3228    +20 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3227
  retrieving revision 1.3228
  diff -u -r1.3227 -r1.3228
  --- ChangeLog	14 Jul 2005 23:51:42 -0000	1.3227
  +++ ChangeLog	14 Jul 2005 23:52:50 -0000	1.3228
  @@ -1,5 +1,25 @@
   2005-07-14  John Sullivan  <sullivan at apple.com>
   
  +        Reviewed by Dave Hyatt.
  +
  +        - WebKit part of fix for: 
  +        <rdar://problem/4181227> webpages incorrectly use standard instead of secondary highlighting in certain cases
  +
  +        * WebCoreSupport.subproj/WebBridge.m:
  +        (-[WebBridge formControlIsResigningFirstResponder:]):
  +        Implementation of new method defined in WebCore, passes call along to WebHTMLView
  +        
  +        * WebView.subproj/WebHTMLViewInternal.h:
  +        declare _formControlIsResigningFirstResponder: so bridge can call it
  +
  +        * WebView.subproj/WebHTMLView.m:
  +        (-[WebHTMLView updateFocusState]):
  +        just moved in file so it could be called from a different category
  +        (-[WebHTMLView _formControlIsResigningFirstResponder:]):
  +        new method, updates focus state
  +
  +2005-07-14  John Sullivan  <sullivan at apple.com>
  +
   	added missing #import to fix build
   	* WebView.subproj/WebPDFView.m
   
  
  
  
  1.360     +8 -0      WebKit/WebCoreSupport.subproj/WebBridge.m
  
  Index: WebBridge.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebBridge.m,v
  retrieving revision 1.359
  retrieving revision 1.360
  diff -u -r1.359 -r1.360
  --- WebBridge.m	14 Jul 2005 02:43:51 -0000	1.359
  +++ WebBridge.m	14 Jul 2005 23:52:54 -0000	1.360
  @@ -59,6 +59,7 @@
   #import <WebKit/WebNSObjectExtras.h>
   #import <WebKit/WebNSURLExtras.h>
   #import <WebKit/WebNSURLRequestExtras.h>
  +#import <WebKit/WebNSViewExtras.h>
   #import <WebKit/WebNullPluginView.h>
   #import <WebKit/WebPlugin.h>
   #import <WebKit/WebPluginController.h>
  @@ -614,6 +615,13 @@
       }
   }
   
  +- (void)formControlIsResigningFirstResponder:(NSView *)formControl
  +{
  +    // When a form element resigns first responder, its enclosing WebHTMLView might need to
  +    // change its focus-displaying state, but isn't otherwise notified.
  +    [(WebHTMLView *)[formControl _web_superviewOfClass:[WebHTMLView class]] _formControlIsResigningFirstResponder:formControl];
  +}
  +
   - (void)setIconURL:(NSURL *)URL
   {
       [[self dataSource] _setIconURL:URL];
  
  
  
  1.456     +36 -24    WebKit/WebView.subproj/WebHTMLView.m
  
  Index: WebHTMLView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLView.m,v
  retrieving revision 1.455
  retrieving revision 1.456
  diff -u -r1.455 -r1.456
  --- WebHTMLView.m	14 Jul 2005 02:43:52 -0000	1.455
  +++ WebHTMLView.m	14 Jul 2005 23:52:54 -0000	1.456
  @@ -189,6 +189,7 @@
   - (void)_deleteSelection;
   - (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard;
   - (NSView *)_hitViewForEvent:(NSEvent *)event;
  +- (void)updateFocusState;
   - (void)_writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard cachedAttributedString:(NSAttributedString *)attributedString;
   @end
   
  @@ -646,6 +647,30 @@
       }
   }
   
  +- (void)updateFocusState
  +{
  +    // This method does the job of updating the view based on the view's firstResponder-ness and
  +    // the window key-ness of the window containing this view. This involves three kinds of 
  +    // drawing updates right now, all handled in WebCore in response to the call over the bridge. 
  +    // 
  +    // The three display attributes are as follows:
  +    // 
  +    // 1. The background color used to draw behind selected content (active | inactive color)
  +    // 2. Caret blinking (blinks | does not blink)
  +    // 3. The drawing of a focus ring around links in web pages.
  +    //
  +    // Also, this is responsible for letting the bridge know if the window has gained or lost focus
  +    // so we can send focus and blur events.
  +    
  +    WebBridge *bridge = [self _bridge];
  +    BOOL windowIsKey = [[self window] isKeyWindow];
  +    
  +    BOOL flag = !_private->resigningFirstResponder && windowIsKey && [self _web_firstResponderCausesFocusDisplay];
  +    [bridge setDisplaysWithFocusAttributes:flag];
  +    
  +    [bridge setWindowHasFocus:windowIsKey];
  +}
  +
   @end
   
   @implementation WebHTMLView (WebPrivate)
  @@ -2078,30 +2103,6 @@
           name:WKMouseMovedNotification() object:nil];
   }
   
  -- (void)updateFocusState
  -{
  -    // This method does the job of updating the view based on the view's firstResponder-ness and
  -    // the window key-ness of the window containing this view. This involves three kinds of 
  -    // drawing updates right now, all handled in WebCore in response to the call over the bridge. 
  -    // 
  -    // The three display attributes are as follows:
  -    // 
  -    // 1. The background color used to draw behind selected content (active | inactive color)
  -    // 2. Caret blinking (blinks | does not blink)
  -    // 3. The drawing of a focus ring around links in web pages.
  -    //
  -    // Also, this is responsible for letting the bridge know if the window has gained or lost focus
  -    // so we can send focus and blur events.
  -
  -    WebBridge *bridge = [self _bridge];
  -    BOOL windowIsKey = [[self window] isKeyWindow];
  -
  -    BOOL flag = !_private->resigningFirstResponder && windowIsKey && [self _web_firstResponderCausesFocusDisplay];
  -    [bridge setDisplaysWithFocusAttributes:flag];
  -
  -    [bridge setWindowHasFocus:windowIsKey];
  -}
  -
   - (void)addSuperviewObservers
   {
       // We watch the bounds of our superview, so that we can do a layout when the size
  @@ -4841,6 +4842,17 @@
       _private->startNewKillRingSequence = YES;
   }
   
  +- (void)_formControlIsResigningFirstResponder:(NSView *)formControl
  +{
  +    // set resigningFirstResponder so updateFocusState behaves the same way it does when
  +    // the WebHTMLView itself is resigningFirstResponder; don't use the primary selection feedback.
  +    // If the first responder is in the process of being set on the WebHTMLView itself, it will
  +    // get another chance at updateFocusState in its own becomeFirstResponder method.
  +    _private->resigningFirstResponder = YES;
  +    [self updateFocusState];
  +    _private->resigningFirstResponder = NO;
  +}
  +
   - (void)_updateFontPanel
   {
       // FIXME: NSTextView bails out if becoming or resigning first responder, for which it has ivar flags. Not
  
  
  
  1.21      +1 -0      WebKit/WebView.subproj/WebHTMLViewInternal.h
  
  Index: WebHTMLViewInternal.h
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLViewInternal.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WebHTMLViewInternal.h	5 Jun 2005 17:54:47 -0000	1.20
  +++ WebHTMLViewInternal.h	14 Jul 2005 23:52:55 -0000	1.21
  @@ -90,6 +90,7 @@
   
   @interface WebHTMLView (WebInternal)
   - (void)_selectionChanged;
  +- (void)_formControlIsResigningFirstResponder:(NSView *)formControl;
   - (void)_updateFontPanel;
   - (unsigned int)_delegateDragSourceActionMask;
   - (BOOL)_canSmartCopyOrDelete;
  
  
  



More information about the webkit-changes mailing list