(I've send this question to webkit-dev mailing list, but have not got any responses yet).
I am trying to write a JavaScript in Chrome to find the word user moused over, which needs to convert the mouse coordination (x,y) into character offset. I know FireFox supports event.rangeOffset, which is the *character* offset the cursor is at within the element. Given English word, using this offset, I can find the previous and next spaces and know the word under the cursor. But seems that Webkit (Chrome's layout engine) does not support event.rangeOffset. Then, how to find the word user moused over? or how to convert the event.clientX to the *character* offset within an element? My understanding is that it must involve encoding/font/font size/style, but I do not have clear idea on how it works. Appreciate any input. It does not need to be complicated/completed (such as to support RTL languages as well), I can start with English and/or some other simple script such as Chinese. Thanks for your help! Xiaomei --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---