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

すみません、途中で送ってしまいましたので追記します。

賛成です。Tabが言っているようにWriting Modes specにline-left/line-rightの概念があります[1]ので、これにも沿っていますし、日本人の直感にも近いと思います。

CSSのtext-align: leftなどもこの表に従うので、同じ挙動であると、覚えやすいかと思います。

この表にあるように、縦書にはいくつか種類があり、英語を反時計回りに90度回転させたものもあります。この時にはline-left/line-rightは逆にしていて、line-left=bottomです。

[1] http://dev.w3.org/csswg/css3-writing-modes/#logical-to-physical


From: public-html-ig-jp-request@w3.org [mailto:public-html-ig-jp-request@w3.org] On Behalf Of Ryosuke Niwa
Sent: Tuesday, June 21, 2011 10:30 AM
To: public-html-ig-jp@w3.org
Subject: 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<mailto:rniwa@webkit.org>>
Date: Wed, Jun 15, 2011 at 4:13 PM
Subject: getSelection().modify() in vertical writing modes
To: whatwg@lists.whatwg.org<mailto:whatwg@lists.whatwg.org>
Cc: Aryeh Gregor <Simetrical+w3c@gmail.com<mailto:Simetrical%2Bw3c@gmail.com>>, Boris Zbarsky <bzbarsky@mit.edu<mailto:bzbarsky@mit.edu>>, Ehsan Akhgari <ehsan@mozilla.com<mailto: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 02:11:14 UTC