[cssom-view]: should caretRangeFromPoint() return NULL for a non-text related node?

Sam implemented caretRangeFromPoint() in
Webkit<https://bugs.webkit.org/show_bug.cgi?id=27046>
.

But there is one question we are not sure about: whether NULL should be
returned if the hit test hits a non-text node.

Following is extracted from the
spec<http://dev.w3.org/csswg/cssom-view/#the-documentview-interface>
: "(caretRangeFromPoint)..... *must* return an empty text range for the
position where a text insertion point indicator would have been
inserted.... or no insertion point indicator would have been inserted, the
method *must* return null."

My understanding is that for a non-text related node (such as an image in
the  middle of text), since there is no insertion point indicator would have
been inserted into it (the image), a NULL range sould be returned if the hit
test hits it (the image).

But I am not sure what is the objective of caretRangeFromPoint().
 I have a specific use case which is to convert the mouse position to
character position inside a text node. Then returning NULL sounds reasonable
for such usage. Here <https://bugs.webkit.org/show_bug.cgi?id=29249>is the
related webkit bug.

Would appreciate more background and clarification.

Thanks,
Xiaomei

Received on Wednesday, 7 October 2009 16:45:46 UTC