Changeset 10612 in webkit


Ignore:
Timestamp:
Sep 24, 2005 3:58:19 AM (19 years ago)
Author:
darin
Message:

Tweaked, reviewed, and landed by Darin.

  • 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.
Location:
trunk/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r10606 r10612  
     12005-09-24  Alexey Proskuryakov  <ap@nypop.com>
     2
     3        Tweaked, reviewed, and landed by Darin.
     4
     5        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4394
     6          Mouse clicks ignored in inline input areas
     7
     8        * WebView.subproj/WebHTMLView.m:
     9        (-[NSArray mouseDown:]): Removed misleading comment and added code to send mouse event to input manager.
     10        (-[NSArray mouseDragged:]): Added code to send mouse event to input manager.
     11        (-[NSArray mouseUp:]): Ditto.
     12        (-[WebHTMLView _discardMarkedText]): Umnmark text before calling markedTextAbandoned: to match behavior
     13        of NSTextView (not sure why we did things in the opposite order before).
     14        (-[WebHTMLView _updateSelectionForInputManager]): Ditto.
     15
     16        - unrelated tweak
     17
     18        * WebView.subproj/WebView.m:
     19        (-[WebView _performTextSizingSelector:withObject:onTrackingDocs:selForNonTrackingDocs:newScaleFactor:]):
     20        Fix typecast that used ... for no good reason.
     21
    1222005-09-23  Duncan Wilcox  <duncan@mclink.it>
    223
  • trunk/WebKit/WebView.subproj/WebHTMLView.m

    r10606 r10612  
    14491449    // Guarantee that the autoscroll timer is invalidated, even if we don't receive
    14501450    // a mouse up event.
    1451         BOOL isStillDown = WKMouseIsDown();   
     1451    BOOL isStillDown = WKMouseIsDown();   
    14521452    if (!isStillDown){
    14531453        [self _stopAutoscrollTimer];
     
    22142214    // Ensure that we will receive mouse move events.  Is this the best place to put this?
    22152215    [[self window] setAcceptsMouseMovedEvents: YES];
    2216         WKSetNSWindowShouldPostEventNotifications([self window], YES);
     2216    WKSetNSWindowShouldPostEventNotifications([self window], YES);
    22172217
    22182218    if (!_private->needsLayout) {
     
    25812581    [self _setMouseDownEvent:event];
    25822582
    2583     // TEXTINPUT: if there is marked text and the current input
    2584     // manager wants to handle mouse events, we need to make sure to
    2585     // pass it to them. If not, then we need to notify the input
    2586     // manager when the marked text is abandoned (user clicks outside
    2587     // the marked area)
     2583    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
     2584    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
     2585        goto done;
    25882586
    25892587    [_private->compController endRevertingChange:NO moveLeft:NO];
     
    26022600    }
    26032601
     2602done:
    26042603    [_private->firstResponderAtMouseDownTime release];
    26052604    _private->firstResponderAtMouseDownTime = nil;
     
    26312630- (void)mouseDragged:(NSEvent *)event
    26322631{
     2632    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
     2633    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
     2634        return;
     2635
    26332636    [self retain];
    2634    
    2635     // TEXTINPUT: if there is marked text and the current input
    2636     // manager wants to handle mouse events, we need to make sure to
    2637     // pass it to them.
    2638 
    2639     if (!_private->ignoringMouseDraggedEvents) {
     2637
     2638    if (!_private->ignoringMouseDraggedEvents)
    26402639        [[self _bridge] mouseDragged:event];
    2641     }
    2642    
     2640
    26432641    [self release];
    26442642}
     
    28592857- (void)mouseUp:(NSEvent *)event
    28602858{
    2861     // TEXTINPUT: if there is marked text and the current input
    2862     // manager wants to handle mouse events, we need to make sure to
    2863     // pass it to them.
     2859    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
     2860    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
     2861        return;
    28642862
    28652863    [self retain];
    2866    
     2864
    28672865    [self _stopAutoscrollTimer];
    28682866    [[self _bridge] mouseUp:event];
     
    50004998- (void)_extractAttributes:(NSArray **)a ranges:(NSArray **)r fromAttributedString:(NSAttributedString *)string
    50014999{
    5002         int length = [[string string] length];
    5003         int i = 0;
    5004         NSMutableArray *attributes = [NSMutableArray array];
    5005         NSMutableArray *ranges = [NSMutableArray array];
    5006         while (i < length) {
    5007             NSRange effectiveRange;
    5008             NSDictionary *attrs = [string attributesAtIndex:i longestEffectiveRange:&effectiveRange inRange:NSMakeRange(i,length - i)];
    5009             [attributes addObject:attrs];
    5010             [ranges addObject:[NSValue valueWithRange:effectiveRange]];
    5011             i = effectiveRange.location + effectiveRange.length;
    5012         }
    5013         *a = attributes;
    5014         *r = ranges;
     5000    int length = [[string string] length];
     5001    int i = 0;
     5002    NSMutableArray *attributes = [NSMutableArray array];
     5003    NSMutableArray *ranges = [NSMutableArray array];
     5004    while (i < length) {
     5005        NSRange effectiveRange;
     5006        NSDictionary *attrs = [string attributesAtIndex:i longestEffectiveRange:&effectiveRange inRange:NSMakeRange(i,length - i)];
     5007        [attributes addObject:attrs];
     5008        [ranges addObject:[NSValue valueWithRange:effectiveRange]];
     5009        i = effectiveRange.location + effectiveRange.length;
     5010    }
     5011    *a = attributes;
     5012    *r = ranges;
    50155013}
    50165014
     
    50715069{
    50725070    if (![self hasMarkedText])
    5073         return;
     5071        return;
    50745072
    50755073    _private->ignoreMarkedTextSelectionChange = YES;
    50765074
    50775075    [self _selectMarkedText];
     5076    [self unmarkText];
    50785077    [[NSInputManager currentInputManager] markedTextAbandoned:self];
    5079     [self unmarkText];
    50805078    // FIXME: Should we be calling the delegate here?
    50815079    [[self _bridge] deleteSelectionWithSmartDelete:NO];
     
    50915089
    50925090    if (![self _shouldReplaceSelectionWithText:text givenAction:WebViewInsertActionTyped]) {
    5093         [self _discardMarkedText];
    5094         return;
     5091        [self _discardMarkedText];
     5092        return;
    50955093    }
    50965094
     
    51125110    NSString *text;
    51135111    if ([string isKindOfClass:[NSAttributedString class]]) {
    5114         text = [string string];
     5112        text = [string string];
    51155113        // we don't yet support inserting an attributed string but input methods
    51165114        // don't appear to require this.
    51175115    } else {
    5118         text = string;
     5116        text = string;
    51195117    }
    51205118
     
    51315129
    51325130    if ([selection startContainer] != [markedTextRange startContainer])
    5133         return NO;
     5131        return NO;
    51345132
    51355133    if ([selection endContainer] != [markedTextRange startContainer])
    5136         return NO;
     5134        return NO;
    51375135
    51385136    if ([selection startOffset] < [markedTextRange startOffset])
    5139         return NO;
     5137        return NO;
    51405138
    51415139    if ([selection endOffset] > [markedTextRange endOffset])
    5142         return NO;
     5140        return NO;
    51435141
    51445142    return YES;
     
    51485146{
    51495147    if (![self hasMarkedText] || _private->ignoreMarkedTextSelectionChange)
    5150         return;
     5148        return;
    51515149
    51525150    if ([self _selectionIsInsideMarkedText]) {
    5153         DOMRange *selection = [self _selectedRange];
    5154         DOMRange *markedTextDOMRange = [[self _bridge] markedTextDOMRange];
    5155 
    5156         unsigned markedSelectionStart = [selection startOffset] - [markedTextDOMRange startOffset];
    5157         unsigned markedSelectionLength = [selection endOffset] - [selection startOffset];
    5158         NSRange newSelectionRange = NSMakeRange(markedSelectionStart, markedSelectionLength);
    5159        
    5160         [[NSInputManager currentInputManager] markedTextSelectionChanged:newSelectionRange client:self];
     5151        DOMRange *selection = [self _selectedRange];
     5152        DOMRange *markedTextDOMRange = [[self _bridge] markedTextDOMRange];
     5153
     5154        unsigned markedSelectionStart = [selection startOffset] - [markedTextDOMRange startOffset];
     5155        unsigned markedSelectionLength = [selection endOffset] - [selection startOffset];
     5156        NSRange newSelectionRange = NSMakeRange(markedSelectionStart, markedSelectionLength);
     5157
     5158        [[NSInputManager currentInputManager] markedTextSelectionChanged:newSelectionRange client:self];
    51615159    } else {
    5162         [[NSInputManager currentInputManager] markedTextAbandoned:self];
    5163         [self unmarkText];
     5160        [self unmarkText];
     5161        [[NSInputManager currentInputManager] markedTextAbandoned:self];
    51645162    }
    51655163}
  • trunk/WebKit/WebView.subproj/WebView.m

    r10578 r10612  
    32013201                }
    32023202            } else {
    3203                 // Incarnation to perform a selector returning a BOOL from objc/objc-runtime.h
    3204                 isSuitable = (*(BOOL(*)(id, SEL, ...))objc_msgSend)(sizingDocView, testSel);
     3203                // Incantation to perform a selector returning a BOOL.
     3204                isSuitable = ((BOOL(*)(id, SEL))objc_msgSend)(sizingDocView, testSel);
    32053205            }
    32063206           
Note: See TracChangeset for help on using the changeset viewer.