Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-16 Thread Xiaomei Ji
(sorry for the spam, send last time using the wrong 'from' email address to the public mailing lists) Hi Maciej: Thanks for your comments. I have a question about interface CaretPosition: In case of form control node, such as textarea, the 'offset' is the character offset within the textarea

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-16 Thread Maciej Stachowiak
On Oct 16, 2009, at 10:23 AM, Xiaomei Ji wrote: Hi Maciej: Thanks for your comments. I have a question about interface CaretPosition: In case of form control node, such as textarea, the 'offset' is the character offset within the textarea under mouse, 'offsetKind' is control, what is

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-16 Thread Xiaomei Ji
Hi Maciej: Thanks for your quick reply. Then, I have other questions: 1. Why we would like to differentiate whether the node is a 'document' node or a 'control' node? Can such differentiation be achived by existing flags in node instead of offsetKind? 2. If we expose the control node, how to

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-12 Thread Xiaomei Ji
For a use case that pinpoint a word from a page, the context information needed besides word might be the language that the word is in.And yes, as you said, if the hit node is needed, elementFromPoint should do. Thanks, Xiaomei On Mon, Oct 12, 2009 at 1:08 AM, Anne van Kesteren ann...@opera.com

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-12 Thread Maciej Stachowiak
On Oct 12, 2009, at 1:08 AM, Anne van Kesteren wrote: On Fri, 09 Oct 2009 19:04:52 +0200, Xiaomei Ji x...@chromium.org wrote: Maybe I should propose Document.wordFromPoint() which directly returns the word under the mouse (and handles both the DOM node and non-DOM form control nodes).

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-12 Thread Maciej Stachowiak
On Oct 12, 2009, at 9:37 AM, Xiaomei Ji wrote: For a use case that pinpoint a word from a page, the context information needed besides word might be the language that the word is in. And yes, as you said, if the hit node is needed, elementFromPoint should do. Hit testing isn't cheap -

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-09 Thread Xiaomei Ji
Hi Olli, Thanks for your comments. I see your point. Maybe I should propose Document.wordFromPoint() which directly returns the word under the mouse (and handles both the DOM node and non-DOM form control nodes). It hides the information about the node and should be a useful API. Thanks,

propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-08 Thread Xiaomei Ji
One use case is to show a tooltip of the word's definition in your accept-language when you mouse over the word in a page. It needs to 1. convert the mouse position to character offset within a node (by Document.caretRangeFromPoint()http://dev.w3.org/csswg/cssom-view/#the-documentview-interface),

Re: propose an API to return Range in textarea etc. form control nodes (similar functionality as document.caretRangeFromPoint)

2009-10-08 Thread Olli Pettay
On 10/8/09 10:07 PM, Xiaomei Ji wrote: One use case is to show a tooltip of the word's definition in your accept-language when you mouse over the word in a page. It needs to 1. convert the mouse position to character offset within a node (by Document.caretRangeFromPoint()