[whatwg] getSelection().modify() in vertical writing modes
Ryosuke Niwa
rniwa at webkit.org
Wed Jun 15 16:13:02 PDT 2011
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.
More information about the whatwg
mailing list