Changeset 91788 in webkit
- Timestamp:
- Jul 26, 2011 2:51:17 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91781 r91788 1 2011-07-26 Xiaomei Ji <xji@chromium.org> 2 3 --webkit-visual-word does not work in multi-line 4 https://bugs.webkit.org/show_bug.cgi?id=61344 5 6 Reviewed by Ryosuke Niwa. 7 8 Add test for multiple-line. 9 10 * editing/selection/move-by-word-visually-null-box.html: 11 * editing/selection/move-by-word-visually-others-expected.txt: 12 * editing/selection/move-by-word-visually-others.html: Add tests for multi-line. Shorten 13 test id. 14 * editing/selection/move-by-word-visually-single-space-sigle-line.html: Shorten test id. 15 * editing/selection/resources/move-by-word-visually.js: 16 (moveByWordForEveryPosition): 17 (setWidth): 18 (runMoveLeftRight): 19 1 20 2011-07-26 David Hyatt <hyatt@apple.com> 2 21 -
trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html
r91077 r91788 19 19 layoutTestController.dumpAsText(); 20 20 </script> 21 <div id="console"></div> 21 22 <div id="testMoveByWord"> 22 23 <output><div dir=ltr title="0|0" class="test_move_by_word"> 24 <div class="test_move_by_word" dir=ltr contenteditable title="0|0"></div> 25 00<base dir=ltr class="test_move_by_word" title="3|3 1"> 23 26 </div> 24 <div id="console"></div> -
trunk/LayoutTests/editing/selection/move-by-word-visually-others-expected.txt
r91077 r91788 224 224 Test 44, LTR: 225 225 Move right by one word 226 "abc def ghi jkl mn "[0, 4, 8, 12, 16], "opq rst uvw xyz"[0, 4, 8, 12] 227 Move left by one word 228 "opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0] 229 Test 45, LTR: 230 Move right by one word 231 "abc def ghi jkl mn "[0, 4, 8, 12, 16], "opq rst uvw xyz"[0, 4, 8, 12] 232 Move left by one word 233 "opq rst uvw xyz"[15, 12, 8, 4, 0], "abc def ghi jkl mn "[16, 12, 8, 4, 0] 234 Test 46, LTR: 235 Move right by one word 236 "AAA AAA AAA AAA "[0, 3, 8, 11], "AAA AAA AAA AAA"[0, 3, 8, 11] 237 Move left by one word 238 "AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0] 239 Test 47, LTR: 240 Move right by one word 241 "AAA AAA AAA AAA "[0, 3, 8, 11], "AAA AAA AAA AAA"[0, 3, 8, 11] 242 Move left by one word 243 "AAA AAA AAA AAA"[15, 11, 8, 3, 0], "AAA AAA AAA AAA "[11, 8, 3, 0] 244 Test 48, LTR: 245 Move right by one word 246 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25] 247 Move left by one word 248 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 12, 9, 5, 1] 249 Test 49, LTR: 250 Move right by one word 251 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 5, 9, 12, 17, 21, 25, 29, 33], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22, 25] 252 Move left by one word 253 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 12, 9, 5, 1] 254 Test 50, RTL: 255 Move left by one word 256 "abc def ghi jkl mn "[0, 3, 8, 11, 16], "opq rst uvw xyz"[0, 3, 8, 11] 257 Move right by one word 258 "opq rst uvw xyz"[15, 11, 8, 3, 0], "abc def ghi jkl mn "[16, 11, 8, 3, 0] 259 Test 51, RTL: 260 Move left by one word 261 "abc def ghi jkl mn "[0, 3, 8, 11, 16, 18], "opq rst uvw xyz"[0, 3, 8, 11] 262 Move right by one word 263 "opq rst uvw xyz"[15, 11, 8, 3, 0], "abc def ghi jkl mn "[18, 16, 11, 8, 3, 0] 264 Test 52, RTL: 265 Move left by one word 266 "AAA AAA AAA AAA "[0, 4, 8, 12], "AAA AAA AAA AAA"[0, 4, 8, 12] 267 Move right by one word 268 "AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0] 269 Test 53, RTL: 270 Move left by one word 271 "AAA AAA AAA AAA "[0, 4, 8, 12], "AAA AAA AAA AAA"[0, 4, 8, 12] 272 Move right by one word 273 "AAA AAA AAA AAA"[15, 12, 8, 4, 0], "AAA AAA AAA AAA "[12, 8, 4, 0] 274 Test 54, RTL: 275 Move left by one word 276 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22] 277 Move right by one word 278 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[33, 29, 25, 21, 17, 13, 9, 4, 1] 279 Test 55, RTL: 280 Move left by one word 281 " abc def AAA AAA hij AAA AAA uvw xyz "[1, 4, 9, 13, 17, 21, 25, 29, 33, 36], "AAA kj AAA mn opq AAA AAA"[0, 4, 7, 11, 14, 18, 22] 282 Move right by one word 283 "AAA kj AAA mn opq AAA AAA"[25, 22, 18, 14, 11, 7, 4, 0], " abc def AAA AAA hij AAA AAA uvw xyz "[36, 33, 29, 25, 21, 17, 13, 9, 4, 1] 284 Test 56, LTR: 285 Move right by one word 226 286 "abc def "[0, 4] 227 287 Move left by one word 228 288 " hij opq"[8, 5, 1] 229 Test 45, LTR: 289 Test 57, LTR: 290 Move right by one word 291 <DIV>[0] 292 Move left by one word 293 <DIV>[0] 294 Test 58, LTR: 230 295 Move right by one word 231 296 "\n00"[3] -
trunk/LayoutTests/editing/selection/move-by-word-visually-others.html
r91077 r91788 5 5 <link rel="stylesheet" type="text/css" href="resources/extend-selection.css" /> 6 6 <style> 7 test_move_by_word {display: none;}7 .fix_width {font-size: 10px; font-family: sans-serif;} 8 8 </style> 9 9 <script src="resources/move-by-word-visually.js"></script> … … 89 89 <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 21 17 11 10 9 4 3 2 1 0">人一氧喝大 笑抬的 abc def</div> 90 90 91 <!-- test multi-line --> 92 <div><span class="fix_width" id="span_size">אאא אאא</span></div> 93 <div contenteditable dir=ltr id="ml_1" class="test_move_by_word fix_width" title="[ml_1, 0][ml_1, 4][ml_1, 8][ml_1, 12][ml_1, 16][ml_1, 0, 5][ml_1, 4, 5][ml_1, 8, 5][ml_1, 12, 5]|[ml_1, 15, 5][ml_1, 12, 5][ml_1, 8, 5][ml_1, 4, 5][ml_1, 0, 5][ml_1, 16][ml_1, 12][ml_1, 8][ml_1, 4][ml_1, 0]">abc def ghi jkl mn <br/><br/><br/>opq rst uvw xyz</div> 94 95 <div contenteditable dir=ltr id="ml_2" class="test_move_by_word fix_width" title="[ml_2, 0][ml_2, 4][ml_2, 8][ml_2, 12][ml_2, 16][ml_2, 0, 5][ml_2, 4, 5][ml_2, 8, 5][ml_2, 12, 5]|[ml_2, 15, 5][ml_2, 12, 5][ml_2, 8, 5][ml_2, 4, 5][ml_2, 0, 5][ml_2, 16][ml_2, 12][ml_2, 8][ml_2, 4][ml_2, 0]">abc def ghi jkl mn <div><br/></div><div><br/></div><div><br/></div>opq rst uvw xyz</div> 96 97 <div contenteditable dir=ltr id="ml_3" class="test_move_by_word fix_width" title="[ml_3, 0][ml_3, 3][ml_3, 8][ml_3, 11]][ml_3, 0, 5][ml_3, 3, 5][ml_3, 8, 5][ml_3, 11, 5]|[ml_3, 15, 5][ml_3, 11, 5][ml_3, 8, 5][ml_3, 3, 5][ml_3, 0, 5][ml_3, 11][ml_3, 8][ml_3, 3][ml_3, 0]">אאא אאא אאא אאא <br/><br/><br/>אאא אאא אאא אאא</div> 98 99 <div contenteditable dir=ltr id="ml_4" class="test_move_by_word fix_width" title="[ml_4, 0][ml_4, 3][ml_4, 8][ml_4, 11][ml_4, 0, 5][ml_4, 3, 5][ml_4, 8, 5][ml_4, 11, 5]|[ml_4, 15, 5][ml_4, 11, 5][ml_4, 8, 5][ml_4, 3, 5][ml_4, 0, 5][ml_4, 11][ml_4, 8][ml_4, 3][ml_4, 0]">אאא אאא אאא אאא <div><br/></div><div><br/></div><div><br/></div>אאא אאא אאא אאא</div> 100 101 <div contenteditable dir=ltr id="ml_5" class="test_move_by_word fix_width" title="[ml_5, 1][ml_5, 5][ml_5, 9][ml_5, 12][ml_5, 17][ml_5, 21][ml_5, 25][ml_5, 29][ml_5, 33][ml_5, 0, 5][ml_5, 4, 5][ml_5, 7, 5][ml_5, 11, 5][ml_5, 14, 5][ml_5, 18, 5][ml_5, 22, 5][ml_5, 25, 5]|[ml_5, 25, 5][ml_5, 22, 5][ml_5, 18, 5][ml_5, 14, 5][ml_5, 11, 5][ml_5, 7, 5][ml_5, 4, 5][ml_5, 0, 5][ml_5, 33][ml_5, 29][ml_5, 25][ml_5, 21][ml_5, 17][ml_5, 12][ml_5, 9][ml_5, 5][ml_5, 1]"> abc def אאא אאא hij אאא אאא uvw xyz <br/><br/><br/>אאא kj אאא mn opq אאא אאא</div> 102 103 <div contenteditable dir=ltr id="ml_6" class="test_move_by_word fix_width" title="[ml_6, 1][ml_6, 5][ml_6, 9][ml_6, 12][ml_6, 17][ml_6, 21][ml_6, 25][ml_6, 29][ml_6, 33][ml_6, 0, 5][ml_6, 4, 5][ml_6, 7, 5][ml_6, 11, 5][ml_6, 14, 5][ml_6, 18, 5][ml_6, 22, 5][ml_6, 25, 5]|[ml_6, 25, 5][ml_6, 22, 5][ml_6, 18, 5][ml_6, 14, 5][ml_6, 11, 5][ml_6, 7, 5][ml_6, 4, 5][ml_6, 0, 5][ml_6, 33][ml_6, 29][ml_6, 25][ml_6, 21][ml_6, 17][ml_6, 12][ml_6, 9][ml_6, 5][ml_6, 1]"> abc def אאא אאא hij אאא אאא uvw xyz <div><br/></div><div><br/></div><div><br/></div>אאא kj אאא mn opq אאא אאא</div> 104 105 106 <div contenteditable dir=rtl id="ml_7" class="test_move_by_word fix_width" title="[ml_7, 15, 5][ml_7, 11, 5][ml_7, 8, 5][ml_7, 3, 5][ml_7, 0, 5][ml_7, 16][ml_7, 11][ml_7, 8][ml_7, 3][ml_7, 0]|[ml_7, 0][ml_7, 3][ml_7, 8][ml_7, 11][ml_7, 16][ml_7, 0, 5][ml_7, 3, 5][ml_7, 8, 5][ml_7, 11, 5]">abc def ghi jkl mn <br/><br/><br/>opq rst uvw xyz</div> 107 108 <div contenteditable dir=rtl id="ml_8" class="test_move_by_word fix_width" title="[ml_8, 15, 5][ml_8, 11, 5][ml_8, 8, 5][ml_8, 3, 5][ml_8, 0, 5][ml_8, 18][ml_8, 16][ml_8, 11][ml_8, 8][ml_8, 3][ml_8, 0]|[ml_8, 0][ml_8, 3][ml_8, 8][ml_8, 11][ml_8, 16][ml_8, 18][ml_8, 0, 5][ml_8, 3, 5][ml_8, 8, 5][ml_8, 11, 5]">abc def ghi jkl mn <div><br/></div><div><br/></div><div><br/></div>opq rst uvw xyz</div> 109 110 <div contenteditable dir=rtl id="ml_9" class="test_move_by_word fix_width" title="[ml_9, 15, 5][ml_9, 12, 5][ml_9, 8, 5][ml_9, 4, 5][ml_9, 0, 5][ml_9, 12][ml_9, 8][ml_9, 4][ml_9, 0]|[ml_9, 0][ml_9, 4][ml_9, 8][ml_9, 12][ml_9, 0, 5][ml_9, 4, 5][ml_9, 8, 5][ml_9, 12, 5]">אאא אאא אאא אאא <br/><br/><br/>אאא אאא אאא אאא</div> 111 112 <div contenteditable dir=rtl id="ml_10" class="test_move_by_word fix_width" title="[ml_10, 15, 5][ml_10, 12, 5][ml_10, 8, 5][ml_10, 4, 5][ml_10, 0, 5][ml_10, 12][ml_10, 8][ml_10, 4][ml_10, 0]|[ml_10, 0][ml_10, 4][ml_10, 8][ml_10, 12][ml_10, 0, 5][ml_10, 4, 5][ml_10, 8, 5][ml_10, 12, 5]">אאא אאא אאא אאא <div><br/></div><div><br/></div><div><br/></div>אאא אאא אאא אאא</div> 113 114 <div contenteditable dir=rtl id="ml_11" class="test_move_by_word fix_width" title=" 115 [ml_11, 25, 5][ml_11, 22, 5][ml_11, 18, 5][ml_11, 14, 5][ml_11, 11, 5][ml_11, 7, 5][ml_11, 4, 5][ml_11, 0, 5][ml_11, 33][ml_11, 29][ml_11, 25][ml_11, 21][ml_11, 17][ml_11, 13][ml_11, 9][ml_11, 4][ml_11, 1]|[ml_11, 1][ml_11, 4][ml_11, 9][ml_11, 13][ml_11, 17][ml_11, 21][ml_11, 25][ml_11, 29][ml_11, 33][ml_11, 0, 5][ml_11, 4, 5][ml_11, 7, 5][ml_11, 11, 5][ml_11, 14, 5][ml_11, 18, 5][ml_11, 22, 5] 116 "> abc def אאא אאא hij אאא אאא uvw xyz <br/><br/><br/>אאא kj אאא mn opq אאא אאא</div> 117 118 <div contenteditable dir=rtl id="ml_12" class="test_move_by_word fix_width" title=" 119 [ml_12, 25, 5][ml_12, 22, 5][ml_12, 18, 5][ml_12, 14, 5][ml_12, 11, 5][ml_12, 7, 5][ml_12, 4, 5][ml_12, 0, 5][ml_12, 36][ml_12, 33][ml_12, 29][ml_12, 25][ml_12, 21][ml_12, 17][ml_12, 13][ml_12, 9][ml_12, 4][ml_12, 1]|[ml_12, 1][ml_12, 4][ml_12, 9][ml_12, 13][ml_12, 17][ml_12, 21][ml_12, 25][ml_12, 29][ml_12, 33][ml_12, 36][ml_12, 0, 5][ml_12, 4, 5][ml_12, 7, 5][ml_12, 11, 5][ml_12, 14, 5][ml_12, 18, 5][ml_12, 22, 5] 120 "> abc def אאא אאא hij אאא אאא uvw xyz <div><br/></div><div><br/></div><div><br/></div>אאא kj אאא mn opq אאא אאא</div> 121 91 122 <!-- mixed editability --> 92 123 <div dir=ltr class="test_move_by_word" title="0 4|8 5 1">abc def <span contenteditable> inside span </span> hij opq</div> 93 124 94 <div dir=ltr contenteditable></div> 125 <div class="test_move_by_word" contenteditable dir=ltr title="0|0"></div> 126 127 <div contenteditable> 95 128 00<base dir=ltr class="test_move_by_word" title="3|3 1"> 129 </div> 96 130 97 131 </div> -
trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-sigle-line.html
r88393 r91788 65 65 66 66 <!-- Inline element --> 67 <div dir=ltr id="d iv_1" class="test_move_by_word" title="[div_1, 0][div_1, 3]|[span_1, 2][div_1, 3][div_1,0]" contenteditable>אאא <span id="span_1">בב</span></div>68 <div dir=rtl id="d iv_2" class="test_move_by_word" title="[span_2, 2][div_2, 4][div_2, 0]|[div_2, 0][div_2, 4]" contenteditable>אאא <span id="span_2">בב</span></div>67 <div dir=ltr id="d_1" class="test_move_by_word" title="[d_1, 0][d_1, 3]|[s_1, 2][d_1, 3][d_1,0]" contenteditable>אאא <span id="s_1">בב</span></div> 68 <div dir=rtl id="d_2" class="test_move_by_word" title="[s_2, 2][d_2, 4][d_2, 0]|[d_2, 0][d_2, 4]" contenteditable>אאא <span id="s_2">בב</span></div> 69 69 70 70 <!-- pure English in inline element with same or different directionality from its parent --> 71 <div dir=ltr id="d iv_3" class="test_move_by_word" title="[div_3, 0][div_3, 4][div_3, 8][span_3, 4][div_3, 1, 3][div_3, 5, 3]|[div_3, 8, 3][div_3, 5, 3][div_3, 1, 3][span_3, 4][div_3, 8][div_3, 4][div_3, 0]" contenteditable>abc def <span id="span_3">hij opq</span> rst uvw</div>71 <div dir=ltr id="d_3" class="test_move_by_word" title="[d_3, 0][d_3, 4][d_3, 8][s_3, 4][d_3, 1, 3][d_3, 5, 3]|[d_3, 8, 3][d_3, 5, 3][d_3, 1, 3][s_3, 4][d_3, 8][d_3, 4][d_3, 0]" contenteditable>abc def <span id="s_3">hij opq</span> rst uvw</div> 72 72 73 73 <!-- FAILED --> 74 <div dir=rtl id="d iv_4" class="test_move_by_word" title="[div_4, 8, 3][div_4, 3, 1][div_4, 7, 1][span_4, 3, 1][span_4, 7, 1][div_4, 4, 3][div_4, 0, 1]|[div_4, 0, 1][div_4, 4, 3][span_4, 7, 1][span_4, 3, 1][div_4, 7, 1][div_4, 3, 1]" contenteditable>abc def <span id="span_4">hij opq</span> rst uvw</div>74 <div dir=rtl id="d_4" class="test_move_by_word" title="[d_4, 8, 3][d_4, 3, 1][d_4, 7, 1][s_4, 3, 1][s_4, 7, 1][d_4, 4, 3][d_4, 0, 1]|[d_4, 0, 1][d_4, 4, 3][s_4, 7, 1][s_4, 3, 1][d_4, 7, 1][d_4, 3, 1]" contenteditable>abc def <span id="s_4">hij opq</span> rst uvw</div> 75 75 76 <!-- FAILED. The render result is the same as d iv_4. -->77 <div id="d iv_5" dir=rtl class="test_move_by_word" title="[div_5, 8, 3][div_5, 3, 1][div_5, 7, 1][span_5, 3, 1][span_5, 7, 1][div_5, 4, 3][div_5, 0, 1]|[div_5, 0, 1][div_5, 4, 3][span_5, 7, 1][span_5, 3, 1][div_5, 7, 1][div_5, 3, 1]"contenteditable>abc def <span dir=ltr id="span_5">hij opq</span> rst uvw</div>76 <!-- FAILED. The render result is the same as d_4. --> 77 <div id="d_5" dir=rtl class="test_move_by_word" title="[d_5, 8, 3][d_5, 3, 1][d_5, 7, 1][s_5, 3, 1][s_5, 7, 1][d_5, 4, 3][d_5, 0, 1]|[d_5, 0, 1][d_5, 4, 3][s_5, 7, 1][s_5, 3, 1][d_5, 7, 1][d_5, 3, 1]"contenteditable>abc def <span dir=ltr id="s_5">hij opq</span> rst uvw</div> 78 78 79 <div id="d iv_6" dir=ltr class="test_move_by_word" title="[div_6, 0, 1][div_6, 4, 1][div_6, 8, 1][span_6, 4, 1][div_6, 1, 3][div_6, 5, 3]|[div_6, 8, 3][div_6, 5, 3][div_6, 1, 3][span_6, 4, 1][div_6, 8, 1][div_6, 4, 1][div_6, 0, 1]" contenteditable>abc def <span dir=rtl id="span_6">hij opq</span> rst uvw</div>79 <div id="d_6" dir=ltr class="test_move_by_word" title="[d_6, 0, 1][d_6, 4, 1][d_6, 8, 1][s_6, 4, 1][d_6, 1, 3][d_6, 5, 3]|[d_6, 8, 3][d_6, 5, 3][d_6, 1, 3][s_6, 4, 1][d_6, 8, 1][d_6, 4, 1][d_6, 0, 1]" contenteditable>abc def <span dir=rtl id="s_6">hij opq</span> rst uvw</div> 80 80 81 81 <!-- pure Hebrew in inline element with same or different directionality from its parent --> 82 82 83 <div id="d iv_7" dir=rtl class="test_move_by_word" title="[div_7, 7, 3][div_7, 4, 3][span_7, 4, 1][div_7, 8, 1][div_7, 4, 1][div_7, 0, 1]|[div_7, 0, 1][div_7, 4, 1][div_7, 8, 1][span_7, 4, 1][div_7, 4, 3]" contenteditable>אבד דעפ <span dir=ltr id="span_7">היח ופק</span>ווש כטז</div>83 <div id="d_7" dir=rtl class="test_move_by_word" title="[d_7, 7, 3][d_7, 4, 3][s_7, 4, 1][d_7, 8, 1][d_7, 4, 1][d_7, 0, 1]|[d_7, 0, 1][d_7, 4, 1][d_7, 8, 1][s_7, 4, 1][d_7, 4, 3]" contenteditable>אבד דעפ <span dir=ltr id="s_7">היח ופק</span>ווש כטז</div> 84 84 85 <div id="d iv_8" dir=ltr class="test_move_by_word" title="[div_8, 0, 1][div_8, 3, 3][span_8, 3, 1][div_8, 7, 1][div_8, 3, 1]|[div_8, 7, 3][div_8, 3, 1][div_8, 7, 1][span_8, 3, 1][div_8, 3, 3][div_8, 0, 1]" contenteditable>אבד דעפ <span dir=rtl id="span_8">היח ופק</span>ווש כטז</div>85 <div id="d_8" dir=ltr class="test_move_by_word" title="[d_8, 0, 1][d_8, 3, 3][s_8, 3, 1][d_8, 7, 1][d_8, 3, 1]|[d_8, 7, 3][d_8, 3, 1][d_8, 7, 1][s_8, 3, 1][d_8, 3, 3][d_8, 0, 1]" contenteditable>אבד דעפ <span dir=rtl id="s_8">היח ופק</span>ווש כטז</div> 86 86 87 <div id="d iv_9" dir=rtl class="test_move_by_word" title="[div_9, 7, 3][div_9, 4, 3][span_9, 4, 1][div_9, 8, 1][div_9, 4, 1][div_9, 0, 1]|[div_9, 0, 1][div_9, 4, 1][div_9, 8, 1][span_9, 4, 1][div_9, 4, 3]" contenteditable>אבד דעפ <span id="span_9">היח ופק</span>ווש כטז</div>87 <div id="d_9" dir=rtl class="test_move_by_word" title="[d_9, 7, 3][d_9, 4, 3][s_9, 4, 1][d_9, 8, 1][d_9, 4, 1][d_9, 0, 1]|[d_9, 0, 1][d_9, 4, 1][d_9, 8, 1][s_9, 4, 1][d_9, 4, 3]" contenteditable>אבד דעפ <span id="s_9">היח ופק</span>ווש כטז</div> 88 88 89 <div id="d iv_10" dir=ltr class="test_move_by_word" title="[div_10, 0, 1][div_10, 3, 3][span_10, 3, 1][div_10, 7, 1][div_10, 3, 1]|[div_10, 7, 3][div_10, 3, 1][div_10, 7, 1][span_10, 3, 1][div_10, 3, 3][div_10, 0, 1]" contenteditable>אבד דעפ <span id="span_10">היח ופק</span>ווש כטז</div>89 <div id="d_10" dir=ltr class="test_move_by_word" title="[d_10, 0, 1][d_10, 3, 3][s_10, 3, 1][d_10, 7, 1][d_10, 3, 1]|[d_10, 7, 3][d_10, 3, 1][d_10, 7, 1][s_10, 3, 1][d_10, 3, 3][d_10, 0, 1]" contenteditable>אבד דעפ <span id="s_10">היח ופק</span>ווש כטז</div> 90 90 91 91 <!-- bidi in inline element with same or different directionality from its parent --> 92 <div id="d iv_11" dir=rtl class="test_move_by_word" title="[div_11, 7, 3][div_11, 4, 3][span_11, 3, 1][div_11, 8, 1][div_11, 4, 1][div_11, 0, 1]|[div_11, 0, 1][div_11, 4, 1][div_11, 8, 1][span_11, 3, 1][div_11, 4, 3]" contenteditable>אבד דעפ <span dir=ltr id="span_11">abc def</span>ווש כטז</div>92 <div id="d_11" dir=rtl class="test_move_by_word" title="[d_11, 7, 3][d_11, 4, 3][s_11, 3, 1][d_11, 8, 1][d_11, 4, 1][d_11, 0, 1]|[d_11, 0, 1][d_11, 4, 1][d_11, 8, 1][s_11, 3, 1][d_11, 4, 3]" contenteditable>אבד דעפ <span dir=ltr id="s_11">abc def</span>ווש כטז</div> 93 93 94 94 <!-- FAIL --> 95 <div id="d iv_12" dir=ltr class="test_move_by_word" title="[div_12, 0, 1][div_12, 3, 3][div_12, 8, 1][span_12, 4, 1][div_12, 7, 1][div_12, 3, 1]|[div_12, 7, 3][div_12, 3, 1][div_12, 7, 1][span_12, 4, 1][div_12, 8, 1][div_12, 3, 3][div_12, 0]" contenteditable>אבד דעפ <span dir=rtl id="span_12">abc def</span>ווש כטז</div>95 <div id="d_12" dir=ltr class="test_move_by_word" title="[d_12, 0, 1][d_12, 3, 3][d_12, 8, 1][s_12, 4, 1][d_12, 7, 1][d_12, 3, 1]|[d_12, 7, 3][d_12, 3, 1][d_12, 7, 1][s_12, 4, 1][d_12, 8, 1][d_12, 3, 3][d_12, 0]" contenteditable>אבד דעפ <span dir=rtl id="s_12">abc def</span>ווש כטז</div> 96 96 97 <div id="d iv_13" dir=rtl class="test_move_by_word" title="[div_13, 7, 3][div_13, 4, 3][span_13, 3, 1][div_13, 8, 1][div_13, 4, 1][div_13, 0, 1]|[div_13, 0, 1][div_13, 4, 1][div_13, 8, 1][span_13, 3, 1][div_13, 4, 3]" contenteditable>אבד דעפ <span id="span_13">abc def</span>ווש כטז</div>97 <div id="d_13" dir=rtl class="test_move_by_word" title="[d_13, 7, 3][d_13, 4, 3][s_13, 3, 1][d_13, 8, 1][d_13, 4, 1][d_13, 0, 1]|[d_13, 0, 1][d_13, 4, 1][d_13, 8, 1][s_13, 3, 1][d_13, 4, 3]" contenteditable>אבד דעפ <span id="s_13">abc def</span>ווש כטז</div> 98 98 99 <div id="d iv_14" dir=ltr class="test_move_by_word" title="[div_14, 0, 1][div_14, 3, 1][div_14, 8, 1][span_14, 4, 1][div_14, 3, 3]|[div_14, 7, 3][div_14, 3, 3][span_14, 4, 1][div_14, 8, 1][div_14, 3, 1][div_14, 0, 1]" contenteditable>אבד דעפ <span id="span_14">abc def</span>ווש כטז</div>99 <div id="d_14" dir=ltr class="test_move_by_word" title="[d_14, 0, 1][d_14, 3, 1][d_14, 8, 1][s_14, 4, 1][d_14, 3, 3]|[d_14, 7, 3][d_14, 3, 3][s_14, 4, 1][d_14, 8, 1][d_14, 3, 1][d_14, 0, 1]" contenteditable>אבד דעפ <span id="s_14">abc def</span>ווש כטז</div> 100 100 101 101 <!-- FAILED --> 102 <div id="d iv_15" dir=rtl class="test_move_by_word" title="[div_15, 11, 3][div_15, 8, 3][div_15, 4, 3][span_15, 3, 1][span_15, 4, 1][div_15, 12, 1][div_15, 8, 1][div_15, 4, 1][div_15, 0, 1]|[div_15, 0, 1][div_15, 4, 1][div_15, 8, 1][div_15, 12, 1][span_15, 4, 1][span_15, 3, 1][div_15, 4, 3][div_15, 8, 3]" contenteditable>אבד opq דעפ <span dir=ltr id="span_15">abc אאא def</span>ווש rst כטז</div>102 <div id="d_15" dir=rtl class="test_move_by_word" title="[d_15, 11, 3][d_15, 8, 3][d_15, 4, 3][s_15, 3, 1][s_15, 4, 1][d_15, 12, 1][d_15, 8, 1][d_15, 4, 1][d_15, 0, 1]|[d_15, 0, 1][d_15, 4, 1][d_15, 8, 1][d_15, 12, 1][s_15, 4, 1][s_15, 3, 1][d_15, 4, 3][d_15, 8, 3]" contenteditable>אבד opq דעפ <span dir=ltr id="s_15">abc אאא def</span>ווש rst כטז</div> 103 103 104 104 <!-- FAILED, and wrong printing result --> 105 <div id="d iv_16" dir=ltr class="test_move_by_word" title="[div_16, 0, 1][div_16, 4, 1][div_16, 8, 1][span_16, 8, 1][span_16, 7, 1][div_16, 12, 1][div_16, 11, 1][div_16, 4, 3][div_16, 8, 3][div_16, 11, 3]|[div_16, 11, 3][div_16, 8, 3][div_16, 4, 3][div_16, 11, 1][div_16, 12, 1][span_16, 7, 1][span_16, 8, 1][div_16, 8, 1][div_16, 4, 1][div_16, 0, 1]" contenteditable>אבד opq דעפ <span dir=rtl id="span_16">abc אאא def</span>ווש rst כטז</div>105 <div id="d_16" dir=ltr class="test_move_by_word" title="[d_16, 0, 1][d_16, 4, 1][d_16, 8, 1][s_16, 8, 1][s_16, 7, 1][d_16, 12, 1][d_16, 11, 1][d_16, 4, 3][d_16, 8, 3][d_16, 11, 3]|[d_16, 11, 3][d_16, 8, 3][d_16, 4, 3][d_16, 11, 1][d_16, 12, 1][s_16, 7, 1][s_16, 8, 1][d_16, 8, 1][d_16, 4, 1][d_16, 0, 1]" contenteditable>אבד opq דעפ <span dir=rtl id="s_16">abc אאא def</span>ווש rst כטז</div> 106 106 107 107 <!-- FAILED --> 108 <div id="d iv_17" dir=rtl class="test_move_by_word" title="[div_17, 11, 3][div_17, 8, 3][div_17, 4, 3][span_17, 8, 1][span_17, 4, 1][div_17, 12, 1][div_17, 8, 1][div_17, 4, 1][div_17, 0, 1]|[div_17, 0, 1][div_17, 4, 1][div_17, 8, 1][div_17, 12, 1][span_17, 4, 1][span_17, 8, 1][div_17, 4, 3][div_17, 8, 3]" contenteditable>אבד opq דעפ <span id="span_17">abc אאא def</span>ווש rst כטז</div>108 <div id="d_17" dir=rtl class="test_move_by_word" title="[d_17, 11, 3][d_17, 8, 3][d_17, 4, 3][s_17, 8, 1][s_17, 4, 1][d_17, 12, 1][d_17, 8, 1][d_17, 4, 1][d_17, 0, 1]|[d_17, 0, 1][d_17, 4, 1][d_17, 8, 1][d_17, 12, 1][s_17, 4, 1][s_17, 8, 1][d_17, 4, 3][d_17, 8, 3]" contenteditable>אבד opq דעפ <span id="s_17">abc אאא def</span>ווש rst כטז</div> 109 109 110 <div id="d iv_18" dir=ltr class="test_move_by_word" title="[div_18, 0, 1][div_18, 4, 1][div_18, 8, 1][div_18, 12, 1][span_18, 4, 1][span_18, 8, 1][div_18, 4, 3][div_18, 8, 3][div_18, 11, 3]|[div_18, 11, 3][div_18, 8, 3][div_18, 4, 3][span_18, 8, 1][span_18, 4, 1][div_18, 12, 1][div_18, 8, 1][div_18, 4, 1][div_18, 0, 1]" contenteditable>אבד opq דעפ <span id="span_18">abc אאא def</span>ווש rst כטז</div>110 <div id="d_18" dir=ltr class="test_move_by_word" title="[d_18, 0, 1][d_18, 4, 1][d_18, 8, 1][d_18, 12, 1][s_18, 4, 1][s_18, 8, 1][d_18, 4, 3][d_18, 8, 3][d_18, 11, 3]|[d_18, 11, 3][d_18, 8, 3][d_18, 4, 3][s_18, 8, 1][s_18, 4, 1][d_18, 12, 1][d_18, 8, 1][d_18, 4, 1][d_18, 0, 1]" contenteditable>אבד opq דעפ <span id="s_18">abc אאא def</span>ווש rst כטז</div> 111 111 112 <div id="d iv_19" dir=ltr class="test_move_by_word" title="[div_19, 0, 1][div_19, 4, 1][span_19, 4, 1][span_19, 7, 1]|[div_19, 3, 3][span_19, 7, 1][span_19, 4, 1][div_19, 4, 1][div_19, 0, 1]" contenteditable>aaa <span id="span_19">bbb אאא </span>ווש</div>112 <div id="d_19" dir=ltr class="test_move_by_word" title="[d_19, 0, 1][d_19, 4, 1][s_19, 4, 1][s_19, 7, 1]|[d_19, 3, 3][s_19, 7, 1][s_19, 4, 1][d_19, 4, 1][d_19, 0, 1]" contenteditable>aaa <span id="s_19">bbb אאא </span>ווש</div> 113 113 114 <div id="d iv_20" dir=rtl class="test_move_by_word" title="[div_20, 15, 3][div_20, 12, 3][div_20, 7, 3][div_20, 4, 3][span_20, 3, 1][span_20, 7, 1][span_20, 8, 1][span_20, 15, 1][div_20, 16, 1][div_20, 12, 1][div_20, 7, 1][div_20, 4, 1][div_20, 0, 1]|[div_20, 0, 1][div_20, 4, 1][div_20, 7, 1][div_20, 12, 1][div_20, 16, 1][span_20, 15, 1][span_20, 8, 1][span_20, 7, 1][span_20, 3, 1][div_20, 4, 3][div_20, 7, 3][div_20, 12, 3]" contenteditable>אבד opq rst דעפ <span dir=ltr id="span_20">abc uvw אאא def lmn</span>אבצ hij xyz וקק</div>114 <div id="d_20" dir=rtl class="test_move_by_word" title="[d_20, 15, 3][d_20, 12, 3][d_20, 7, 3][d_20, 4, 3][s_20, 3, 1][s_20, 7, 1][s_20, 8, 1][s_20, 15, 1][d_20, 16, 1][d_20, 12, 1][d_20, 7, 1][d_20, 4, 1][d_20, 0, 1]|[d_20, 0, 1][d_20, 4, 1][d_20, 7, 1][d_20, 12, 1][d_20, 16, 1][s_20, 15, 1][s_20, 8, 1][s_20, 7, 1][s_20, 3, 1][d_20, 4, 3][d_20, 7, 3][d_20, 12, 3]" contenteditable>אבד opq rst דעפ <span dir=ltr id="s_20">abc uvw אאא def lmn</span>אבצ hij xyz וקק</div> 115 115 116 116 </div> -
trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js
r88393 r91788 227 227 228 228 sel.modify("move", "forward", "lineBoundary"); 229 var position = { node: sel.anchorNode, offset: sel.anchorOffset }; 230 229 231 // Check ctrl-left-arrow works for every position. 230 232 if (dir == "ltr") … … 233 235 direction = "right"; 234 236 moveByWord(sel, test, direction, dir); 235 sel.modify("move", "forward", "lineBoundary"); 237 238 sel.setPosition(position.node, position.offset); 236 239 moveByWordOnEveryChar(sel, test, direction, dir); 240 } 241 242 function setWidth(test) 243 { 244 if (test.className.search("fix_width") != -1) { 245 var span = document.getElementById("span_size"); 246 var length = span.offsetWidth; 247 test.style.width = length + "px"; 248 } 237 249 } 238 250 … … 243 255 var positionsMovingRight; 244 256 var positionsMovingLeft; 257 258 setWidth(tests[i]); 245 259 246 260 if (tests[i].getAttribute("dir") == 'ltr') -
trunk/Source/WebCore/ChangeLog
r91781 r91788 1 2011-07-26 Xiaomei Ji <xji@chromium.org> 2 3 --webkit-visual-word does not work in multi-line 4 https://bugs.webkit.org/show_bug.cgi?id=61344 5 6 Reviewed by Ryosuke Niwa. 7 8 Replace Position(node, offset, PositionIsOffsetInAnchor) with 9 createPositionAvoidingIgnoredNode(node, offset) which takes care of creating position 10 before/after <br/> etc. editingIgnoresContent node. 11 12 When iterate InlineBox, replace prevLeafChild and nextLeafChild (which only returns 13 InlineBox within the same line) with leftInlineBox and rightInlineBox (which returns 14 InlineBox across multiple lines). 15 16 * editing/htmlediting.cpp: 17 (WebCore::createPositionAvoidingIgnoredNode): 18 * editing/htmlediting.h: 19 * editing/visible_units.cpp: 20 (WebCore::previousWordBreakInBoxInsideBlockWithSameDirectionality): Replace Position() with 21 createPositionAvoidingIgnoredNode(). 22 (WebCore::leftmostPositionInRTLBoxInLTRBlock): Ditto. 23 (WebCore::rightmostPositionInLTRBoxInRTLBlock): Ditto. 24 (WebCore::nextWordBreakInBoxInsideBlockWithDifferentDirectionality): Ditto. 25 (WebCore::blockWithPreviousLineBox): Added. 26 (WebCore::previousRootInlineBox): Added. 27 (WebCore::blockWithNextLineBox): Added. 28 (WebCore::nextRootInlineBox): Added. 29 (WebCore::leftInlineBox): Added. 30 (WebCore::rightInlineBox): Added. 31 (WebCore::leftWordBoundary): Replace prevLeafChild/nextLeafChild with leftInlineBox() 32 and rightInlineBox(). 33 (WebCore::rightWordBoundary): Ditto. 34 (WebCore::leftWordPositionAcrossBoundary): Ditto. 35 (WebCore::rightWordPositionAcrossBoundary): Ditto. 36 1 37 2011-07-26 David Hyatt <hyatt@apple.com> 2 38 -
trunk/Source/WebCore/editing/htmlediting.cpp
r90885 r91788 1138 1138 } 1139 1139 1140 Position createPositionAvoidingIgnoredNode(Node* node, int offset) 1141 { 1142 if (!node) 1143 return Position(); 1144 if (!node->isTextNode()) { 1145 // FIXME: the pass-in offset is the caretMinOffset() or caretMaxOffset() of box. 1146 // caretMaxOffset could be 1 for replacedElement, br, and hr. 1147 // We should get rid of this offset checking code after we get rid of legacy editing 1148 // position in rendering code. 1149 if (!offset) 1150 return positionBeforeNode(node); 1151 ASSERT(offset == 1); 1152 return positionAfterNode(node); 1153 } 1154 return Position(static_cast<Text*>(node), offset); 1155 } 1156 1140 1157 } // namespace WebCore -
trunk/Source/WebCore/editing/htmlediting.h
r90885 r91788 142 142 } 143 143 144 Position createPositionAvoidingIgnoredNode(Node*, int offset); 145 144 146 // comparision functions on Position 145 147 -
trunk/Source/WebCore/editing/visible_units.cpp
r91395 r91788 1199 1199 wordBreak = previousWordBreak; 1200 1200 else { 1201 wordBreak = Position(box->renderer()->node(), box->caretMaxOffset(), Position::PositionIsOffsetInAnchor); 1201 wordBreak = createPositionAvoidingIgnoredNode(box->renderer()->node(), box->caretMaxOffset()); 1202 1202 1203 // Return the rightmost word boundary of LTR box or leftmost word boundary of RTL box if 1203 1204 // it is not in the previously visited boxes. For example, given a logical text … … 1211 1212 if ((box->isLeftToRightDirection() && box->nextLeafChild()) 1212 1213 || (!box->isLeftToRightDirection() && box->prevLeafChild())) { 1213 1214 1214 1215 VisiblePosition positionAfterWord = nextBoundary(wordBreak, nextWordPositionBoundary); 1215 1216 if (positionAfterWord.isNotNull()) { … … 1237 1238 1238 1239 if (previousLeaf && !previousLeaf->isLeftToRightDirection()) 1239 return Position(node, box->caretMaxOffset(), Position::PositionIsOffsetInAnchor);1240 return createPositionAvoidingIgnoredNode(node, box->caretMaxOffset()); 1240 1241 1241 1242 if (nextLeaf && !nextLeaf->isLeftToRightDirection()) { 1242 1243 if (previousLeaf) 1243 return Position(previousLeaf->renderer()->node(), previousLeaf->caretMaxOffset(), Position::PositionIsOffsetInAnchor);1244 return createPositionAvoidingIgnoredNode(previousLeaf->renderer()->node(), previousLeaf->caretMaxOffset()); 1244 1245 1245 1246 InlineBox* lastRTLLeaf; … … 1248 1249 nextLeaf = nextLeaf->nextLeafChild(); 1249 1250 } while (nextLeaf && !nextLeaf->isLeftToRightDirection()); 1250 return Position(lastRTLLeaf->renderer()->node(), lastRTLLeaf->caretMinOffset(), Position::PositionIsOffsetInAnchor);1251 } 1252 1253 return Position(node, box->caretMinOffset(), Position::PositionIsOffsetInAnchor);1251 return createPositionAvoidingIgnoredNode(lastRTLLeaf->renderer()->node(), lastRTLLeaf->caretMinOffset()); 1252 } 1253 1254 return createPositionAvoidingIgnoredNode(node, box->caretMinOffset()); 1254 1255 } 1255 1256 … … 1262 1263 1263 1264 if (nextLeaf && nextLeaf->isLeftToRightDirection()) 1264 return Position(node, box->caretMaxOffset(), Position::PositionIsOffsetInAnchor);1265 return createPositionAvoidingIgnoredNode(node, box->caretMaxOffset()); 1265 1266 1266 1267 if (previousLeaf && previousLeaf->isLeftToRightDirection()) { 1267 1268 if (nextLeaf) 1268 return Position(nextLeaf->renderer()->node(), nextLeaf->caretMaxOffset(), Position::PositionIsOffsetInAnchor);1269 return createPositionAvoidingIgnoredNode(nextLeaf->renderer()->node(), nextLeaf->caretMaxOffset()); 1269 1270 1270 1271 InlineBox* firstLTRLeaf; … … 1273 1274 previousLeaf = previousLeaf->prevLeafChild(); 1274 1275 } while (previousLeaf && previousLeaf->isLeftToRightDirection()); 1275 return Position(firstLTRLeaf->renderer()->node(), firstLTRLeaf->caretMinOffset(), Position::PositionIsOffsetInAnchor);1276 } 1277 1278 return Position(node, box->caretMinOffset(), Position::PositionIsOffsetInAnchor);1276 return createPositionAvoidingIgnoredNode(firstLTRLeaf->renderer()->node(), firstLTRLeaf->caretMinOffset()); 1277 } 1278 1279 return createPositionAvoidingIgnoredNode(node, box->caretMinOffset()); 1279 1280 } 1280 1281 … … 1321 1322 1322 1323 bool hasSeenWordBreakInThisBox = previousWordBreak.isNotNull(); 1323 VisiblePosition wordBreak = hasSeenWordBreakInThisBox ? previousWordBreak : Position(box->renderer()->node(), box->caretMinOffset(), Position::PositionIsOffsetInAnchor); 1324 VisiblePosition wordBreak = hasSeenWordBreakInThisBox ? previousWordBreak : 1325 createPositionAvoidingIgnoredNode(box->renderer()->node(), box->caretMinOffset()); 1326 1324 1327 wordBreak = nextBoundary(wordBreak, nextWordPositionBoundary); 1325 1328 … … 1476 1479 } 1477 1480 1481 static const RenderBlock* blockWithPreviousLineBox(const RenderBlock* startingBlock) 1482 { 1483 for (const RenderBlock* block = startingBlock; block; block = toRenderBlock(block->previousSibling())) { 1484 if (block->childrenInline()) { 1485 if (block->firstRootBox()) 1486 return block; 1487 } else if (const RenderBlock* renderBlock = blockWithPreviousLineBox(toRenderBlock(block->lastChild()))) 1488 return renderBlock; 1489 } 1490 return 0; 1491 } 1492 1493 static const RootInlineBox* previousRootInlineBox(const InlineBox* box) 1494 { 1495 Node* node = box->renderer()->node(); 1496 1497 for (RenderObject* renderer = node->renderer(); renderer; renderer = renderer->parent()) { 1498 if (renderer->isRenderBlock()) { 1499 if (const RenderBlock* blockWithLineBoxes = blockWithPreviousLineBox(toRenderBlock(renderer->previousSibling()))) 1500 return blockWithLineBoxes->lastRootBox(); 1501 } 1502 } 1503 1504 return 0; 1505 } 1506 1507 static const RenderBlock* blockWithNextLineBox(const RenderBlock* startingBlock) 1508 { 1509 for (const RenderBlock* block = startingBlock; block; block = toRenderBlock(block->nextSibling())) { 1510 if (block->childrenInline()) { 1511 if (block->firstRootBox()) 1512 return block; 1513 } else if (const RenderBlock* renderBlock = blockWithNextLineBox(toRenderBlock(block->firstChild()))) 1514 return renderBlock; 1515 } 1516 return 0; 1517 } 1518 1519 static const RootInlineBox* nextRootInlineBox(const InlineBox* box) 1520 { 1521 Node* node = box->renderer()->node(); 1522 1523 for (RenderObject* renderer = node->renderer(); renderer; renderer = renderer->parent()) { 1524 if (renderer->isRenderBlock()) { 1525 if (const RenderBlock* blockWithLineBoxes = blockWithNextLineBox(toRenderBlock(renderer->nextSibling()))) 1526 return blockWithLineBoxes->firstRootBox(); 1527 } 1528 } 1529 1530 return 0; 1531 } 1532 1533 static const InlineBox* leftInlineBox(const InlineBox* box, TextDirection blockDirection) 1534 { 1535 if (box->prevLeafChild()) 1536 return box->prevLeafChild(); 1537 1538 const RootInlineBox* rootBox = box->root(); 1539 const bool isBlockLTR = blockDirection == LTR; 1540 const InlineFlowBox* leftLineBox = isBlockLTR ? rootBox->prevLineBox() : rootBox->nextLineBox(); 1541 if (leftLineBox) 1542 return leftLineBox->lastLeafChild(); 1543 1544 const RootInlineBox* leftRootInlineBox = isBlockLTR ? previousRootInlineBox(box) : nextRootInlineBox(box); 1545 return leftRootInlineBox ? leftRootInlineBox->lastLeafChild() : 0; 1546 } 1547 1548 static const InlineBox* rightInlineBox(const InlineBox* box, TextDirection blockDirection) 1549 { 1550 if (box->nextLeafChild()) 1551 return box->nextLeafChild(); 1552 1553 const RootInlineBox* rootBox = box->root(); 1554 const bool isBlockLTR = blockDirection == LTR; 1555 const InlineFlowBox* rightLineBox = isBlockLTR ? rootBox->nextLineBox() : rootBox->prevLineBox(); 1556 if (rightLineBox) 1557 return rightLineBox->firstLeafChild(); 1558 1559 const RootInlineBox* rightRootInlineBox = isBlockLTR ? nextRootInlineBox(box) : previousRootInlineBox(box); 1560 return rightRootInlineBox ? rightRootInlineBox->firstLeafChild() : 0; 1561 } 1562 1478 1563 static VisiblePosition leftWordBoundary(const InlineBox* box, int offset, TextDirection blockDirection) 1479 1564 { 1480 1565 VisiblePosition wordBreak; 1481 for (const InlineBox* adjacentBox = box; adjacentBox; adjacentBox = adjacentBox->prevLeafChild()) {1566 for (const InlineBox* adjacentBox = box; adjacentBox; adjacentBox = leftInlineBox(adjacentBox, blockDirection)) { 1482 1567 if (blockDirection == LTR) { 1483 1568 if (adjacentBox->isLeftToRightDirection()) … … 1497 1582 1498 1583 VisiblePosition wordBreak; 1499 for (const InlineBox* adjacentBox = box; adjacentBox; adjacentBox = adjacentBox->nextLeafChild()) {1584 for (const InlineBox* adjacentBox = box; adjacentBox; adjacentBox = rightInlineBox(adjacentBox, blockDirection)) { 1500 1585 if (blockDirection == RTL) { 1501 1586 if (adjacentBox->isLeftToRightDirection()) … … 1528 1613 1529 1614 TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent()); 1530 1615 1531 1616 // FIXME: If the box's directionality is the same as that of the enclosing block, when the offset is at the box boundary 1532 1617 // and the direction is towards inside the box, do I still need to make it a special case? For example, a LTR box inside a LTR block, 1533 1618 // when offset is at box's caretMinOffset and the direction is DirectionRight, should it be taken care as a general case? 1534 1619 if (offset == box->caretLeftmostOffset()) 1535 return leftWordBoundary( box->prevLeafChild(), invalidOffset, blockDirection);1620 return leftWordBoundary(leftInlineBox(box, blockDirection), invalidOffset, blockDirection); 1536 1621 if (offset == box->caretRightmostOffset()) 1537 1622 return leftWordBoundary(box, offset, blockDirection); … … 1556 1641 return orderedWordBoundaries[index].visiblePosition; 1557 1642 1558 return leftWordBoundary( box->prevLeafChild(), invalidOffset, blockDirection);1643 return leftWordBoundary(leftInlineBox(box, blockDirection), invalidOffset, blockDirection); 1559 1644 } 1560 1645 … … 1573 1658 return rightWordBoundary(box, offset, blockDirection); 1574 1659 if (offset == box->caretRightmostOffset()) 1575 return rightWordBoundary( box->nextLeafChild(), invalidOffset, blockDirection);1660 return rightWordBoundary(rightInlineBox(box, blockDirection), invalidOffset, blockDirection); 1576 1661 1577 1662 VisiblePosition wordBreak; … … 1593 1678 return orderedWordBoundaries[index].visiblePosition; 1594 1679 1595 return rightWordBoundary( box->nextLeafChild(), invalidOffset, blockDirection);1680 return rightWordBoundary(rightInlineBox(box, blockDirection), invalidOffset, blockDirection); 1596 1681 } 1597 1682
Note: See TracChangeset
for help on using the changeset viewer.