Fwd: 縦書きモードでのgetSelection().modify()の挙動について

縦書きモードでのgetSelection().modify()の挙動についてご意見はありますか?

現在のところ、modify('move', 'left', 'character')とmodify('move', 'left',
'line')はキャレットをそれぞれ、双方向テキストにおける左と上に移動する(つまり日本語のような右から左りの縦書きでは、上と右)という意見が大方です。

http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032078.html

丹羽

---------- Forwarded message ----------
From: Ryosuke Niwa <rniwa@webkit.org>
Date: Wed, Jun 15, 2011 at 4:13 PM
Subject: getSelection().modify() in vertical writing modes
To: whatwg@lists.whatwg.org
Cc: Aryeh Gregor <Simetrical+w3c@gmail.com>, Boris Zbarsky <bzbarsky@mit.edu>,
Ehsan Akhgari <ehsan@mozilla.com>

Hi all,

WebKit would like to support visual caret movements in vertical writing
modes [1].  How should getSelection().modify() support this new behavior?
 In particular, what getSelection().modify('move'/'extend', 'left'/'right',
'character') should do?

One possibility is that getSelection().modify('move'/'extend',
'left'/'right', 'character') will move caret visually left or right, thereby
moving between lines in vertical writing mode.  This way, the semantics of
moving left and right is preserved.  However, the semantics of moving by
'character' is lost.  In this case, getSelection().modify('move'/'extend',
'left'/'right', 'line') should move caret visually up or down (moving one
character at a time).

Now, in horizontal writing modes, 'left' and 'right' are used to move caret
in visual order (in the sense of bidirectional text) and 'forward' and
'backward' are used to move in logical order.  However, swapping the meaning
of 'character' and 'line' for 'forward' and 'backward' is quite confusing as
they used to walk DOM in logical order, and didn't depend on how characters
are presented.

On the other hand, if we left modify() intact - i.e.
getSelection().modify('move'/'extend', 'left'/'right', 'character') move
caret in visual order (i.e. visually up or down) in vertical writing mode
- then scripts need to manually detect whether the content in which the
caret resides is in vertical writing mode or not and change granularity
between 'character' and 'line' in order to emulate arrow key movements.

[1] http://dev.w3.org/csswg/css3-writing-modes/

Best,
Ryosuke Niwa
Software Engineer
Google Inc.

Received on Tuesday, 21 June 2011 01:31:11 UTC