W3C home > Mailing lists > Public > www-style@w3.org > May 2011

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

From: Robert O'Callahan <robert@ocallahan.org>
Date: Wed, 11 May 2011 17:58:05 +1200
Message-ID: <BANLkTikihei0snykx7MrQUCqKnqLnxpEyA@mail.gmail.com>
To: Ryosuke Niwa <rniwa@webkit.org>
Cc: Ojan Vafai <ojan@chromium.org>, Julie Parent <jparent@chromium.org>, Eric Seidel <eseidel@chromium.org>, "www-style@w3.org" <www-style@w3.org>, Levi Weintraub <leviw@chromium.org>, Xiaomei Ji <xji@google.com>
On Wed, May 11, 2011 at 5:46 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:

> On Tue, May 10, 2011 at 10:20 PM, Robert O'Callahan <robert@ocallahan.org>wrote:
>>
>> 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.
>
>
> Same thing. Once you have a way to obtain point / rectangle for a
> CaretPosition, then you can query that on each logical position in DOM to
> figure out the visual order of text.
>

You can use the existing Range.getClientRects API to do that already.


> 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).
>
>
> I don't follow. Are you saying that some editing commands depend on this
> flag?
>

If, for example, you wanted to do something to a word that contains the
caret (e.g., show spelling corrections), and you had two adjacent words with
the caret in the middle (e.g. Thai), then you could use the attachment hint
to decide which word to operate on.

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:58:32 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:40 GMT