Changeset 21728 in webkit


Ignore:
Timestamp:
May 24, 2007, 1:57:00 PM (17 years ago)
Author:
oliver
Message:

2007-05-24 Oliver Hunt <oliver@apple.com>

Reviewed by Adam, Darin, and Geoff.

Fix for <rdar://problem/5000470> REGRESSION: The IM reconvert
function returns incorrect symbol due to inconsistent range
domains in TSM

Text Services Management uses ranges provided by the
NSTextInput API to index into the string return by
-[WebHTMLView string]. As a result some input methods
incorrectly get their candidate text from the beginning
of the document instead of from the input element.

TSM prefers to query -textStorage over -string so as a
workaround we provide an implementation of -textStorage that
returns the content of the current text input. TSM only ever
queries the result of textStorage as an NSAttributedString so
we do not need to implement a fake NSTextStorage class

This should not cause harm to anything else as textStorage is
actually a method on NSTextView, which we clearly are not. TSM
only queries the method because it uses respondsToSelector to
control behaviour.

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

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r21710 r21728  
     12007-05-24  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Adam, Darin, and Geoff.
     4
     5        Fix for <rdar://problem/5000470> REGRESSION: The IM reconvert
     6        function returns incorrect symbol due to inconsistent range
     7        domains in TSM
     8
     9        Text Services Management uses ranges provided by the
     10        NSTextInput API to index into the string return by
     11        -[WebHTMLView string]. As a result some input methods
     12        incorrectly get their candidate text from the beginning
     13        of the document instead of from the input element.
     14
     15        TSM prefers to query -textStorage over -string so as a
     16        workaround we provide an implementation of -textStorage that
     17        returns the content of the current text input.  TSM only ever
     18        queries the result of textStorage as an NSAttributedString so
     19        we do not need to implement a fake NSTextStorage class
     20
     21        This should not cause harm to anything else as textStorage is
     22        actually a method on NSTextView, which we clearly are not. TSM
     23        only queries the method because it uses respondsToSelector to
     24        control behaviour.
     25
     26        * WebView/WebHTMLView.mm:
     27        (-[WebHTMLView textStorage]):
     28
     29
    1302007-05-24  David Harrison  <harrison@apple.com>
    231
  • trunk/WebKit/WebView/WebHTMLView.mm

    r21618 r21728  
    58935893}
    58945894
     5895- (NSAttributedString *)textStorage
     5896{
     5897    NSAttributedString *result = [self attributedSubstringFromRange:NSMakeRange(0, UINT_MAX)];
     5898    // We have to return an empty string rather than null to prevent TSM from calling -string
     5899    return result ? result : [[[NSAttributedString alloc] initWithString:@""] autorelease];
     5900}
     5901
    58955902- (NSAttributedString *)_attributeStringFromDOMRange:(DOMRange *)range
    58965903{
Note: See TracChangeset for help on using the changeset viewer.