[Webkit-unassigned] [Bug 29937] New: caretRangeFromPoint() returns wrong result for text in <textarea>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 30 15:21:59 PDT 2009


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

           Summary: caretRangeFromPoint() returns wrong result for text in
                    <textarea>
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: xji at chromium.org


Created an attachment (id=40403)
 --> (https://bugs.webkit.org/attachment.cgi?id=40403)
test case

1. Open the attached HTML page.
2. Type in "this is a test" in the textarea.
3. click anywhere in above text. observe the result
4. nodeType is always "element" node, and offset is always equals 3.


The following code in Document::caretRangeFromPoint() changed the node type
from
TextNode to ElementNode, and the offset is set as the node index.

    Node* shadowAncestorNode = node->shadowAncestorNode();
    if (shadowAncestorNode != node) {
        unsigned offset = shadowAncestorNode->nodeIndex();
        Node* container = shadowAncestorNode->parentNode();
        return Range::create(this, container, offset, container, offset);
    }

What is the purpose of shadowAncestorNode()?
Should the above code piece be changed to the following? (related to issue
29249)

    Node::NodeType type = node->nodeType();
    if (type != Node::CDATA_SECTION_NODE && type != Node::COMMENT_NODE && type
!= Node::TEXT_NODE)
        return NULL;

-- 
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