[Webkit-unassigned] [Bug 18794] New: -[WebHTMLView attributedSubstringFromRange:] result offset by one character

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 28 17:41:38 PDT 2008


           Summary: -[WebHTMLView attributedSubstringFromRange:] result
                    offset by one character
           Product: WebKit
           Version: 526+ (Nightly build)
          Platform: Macintosh
               URL: http://www.spikesoft.net/
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML Editing
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: com-webkit at sabi.net

In a simple HTML document containing a comment before the HTML element and
nested tables, when I select a substring and invoke -[WebHTMLView
attributedSubstringFromRange:] I get a result which is offset by one character. 

Compile and run the attached test application (WebKitTest) then click the Test
button.  It does the following (v is an editable WebView *):

    [v moveToBeginningOfDocument: nil];
    [v moveDown: nil];
    [v selectWord: nil];
    NSResponder<NSTextInput> *ti = [[self window] firstResponder]; //
    NSLog(@"firstResponder %@ selectedRange %@", ti, NSStringFromRange([ti
    NSLog(@"selected string: |%@|", [[ti attributedSubstringFromRange: [ti
selectedRange]] string]);

You'll see the first word ("selection") selected, and the range appears OK, but
the output is:

2008-04-28 19:31:59.795 WebKitTest[55407:10b] firstResponder <WebHTMLView:
0x156a7c0> selectedRange {0, 9}
2008-04-28 19:31:59.797 WebKitTest[55407:10b] selected string: | selectio|

The HTML file is attached separately for reference.  If I remove the comment or
one of the nested tables, the problem goes away; however, if I add text below
the tables, it exhibits the problem as well.

This problem was isolated from the spikesoft URL, which is a HTML disaster; the
attached minimized version validates, however.

Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list