[webkit-dev] How to convert character offset into VisiblePosition?
Xiaomei Ji
xji at chromium.org
Tue Jun 1 22:48:16 PDT 2010
Given a DOM Node and an InlineBox, is there a way to convert the character
offset within this InlineBox to a VisiblePosition? considering bidi/RTL.
Using <span> node in the following example as an example:
<div contenteditable dir=rtl>abc ששש def <span dir=ltr>שנב abc סטז</span>
uvw זזז xyz</div>
Assume the <span> node is node A, using "(node, offset)a" to represent
the node and offset information of Position when caret is before
character "a", the position information are:
...... (A, 4)a(A, 5)b(A, 6)c(A, 7) (A, 0xb)ז(A, 0xa)ט(A, 9)ס(A, 8).
Given the <span> node, the InlineBox representing " abc "(with surrounding
spaces), and character offset 5 within the InlineBox, is there a way to
convert offset 5 into VisiblePosition (A, 0xb) (not (A, 8))? which means
when caret is placed after the 2nd space in " abc ", the visible position is
(A, 0xb).
Thanks,
Xiaomei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100601/97f67874/attachment.html>
More information about the webkit-dev
mailing list