Re: [CSSOM] does CaretPosition need a "before/after" hint?

On Wed, May 11, 2011 at 4:46 AM, Ryosuke Niwa <rniwa@webkit.org> wrote:

> When a flag is used to indicate to which text a caret belongs, script/UA
> needs a mechanism to convert that to logical node, offset pair because
> that's the only way scripts can access text now.  And I don't know if we
> have such a mechanism in CSSDM or HTML DOM yet.


In Gecko the caret position is a triple: node, offset, and "attachment
flag". There's no need to convert that to a logical node/offset pair, the
attachment flag is just extra information.


> Also, if we're adding this flag/bidi-level, we probably need to expose
>>> visual ordering of text as well.  Is there any mechanism proposed to do
>>> such?
>>>
>>
>> This sounds like a whole separate discussion, but I'm not sure what you
>> mean by a mechanism to "expose visual ordering of text."
>>
>
> Right now, scripts can only access text in logical order (e.g. ABC 123 DEF
> is in logical order and FED 123 CBA is in visual order) and it seems like
> adding this hint and exposing that to script will necessarily exposes some
> information about the visual ordering of text. At that point, it seems
> natural to expose a way to walk text in visual order.
>

I don't think we need to expose visual ordering or computed bidi levels to
script for this flag to be useful. The most common way we use this flag is
to compute accurate geometric caret positions. So we'd need a Web-exposed
API to find a point or rectangle for a CaretPosition. The attachment flag
may also be useful if you're trying to figure out whether to apply some
command to the following text or the preceding text (or both).

Rob
-- 
"Now the Bereans were of more noble character than the Thessalonians, for
they received the message with great eagerness and examined the Scriptures
every day to see if what Paul said was true." [Acts 17:11]

Received on Wednesday, 11 May 2011 05:20:38 UTC