blob: caa564ecd06137b33d91a90942aafcf0f0bfe884 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="resources/extend-selection.css" />
<style>
.fix_width {font-size: 10px; font-family: sans-serif;}
</style>
<script src="resources/move-by-word-visually.js"></script>
<script>
onload = function() {
try {
runTest();
} finally {
flushLog();
}
};
if (window.testRunner && window.internals) {
testRunner.dumpAsText();
internals.settings.setEditingBehavior('win');
}
</script>
</head>
<body>
<div id="testMoveByWord">
<!--
Title saves the word breaks.
The format of title is "xxx|xxxx".
The sequence on the left of "|" is word boundaries when moving caret from left to right.
The sequence on the right of "|" is word boundaries when moving caret from right to left.
If there is a single node in the line, the sequence are offsets.
If there are multiple nodes in the line, the sequence is array of [anchor_node_id, offset, child_node_index],
where child_node_index is optional, default is the first child of the anchor node.
-->
<!-- test multispaces -->
<div dir=ltr class="test_move_by_word" title="0 4 8 15 18|18 15 8 4 0" contenteditable>abc def hij opq</div>
<div dir=ltr class="test_move_by_word" title="4 8 15 22 28|28 22 15 8 4" contenteditable> abc def hij opq </div>
<div dir=ltr class="test_move_by_word" title="4 8 15 21|21 15 8 4" contenteditable> abc אבצ def </div>
<div dir=ltr class="test_move_by_word" title="4 8 15 21 29 36 42|42 36 29 21 15 8 4" contenteditable> abc def אבצ דדפ hij opq </div>
<div dir=ltr class="test_move_by_word" title="4 8 15 22 35 28 43 50 57 63|63 57 50 43 28 35 22 15 8 4" contenteditable> abc def hij אבצ דעפ היח opq rst uvw </div>
<div dir=ltr class="test_move_by_word" title="4 21 14 7 28|28 7 14 21 4" contenteditable> אבצ דעפ חיח ופק </div>
<div dir=ltr class="test_move_by_word" title="4 8 15 21|21 15 8 4" contenteditable> אבצ abc דעפ </div>
<div dir=ltr class="test_move_by_word" title="4 7 15 22 28 33 40|40 33 28 22 15 7 4" contenteditable> אבצ דעפ abc def חיח ופק </div>
<div dir=ltr class="test_move_by_word" title="4 14 7 22 29 35 41 51 46 58|58 46 51 41 35 29 22 7 14 4" contenteditable> אבצ דעפ חיח abc def jih ופק ופק רסת </div>
<div dir=ltr class="test_move_by_word" title="0 14 7 3 18|18 3 7 14 0" contenteditable>אבצ דעפ היח ופק</div>
<div dir=ltr class="test_move_by_word" title="0 7 3 12 19 23 26|26 23 19 12 3 7 0" contenteditable>אבצ דעפ היח abc def hij</div>
<div dir=ltr class="test_move_by_word" title="0 4 8 12 22 18 27 34 38 41|41 38 34 27 18 22 12 8 4 0" contenteditable>abc def hij אבצ דעפ היח opq rst uvw</div>
<div dir=rtl class="test_move_by_word" title="18 3 7 14 0|0 14 7 3 18" contenteditable>abc def hij opq</div>
<div dir=rtl class="test_move_by_word" title="28 7 14 21 4|4 21 14 7 28" contenteditable> abc def hij opq </div>
<div dir=rtl class="test_move_by_word" title="21 15 8 4|4 8 15 21" contenteditable> abc אבצ def </div>
<div dir=rtl class="test_move_by_word" title="42 35 29 22 15 7 4|4 7 15 22 29 35 42" contenteditable> abc def אבצ דדפ hij opq </div>
<div dir=rtl class="test_move_by_word" title="63 49 56 43 36 29 22 7 14 4|4 14 7 22 29 36 43 56 49 63" contenteditable> abc def hij אבצ דעפ היח opq rst uvw </div>
<div dir=rtl class="test_move_by_word" title="28 22 15 8 4|4 8 15 22 28" contenteditable> אבצ דעפ חיח ופק </div>
<div dir=rtl class="test_move_by_word" title="21 15 8 4|4 8 15 21" contenteditable> אבצ abc דעפ </div>
<div dir=rtl class="test_move_by_word" title="40 34 28 21 15 8 4|4 8 15 21 28 34 40" contenteditable> אבצ דעפ abc def חיח ופק </div>
<div dir=rtl class="test_move_by_word" title="58 52 47 41 28 34 22 15 8 4|4 8 15 22 34 28 41 47 52 58" contenteditable> אבצ דעפ חיח abc def jih ופק ופק רסת </div>
<!-- multispaces while preserving spaces -->
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 11 15 18|18 15 11 4 0" contenteditable>abc def hij opq</div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 11 18 25 32|32 25 18 11 4 0" contenteditable> abc def hij opq </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 11 18 25|25 18 11 4 0" contenteditable> abc אבצ def </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 11 18 21 32 39 46|46 39 32 21 18 11 4 0" contenteditable> abc def אבצ דדפ hij opq </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 11 18 25 35 28 46 53 60 67|67 60 53 46 28 35 25 18 11 4 0" contenteditable> abc def hij אבצ דעפ היח opq rst uvw </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 21 14 7 32|32 7 14 21 4 0" contenteditable> אבצ דעפ חיח ופק </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 11 18 26|26 18 11 4 0" contenteditable> אבצ abc דעפ </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 7 18 24 30 33 44|44 33 30 24 18 7 4 0" contenteditable> אבצ דעפ abc def חיח ופק </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 14 7 25 31 37 43 51 46 63|63 46 51 43 37 31 25 7 14 4 0" contenteditable> אבצ דעפ חיח abc def jih ופק ופק רסת </div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 14 7 3 18|18 3 7 14 0" contenteditable>אבצ דעפ היח ופק</div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 7 3 15 19 23 26|26 23 19 15 3 7 0" contenteditable>אבצ דעפ היח abc def hij</div>
<div style="white-space:pre" dir=ltr class="test_move_by_word" title="0 4 8 15 22 18 30 34 38 41|41 38 34 30 18 22 15 8 4 0" contenteditable>abc def hij אבצ דעפ היח opq rst uvw</div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="18 3 7 14 0|0 14 7 3 18" contenteditable>abc def hij opq</div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="32 7 14 21 4 0|0 4 21 14 7 32" contenteditable> abc def hij opq </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="25 18 11 4 0|0 4 11 18 25" contenteditable> abc אבצ def </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="46 35 32 25 18 7 4 0|0 4 7 18 25 32 35 46" contenteditable> abc def אבצ דדפ hij opq </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="67 49 56 46 39 32 25 7 14 4 0|0 4 14 7 25 32 39 46 56 49 67" contenteditable> abc def hij אבצ דעפ היח opq rst uvw </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="32 25 18 11 4 0|0 4 11 18 25 32" contenteditable> אבצ דעפ חיח ופק </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="26 18 11 4 0|0 4 11 18 26" contenteditable> אבצ abc דעפ </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="44 37 30 21 18 11 4 0|0 4 11 18 21 30 37 44" contenteditable> אבצ דעפ abc def חיח ופק </div>
<div style="white-space:pre" dir=rtl class="test_move_by_word" title="63 55 48 43 28 34 25 18 11 4 0|0 4 11 18 25 34 28 43 48 55 63" contenteditable> אבצ דעפ חיח abc def jih ופק ופק רסת </div>
<!-- test words not separated by spaces -->
<div style="white-space:pre" contenteditable dir=ltr class="test_move_by_word" title="0 1 2 3 4 9 10 11 17 21 24|24 21 17 11 10 9 4 3 2 1 0">人一氧喝大 笑抬的 abc def</div>
</div>
<pre id="console"></pre>
</body>
</html>