[Webkit-unassigned] [Bug 41234] New: VisiblePosition::characterAfter() can return 0 instead of '\n' for the last visible position in a paragraph

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 25 16:47:54 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=41234

           Summary: VisiblePosition::characterAfter() can return 0 instead
                    of '\n' for the last visible position in a paragraph
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML Editing
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: justin.garcia at apple.com


Except when newlines are preserved, VisiblePosition::characterAfter() will return 0 instead of \n for the last VisiblePosition in a paragraph.  For example:

<div>hello^</div>
<div>world</div>

Here is the current implementation:

// We canonicalize to the first of two equivalent candidates, but the second of the two candidates
// is the one that will be inside the text node containing the character after this visible position.
Position pos = m_deepPosition.downstream();
Node* node = pos.node();
if (!node || !node->isTextNode())
    return 0;
Text* textNode = static_cast<Text*>(pos.node());
unsigned offset = pos.deprecatedEditingOffset();
unsigned length = textNode->length();
if (offset >= length)
    return 0;

UChar32 ch;
const UChar* characters = textNode->data().characters();
U16_NEXT(characters, offset, length, ch);
return ch;

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



More information about the webkit-unassigned mailing list