[webkit-reviews] review requested: [Bug 25298] Ctrl + Right/Left arrow move forward/backward through document instead of right/left in RTL text : [Attachment 78476] patch w/ layout test

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 10 17:31:29 PST 2011


Xiaomei Ji <xji at chromium.org> has asked  for review:
Bug 25298: Ctrl + Right/Left arrow move forward/backward through document
instead of right/left in RTL text
https://bugs.webkit.org/show_bug.cgi?id=25298

Attachment 78476: patch w/ layout test
https://bugs.webkit.org/attachment.cgi?id=78476&action=review

------- Additional Comments from Xiaomei Ji <xji at chromium.org>
I tried different approaches, but seems this brutal force way works the best:
it is the easiest, cleanest, and closest to complete correctness.

The patch computes word boundary box by box in order to save the correct word
break position either before a space or after a space (if space is used as word
breaker), so <div>who<span>ever</span><div> might be considered as 2 words
"who" and "ever".

The patch works for most cases, but does not work well in complex structure
such as block with inline element that having different directionality. It does
not work well in 2 aspects:
1. word break might stop at both positions before and after a space in some
case.
For example: <div dir=rtl class="test_move_by_word" contenteditable>abc ששש def
<span dir=ltr>שנב  abc סטז</span>  uvw זזז xyz</div>
press ctrl-right-arrow when cursor is before "שנב abc" moves cursor after
"שנב", press it again moves cursor after '  '(space).

2. word break might stop at the wrong position around space in some case. 
For example: <div dir=rtl class="test_move_by_word" contenteditable>abc ששש def
<span dir=ltr>שנב  abc סטז</span>  uvw זזז xyz</div>
press ctrl-right-arrow when cursor is before "def שנב" moves cursor after ' 
'(space).


More information about the webkit-reviews mailing list