Changeset 23926 in webkit


Ignore:
Timestamp:
Jul 2, 2007 12:42:02 AM (17 years ago)
Author:
oliver
Message:

Reviewed by Justin.

Fix for

<rdar://problem/5290113> WebKit does not correctly handle replacement ranges from the IM in -[WebHTMLView insertText:]
http://bugs.webkit.org/show_bug.cgi?id=13664

We replicate the logic of -[WebHTMLView setMarkedText:selectedRange:] to handle the Input Method
feeding us a replacement string through insertText: so we can handle IMs that use insertText to
replace text.

  • WebView/WebHTMLView.mm: (-[WebHTMLView insertText:]):
Location:
trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r23924 r23926  
     12007-07-02  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Justin.
     4
     5        Fix for
     6          <rdar://problem/5290113> WebKit does not correctly handle replacement ranges from the IM in -[WebHTMLView insertText:]
     7          http://bugs.webkit.org/show_bug.cgi?id=13664
     8
     9        We replicate the logic of -[WebHTMLView setMarkedText:selectedRange:] to handle the Input Method
     10        feeding us a replacement string through insertText: so we can handle IMs that use insertText to
     11        replace text.
     12
     13        * WebView/WebHTMLView.mm:
     14        (-[WebHTMLView insertText:]):
     15
    1162007-07-01  Oliver Hunt  <oliver@apple.com>
    217
  • trunk/WebKit/WebView/WebHTMLView.mm

    r23924 r23926  
    54765476    // We don't support inserting an attributed string but input methods don't appear to require this.
    54775477    NSString *text;
    5478     if ([string isKindOfClass:[NSAttributedString class]])
     5478    bool isFromInputMethod = [self hasMarkedText];
     5479    if ([string isKindOfClass:[NSAttributedString class]]) {
    54795480        text = [string string];
    5480     else
     5481        // We deal with the NSTextInputReplacementRangeAttributeName attribute from NSAttributedString here
     5482        // simply because it is used by at least one Input Method -- it corresonds to the kEventParamTextInputSendReplaceRange
     5483        // event in TSM.  This behaviour matches that of -[WebHTMLView setMarkedText:selectedRange:] when it receives an
     5484        // NSAttributedString
     5485        NSString *rangeString = [string attribute:NSTextInputReplacementRangeAttributeName atIndex:0 longestEffectiveRange:NULL inRange:NSMakeRange(0, [text length])];
     5486        if (rangeString) {
     5487            [[self _bridge] selectNSRange:NSRangeFromString(rangeString)];
     5488            isFromInputMethod = YES;
     5489        }
     5490    } else
    54815491        text = string;
    54825492
     
    54925502        // another way to determine if the call is from the input method
    54935503        bool shouldSaveCommand = parameters && parameters->shouldSaveCommand;
    5494         bool isFromInputMethod = [self hasMarkedText];
    54955504        if (event && shouldSaveCommand && !isFromInputMethod) {
    54965505            KeypressCommand command;
Note: See TracChangeset for help on using the changeset viewer.