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

Darin darin at opensource.apple.com
Sat Sep 24 03:58:20 PDT 2005


darin       05/09/24 03:58:20

  Modified:    .        ChangeLog
               WebView.subproj WebHTMLView.m WebView.m
  Log:
          Tweaked, reviewed, and landed by Darin.
  
          - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4394
            Mouse clicks ignored in inline input areas
  
          * WebView.subproj/WebHTMLView.m:
          (-[NSArray mouseDown:]): Removed misleading comment and added code to send mouse event to input manager.
          (-[NSArray mouseDragged:]): Added code to send mouse event to input manager.
          (-[NSArray mouseUp:]): Ditto.
          (-[WebHTMLView _discardMarkedText]): Umnmark text before calling markedTextAbandoned: to match behavior
          of NSTextView (not sure why we did things in the opposite order before).
          (-[WebHTMLView _updateSelectionForInputManager]): Ditto.
  
          - unrelated tweak
  
          * WebView.subproj/WebView.m:
          (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]):
          Fix typecast that used ... for no good reason.
  
  Revision  Changes    Path
  1.3329    +21 -0     WebKit/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKit/ChangeLog,v
  retrieving revision 1.3328
  retrieving revision 1.3329
  diff -u -r1.3328 -r1.3329
  --- ChangeLog	24 Sep 2005 01:19:08 -0000	1.3328
  +++ ChangeLog	24 Sep 2005 10:58:16 -0000	1.3329
  @@ -1,3 +1,24 @@
  +2005-09-24  Alexey Proskuryakov  <ap at nypop.com>
  +
  +        Tweaked, reviewed, and landed by Darin.
  +
  +        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4394
  +          Mouse clicks ignored in inline input areas
  +
  +        * WebView.subproj/WebHTMLView.m:
  +        (-[NSArray mouseDown:]): Removed misleading comment and added code to send mouse event to input manager.
  +        (-[NSArray mouseDragged:]): Added code to send mouse event to input manager.
  +        (-[NSArray mouseUp:]): Ditto.
  +        (-[WebHTMLView _discardMarkedText]): Umnmark text before calling markedTextAbandoned: to match behavior
  +        of NSTextView (not sure why we did things in the opposite order before).
  +        (-[WebHTMLView _updateSelectionForInputManager]): Ditto.
  +
  +        - unrelated tweak
  +
  +        * WebView.subproj/WebView.m:
  +        (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]):
  +        Fix typecast that used ... for no good reason.
  +
   2005-09-23  Duncan Wilcox  <duncan at mclink.it>
   
           Reviewed and landed by Darin.
  
  
  
  1.471     +49 -51    WebKit/WebView.subproj/WebHTMLView.m
  
  Index: WebHTMLView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebHTMLView.m,v
  retrieving revision 1.470
  retrieving revision 1.471
  diff -u -r1.470 -r1.471
  --- WebHTMLView.m	24 Sep 2005 01:19:14 -0000	1.470
  +++ WebHTMLView.m	24 Sep 2005 10:58:19 -0000	1.471
  @@ -1448,7 +1448,7 @@
   {
       // Guarantee that the autoscroll timer is invalidated, even if we don't receive
       // a mouse up event.
  -	BOOL isStillDown = WKMouseIsDown();   
  +    BOOL isStillDown = WKMouseIsDown();   
       if (!isStillDown){
           [self _stopAutoscrollTimer];
           return;
  @@ -2213,7 +2213,7 @@
       
       // Ensure that we will receive mouse move events.  Is this the best place to put this?
       [[self window] setAcceptsMouseMovedEvents: YES];
  -	WKSetNSWindowShouldPostEventNotifications([self window], YES);
  +    WKSetNSWindowShouldPostEventNotifications([self window], YES);
   
       if (!_private->needsLayout) {
           return;
  @@ -2580,11 +2580,9 @@
       // Record the mouse down position so we can determine drag hysteresis.
       [self _setMouseDownEvent:event];
   
  -    // TEXTINPUT: if there is marked text and the current input
  -    // manager wants to handle mouse events, we need to make sure to
  -    // pass it to them. If not, then we need to notify the input
  -    // manager when the marked text is abandoned (user clicks outside
  -    // the marked area)
  +    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
  +    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
  +        goto done;
   
       [_private->compController endRevertingChange:NO moveLeft:NO];
   
  @@ -2601,6 +2599,7 @@
           [[self _bridge] mouseDown:event];
       }
   
  +done:
       [_private->firstResponderAtMouseDownTime release];
       _private->firstResponderAtMouseDownTime = nil;
   
  @@ -2630,16 +2629,15 @@
   
   - (void)mouseDragged:(NSEvent *)event
   {
  +    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
  +    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
  +        return;
  +
       [self retain];
  -    
  -    // TEXTINPUT: if there is marked text and the current input
  -    // manager wants to handle mouse events, we need to make sure to
  -    // pass it to them.
   
  -    if (!_private->ignoringMouseDraggedEvents) {
  +    if (!_private->ignoringMouseDraggedEvents)
           [[self _bridge] mouseDragged:event];
  -    }
  -    
  +
       [self release];
   }
   
  @@ -2858,12 +2856,12 @@
   
   - (void)mouseUp:(NSEvent *)event
   {
  -    // TEXTINPUT: if there is marked text and the current input
  -    // manager wants to handle mouse events, we need to make sure to
  -    // pass it to them.
  +    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
  +    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
  +        return;
   
       [self retain];
  -    
  +
       [self _stopAutoscrollTimer];
       [[self _bridge] mouseUp:event];
       [self _updateMouseoverWithFakeEvent];
  @@ -4999,19 +4997,19 @@
   
   - (void)_extractAttributes:(NSArray **)a ranges:(NSArray **)r fromAttributedString:(NSAttributedString *)string
   {
  -        int length = [[string string] length];
  -        int i = 0;
  -        NSMutableArray *attributes = [NSMutableArray array];
  -        NSMutableArray *ranges = [NSMutableArray array];
  -        while (i < length) {
  -            NSRange effectiveRange;
  -            NSDictionary *attrs = [string attributesAtIndex:i longestEffectiveRange:&effectiveRange inRange:NSMakeRange(i,length - i)];
  -            [attributes addObject:attrs];
  -            [ranges addObject:[NSValue valueWithRange:effectiveRange]];
  -            i = effectiveRange.location + effectiveRange.length;
  -	}
  -        *a = attributes;
  -        *r = ranges;
  +    int length = [[string string] length];
  +    int i = 0;
  +    NSMutableArray *attributes = [NSMutableArray array];
  +    NSMutableArray *ranges = [NSMutableArray array];
  +    while (i < length) {
  +        NSRange effectiveRange;
  +        NSDictionary *attrs = [string attributesAtIndex:i longestEffectiveRange:&effectiveRange inRange:NSMakeRange(i,length - i)];
  +        [attributes addObject:attrs];
  +        [ranges addObject:[NSValue valueWithRange:effectiveRange]];
  +        i = effectiveRange.location + effectiveRange.length;
  +    }
  +    *a = attributes;
  +    *r = ranges;
   }
   
   - (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange
  @@ -5070,13 +5068,13 @@
   - (void)_discardMarkedText
   {
       if (![self hasMarkedText])
  -	return;
  +        return;
   
       _private->ignoreMarkedTextSelectionChange = YES;
   
       [self _selectMarkedText];
  -    [[NSInputManager currentInputManager] markedTextAbandoned:self];
       [self unmarkText];
  +    [[NSInputManager currentInputManager] markedTextAbandoned:self];
       // FIXME: Should we be calling the delegate here?
       [[self _bridge] deleteSelectionWithSmartDelete:NO];
   
  @@ -5090,8 +5088,8 @@
       }
   
       if (![self _shouldReplaceSelectionWithText:text givenAction:WebViewInsertActionTyped]) {
  -	[self _discardMarkedText];
  -	return;
  +        [self _discardMarkedText];
  +        return;
       }
   
       _private->ignoreMarkedTextSelectionChange = YES;
  @@ -5111,11 +5109,11 @@
   {
       NSString *text;
       if ([string isKindOfClass:[NSAttributedString class]]) {
  -	text = [string string];
  +        text = [string string];
           // we don't yet support inserting an attributed string but input methods
           // don't appear to require this.
       } else {
  -	text = string;
  +        text = string;
       }
   
       [self _insertText:text selectInsertedText:NO];
  @@ -5130,16 +5128,16 @@
       ASSERT([markedTextRange startContainer] == [markedTextRange endContainer]);
   
       if ([selection startContainer] != [markedTextRange startContainer]) 
  -	return NO;
  +        return NO;
   
       if ([selection endContainer] != [markedTextRange startContainer])
  -	return NO;
  +        return NO;
   
       if ([selection startOffset] < [markedTextRange startOffset])
  -	return NO;
  +        return NO;
   
       if ([selection endOffset] > [markedTextRange endOffset])
  -	return NO;
  +        return NO;
   
       return YES;
   }
  @@ -5147,20 +5145,20 @@
   - (void)_updateSelectionForInputManager
   {
       if (![self hasMarkedText] || _private->ignoreMarkedTextSelectionChange)
  -	return;
  +        return;
   
       if ([self _selectionIsInsideMarkedText]) {
  -	DOMRange *selection = [self _selectedRange];
  -	DOMRange *markedTextDOMRange = [[self _bridge] markedTextDOMRange];
  +        DOMRange *selection = [self _selectedRange];
  +        DOMRange *markedTextDOMRange = [[self _bridge] markedTextDOMRange];
  +
  +        unsigned markedSelectionStart = [selection startOffset] - [markedTextDOMRange startOffset];
  +        unsigned markedSelectionLength = [selection endOffset] - [selection startOffset];
  +        NSRange newSelectionRange = NSMakeRange(markedSelectionStart, markedSelectionLength);
   
  -	unsigned markedSelectionStart = [selection startOffset] - [markedTextDOMRange startOffset];
  -	unsigned markedSelectionLength = [selection endOffset] - [selection startOffset];
  -	NSRange newSelectionRange = NSMakeRange(markedSelectionStart, markedSelectionLength);
  -	
  -	[[NSInputManager currentInputManager] markedTextSelectionChanged:newSelectionRange client:self];
  +        [[NSInputManager currentInputManager] markedTextSelectionChanged:newSelectionRange client:self];
       } else {
  -	[[NSInputManager currentInputManager] markedTextAbandoned:self];
  -	[self unmarkText];
  +        [self unmarkText];
  +        [[NSInputManager currentInputManager] markedTextAbandoned:self];
       }
   }
   
  
  
  
  1.308     +2 -2      WebKit/WebView.subproj/WebView.m
  
  Index: WebView.m
  ===================================================================
  RCS file: /cvs/root/WebKit/WebView.subproj/WebView.m,v
  retrieving revision 1.307
  retrieving revision 1.308
  diff -u -r1.307 -r1.308
  --- WebView.m	20 Sep 2005 22:31:06 -0000	1.307
  +++ WebView.m	24 Sep 2005 10:58:19 -0000	1.308
  @@ -3200,8 +3200,8 @@
                       [self setTextSizeMultiplier:newScaleFactor];
                   }
               } else {
  -                // Incarnation to perform a selector returning a BOOL from objc/objc-runtime.h
  -                isSuitable = (*(BOOL(*)(id, SEL, ...))objc_msgSend)(sizingDocView, testSel);
  +                // Incantation to perform a selector returning a BOOL.
  +                isSuitable = ((BOOL(*)(id, SEL))objc_msgSend)(sizingDocView, testSel);
               }
               
               if (isSuitable) {
  
  
  



More information about the webkit-changes mailing list