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

Timothy thatcher at opensource.apple.com
Thu Dec 1 15:26:00 PST 2005


thatcher    05/12/01 15:25:59

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               WebView.subproj Tag: Safari-2-0-branch WebHTMLView.m
  Log:
          Merged fix from TOT to Safari-2-0-branch
  
      2005-12-01  Darin Adler <darin at apple.com>
  
          Reviewed by Vicki.
  
          - fix <rdar://problem/4349721> Regression: Hovering over menu item doesn't highlight menu item or
          mousing up on menu item in applet does not open URL in new window at smartmoney.com
  
          Since Java depends on doing a hit test inside it's mouse moved handling, let hit testing on Java
          applets go through the standard NSView code path. Since this should only happen for Java, add a global
          so that we can Use our own WebHTMLView hit testing when calling from _updateMouseoverWithEvent.
  
          * WebView.subproj/WebHTMLView.m:
          (-[WebHTMLView _hitViewForEvent:]): rename forceRealHitTest to forceNSViewHitTest
          (-[WebHTMLView _updateMouseoverWithEvent:]): set global variable  to force a WebHTMLView-style hit test from here
          (-[WebHTMLView hitTest:]): perform the appropriate hit test based on global variables
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3118.4.84 +20 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3118.4.83
  retrieving revision 1.3118.4.84
  diff -u -r1.3118.4.83 -r1.3118.4.84
  --- ChangeLog	19 Nov 2005 03:51:30 -0000	1.3118.4.83
  +++ ChangeLog	1 Dec 2005 23:25:54 -0000	1.3118.4.84
  @@ -1,3 +1,23 @@
  +2005-12-01  Timothy Hatcher  <timothy at apple.com>
  +
  +        Merged fix from TOT to Safari-2-0-branch
  +
  +    2005-12-01  Darin Adler <darin at apple.com>
  +
  +        Reviewed by Vicki.
  +	
  +        - fix <rdar://problem/4349721> Regression: Hovering over menu item doesn't highlight menu item or 
  +        mousing up on menu item in applet does not open URL in new window at smartmoney.com
  +        
  +        Since Java depends on doing a hit test inside it's mouse moved handling, let hit testing on Java 
  +        applets go through the standard NSView code path. Since this should only happen for Java, add a global
  +        so that we can Use our own WebHTMLView hit testing when calling from _updateMouseoverWithEvent.
  +
  +        * WebView.subproj/WebHTMLView.m:
  +        (-[WebHTMLView _hitViewForEvent:]): rename forceRealHitTest to forceNSViewHitTest
  +        (-[WebHTMLView _updateMouseoverWithEvent:]): set global variable  to force a WebHTMLView-style hit test from here
  +        (-[WebHTMLView hitTest:]): perform the appropriate hit test based on global variables 
  +
   === WebKit-417.5 ===
   
   2005-11-18  Timothy Hatcher  <timothy at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.437.8.6 +36 -8     WebKit/WebView.subproj/WebHTMLView.m
  
  Index: WebHTMLView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLView.m,v
  retrieving revision 1.437.8.5
  retrieving revision 1.437.8.6
  diff -u -r1.437.8.5 -r1.437.8.6
  --- WebHTMLView.m	11 Nov 2005 05:09:57 -0000	1.437.8.5
  +++ WebHTMLView.m	1 Dec 2005 23:25:58 -0000	1.437.8.6
  @@ -148,7 +148,11 @@
       forwardDeleteKeyAction
   } WebDeletionAction;
   
  -static BOOL forceRealHitTest = NO;
  +// if YES, do the standard NSView hit test (which can't give the right result when HTML overlaps a view)
  +static BOOL forceNSViewHitTest = NO;
  +
  +// if YES, do the "top WebHTMLView" it test (which we'd like to do all the time but can't because of Java requirements [see bug 4349721])
  +static BOOL forceWebHTMLViewHitTest = NO;
   
   // Used to avoid linking with ApplicationServices framework for _DCMDictionaryServiceWindowShow
   void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
  @@ -557,9 +561,9 @@
   {
       // Usually, we hack AK's hitTest method to catch all events at the topmost WebHTMLView.  
       // Callers of this method, however, want to query the deepest view instead.
  -    forceRealHitTest = YES;
  +    forceNSViewHitTest = YES;
       NSView *hitView = [[[self window] contentView] hitTest:[event locationInWindow]];
  -    forceRealHitTest = NO;    
  +    forceNSViewHitTest = NO;    
       return hitView;
   }
   
  @@ -842,15 +846,37 @@
   
   - (NSView *)hitTest:(NSPoint)point
   {
  -    // WebHTMLView objects handle all left mouse clicks for objects inside them.
  -    // That does not include left mouse clicks with the control key held down.
  +    // WebHTMLView objects handle all events for objects inside them.
  +    // To get those events, we prevent hit testing from AppKit.
  +
  +    // But there are three exceptions to this:
  +    //   1) For right mouse clicks and control clicks we don't yet have an implementation
  +    //      that works for nested views, so we let the hit testing go through the
  +    //      standard NSView code path (needs to be fixed, see bug 4361618).
  +    //   2) Java depends on doing a hit test inside it's mouse moved handling,
  +    //      so we let the hit testing go through the standard NSView code path
  +    //      when the current event is a mouse move (except when we are calling
  +    //      from _updateMouseoverWithEvent, so we have to use a global,
  +    //      forceWebHTMLViewHitTest, for that)
  +    //   3) The acceptsFirstMouse: and shouldDelayWindowOrderingForEvent: methods
  +    //      both need to figure out which view to check with inside the WebHTMLView.
  +    //      They use a global to change the behavior of hitTest: so they can get the
  +    //      right view. The global is forceNSViewHitTest and the method they use to
  +    //      do the hit testing is _hitViewForEvent:. (But this does not work correctly
  +    //      when there is HTML overlapping the view, see bug 4361626)
  +
       BOOL captureHitsOnSubviews;
  -    if (forceRealHitTest) {
  +    if (forceNSViewHitTest)
           captureHitsOnSubviews = NO;
  -    } else {
  +    else if (forceWebHTMLViewHitTest)
  +        captureHitsOnSubviews = YES;
  +    else {
           NSEvent *event = [[self window] currentEvent];
  -        captureHitsOnSubviews = !([event type] == NSRightMouseDown || ([event type] == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask) != 0));
  +        captureHitsOnSubviews = !([event type] == NSMouseMoved
  +            || [event type] == NSRightMouseDown
  +            || ([event type] == NSLeftMouseDown && ([event modifierFlags] & NSControlKeyMask) != 0));
       }
  +
       if (!captureHitsOnSubviews)
           return [super hitTest:point];
       if ([[self superview] mouse:point inRect:[self frame]])
  @@ -976,7 +1002,9 @@
   - (void)_updateMouseoverWithEvent:(NSEvent *)event
   {
       WebHTMLView *view = nil;
  +    forceWebHTMLViewHitTest = YES;
       NSView *hitView = [[[event window] contentView] hitTest:[event locationInWindow]];
  +    forceWebHTMLViewHitTest = NO;
       if ([hitView isKindOfClass:[WebHTMLView class]]) 
           view = (WebHTMLView *)hitView; 
   
  
  
  



More information about the webkit-changes mailing list