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

On Wed, 07 Oct 2009 18:45:11 +0200, Xiaomei Ji <xji@chromium.org> wrote:
> 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.

Hmm, I would have expected that in the image scenario you would typically  
get an insertion pointer as well in normal editing conventions. The idea  
was anyway for there to be one since this is a convenience method for  
editors.

If someone can propose specification text that works better or maybe a set  
of constraints or something I can try to clarify.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Thursday, 8 October 2009 08:57:04 UTC