[Webkit-unassigned] [Bug 29249] New: document.caretRangeFromPoint() should return NULL if hit test on non text related node

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 14 11:19:39 PDT 2009


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

           Summary: document.caretRangeFromPoint() should return NULL if
                    hit test on non text related node
           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=39557)
 --> (https://bugs.webkit.org/attachment.cgi?id=39557)
caretRangeFromPointInNonTextNode.html

In caretRangeFromPoint(), there is the following code:

    Node* node = result.innerNode();
    if (!node)
        return 0;


Since we do not check whether the 'node' is a Text related node, there is a
possibility that a range is created even when the mouse is not pointed in the
text area.

Please open caretRangeFromPointInNonTextNode.html,
click mouse right before the first word "type", in the range created by
caretRangeFromPoint(), the node is the Text node, the start/end offset is 0. 

click mouse several characters ahead of word "type" (the empty space in the
left of "type"), although the 'node' is a HTMLBodyElement, but it has the
same visible position as the above, and the range created is the same as above.
Is this the correct behavior?

I think my assumption is that this function converts mouse position to the
character position within an element, so a null range should be returned if
click the empty spaces ahead of word "type".

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