[webkit-dev] How to convert character offset into VisiblePosition?
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev