Changeset 86966 in webkit
- Timestamp:
- May 20, 2011 10:45:18 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r86964 r86966 1 2011-05-20 Xiaomei Ji <xji@chromium.org> 2 3 Reviewed by Ryosuke Niwa. 4 5 ctrl-arrow does not work on words separated by multiple spaces. 6 https://bugs.webkit.org/show_bug.cgi?id=57543. 7 8 Add more test cases for mutiplespaces. 9 10 * editing/selection/move-by-word-visually-expected.txt: 11 * editing/selection/move-by-word-visually.html: 12 1 13 2011-05-20 Andrew Scherkus <scherkus@chromium.org> 2 14 -
trunk/LayoutTests/editing/selection/move-by-word-visually-expected.txt
r84710 r86966 88 88 Test 18, LTR: 89 89 Move right by one word 90 "abc def hij opq"[0, 4, 15] FAIL expected: [0, 4, 11, 15] 91 "abc def hij opq"[4, 15] FAIL expected 11 92 "abc def hij opq"[5, 15] FAIL expected 11 93 "abc def hij opq"[6, 15] FAIL expected 11 94 "abc def hij opq"[7, 15] FAIL expected 11 95 "abc def hij opq"[8, 15] FAIL expected 11 96 Move left by one word 97 "abc def hij opq"[18, 15, 4, 0] FAIL expected: [18, 15, 11, 4, 0] 98 "abc def hij opq"[15, 4] FAIL expected 11 99 "abc def hij opq"[14, 4] FAIL expected 11 100 "abc def hij opq"[13, 4] FAIL expected 11 101 "abc def hij opq"[12, 4] FAIL expected 11 90 "abc def hij opq"[0, 4, 8, 15] 91 Move left by one word 92 "abc def hij opq"[18, 15, 8, 4, 0] 102 93 Test 19, LTR: 103 94 Move right by one word 95 " abc def hij opq "[4, 8, 15, 22] 96 Move left by one word 97 " abc def hij opq "[28, 22, 15, 8, 4] 98 Test 20, LTR: 99 Move right by one word 100 " abc ABW def "[4, 8, 15] 101 Move left by one word 102 " abc ABW def "[21, 15, 8, 4] 103 Test 21, LTR: 104 Move right by one word 105 " abc def ABW DDU hij opq "[4, 8, 15, 21, 29, 36] 106 Move left by one word 107 " abc def ABW DDU hij opq "[42, 36, 29, 21, 15, 8, 4] 108 Test 22, LTR: 109 Move right by one word 110 " abc def hij ABW DSU EJH opq rst uvw "[4, 8, 15, 22, 35, 28, 43, 50, 57] 111 Move left by one word 112 " abc def hij ABW DSU EJH opq rst uvw "[63, 57, 50, 43, 28, 35, 22, 15, 8, 4] 113 Test 23, LTR: 114 Move right by one word 115 " ABW DSU HJH FUX "[4, 21, 14, 7] 116 Move left by one word 117 " ABW DSU HJH FUX "[28, 7, 14, 21, 4] 118 Test 24, LTR: 119 Move right by one word 120 " ABW abc DSU "[4, 8, 15, 21] FAIL expected: [4, 8, 15] 121 " ABW abc DSU "[15, 21] FAIL expected to stay in the same position 122 " ABW abc DSU "[20, 21] FAIL expected to stay in the same position 123 " ABW abc DSU "[19, 21] FAIL expected to stay in the same position 124 Move left by one word 125 " ABW abc DSU "[21, 15, 8, 4] 126 Test 25, LTR: 127 Move right by one word 128 " ABW DSU abc def HJH FUX "[4, 7, 15, 22, 28, 33] 129 Move left by one word 130 " ABW DSU abc def HJH FUX "[40, 33, 28, 22, 15, 7, 4] 131 Test 26, LTR: 132 Move right by one word 133 " ABW DSU HJH abc def jih FUX FUX YR[ "[4, 14, 7, 22, 29, 35, 41, 51, 46] 134 Move left by one word 135 " ABW DSU HJH abc def jih FUX FUX YR[ "[58, 46, 51, 41, 35, 29, 22, 7, 14, 4] 136 Test 27, LTR: 137 Move right by one word 138 "ABW DSU EJH FUX"[0, 14, 7, 3] 139 Move left by one word 140 "ABW DSU EJH FUX"[18, 3, 7, 14, 0] 141 Test 28, LTR: 142 Move right by one word 143 "ABW DSU EJH abc def hij"[0, 7, 3, 12, 19, 23] 144 Move left by one word 145 "ABW DSU EJH abc def hij"[26, 23, 19, 12, 3, 7, 0] 146 Test 29, LTR: 147 Move right by one word 148 "abc def hij ABW DSU EJH opq rst uvw"[0, 4, 8, 12, 22, 18, 27, 34, 38] 149 Move left by one word 150 "abc def hij ABW DSU EJH opq rst uvw"[41, 38, 34, 27, 18, 22, 12, 8, 4, 0] 151 Test 30, RTL: 152 Move left by one word 153 "abc def hij opq"[0, 14, 7, 3] 154 Move right by one word 155 "abc def hij opq"[18, 3, 7, 14, 0] 156 Test 31, RTL: 157 Move left by one word 158 " abc def hij opq "[4, 21, 14, 7] 159 Move right by one word 160 " abc def hij opq "[28, 7, 14, 21, 4] 161 Test 32, RTL: 162 Move left by one word 163 " abc ABW def "[4, 8, 15, 21] FAIL expected: [4, 8, 15] 164 " abc ABW def "[15, 21] FAIL expected to stay in the same position 165 " abc ABW def "[20, 21] FAIL expected to stay in the same position 166 " abc ABW def "[19, 21] FAIL expected to stay in the same position 167 Move right by one word 168 " abc ABW def "[21, 15, 8, 4] 169 Test 33, RTL: 170 Move left by one word 171 " abc def ABW DDU hij opq "[4, 7, 15, 22, 29, 35] 172 Move right by one word 173 " abc def ABW DDU hij opq "[42, 35, 29, 22, 15, 7, 4] 174 Test 34, RTL: 175 Move left by one word 176 " abc def hij ABW DSU EJH opq rst uvw "[4, 14, 7, 22, 29, 36, 43, 56, 49] 177 Move right by one word 178 " abc def hij ABW DSU EJH opq rst uvw "[63, 49, 56, 43, 36, 29, 22, 7, 14, 4] 179 Test 35, RTL: 180 Move left by one word 181 " ABW DSU HJH FUX "[4, 8, 15, 22] 182 Move right by one word 183 " ABW DSU HJH FUX "[28, 22, 15, 8, 4] 184 Test 36, RTL: 185 Move left by one word 186 " ABW abc DSU "[4, 8, 15] 187 Move right by one word 188 " ABW abc DSU "[21, 15, 8, 4] 189 Test 37, RTL: 190 Move left by one word 191 " ABW DSU abc def HJH FUX "[4, 8, 15, 21, 28, 34] 192 Move right by one word 193 " ABW DSU abc def HJH FUX "[40, 34, 28, 21, 15, 8, 4] 194 Test 38, RTL: 195 Move left by one word 196 " ABW DSU HJH abc def jih FUX FUX YR[ "[4, 8, 15, 22, 34, 28, 41, 47, 52] 197 Move right by one word 198 " ABW DSU HJH abc def jih FUX FUX YR[ "[58, 52, 47, 41, 28, 34, 22, 15, 8, 4] 199 Test 39, LTR: 200 Move right by one word 104 201 "AAA "[0, 3] 105 202 Move left by one word 106 203 "BB"[2], "AAA "[3, 0] 107 Test 20, RTL:204 Test 40, RTL: 108 205 Move left by one word 109 206 "AAA "[0, 4] 110 207 Move right by one word 111 208 "BB"[2], "AAA "[4, 0] 112 Test 21, LTR:209 Test 41, LTR: 113 210 Move right by one word 114 211 "abc def "[0, 4, 8], "hij opq"[4], " rst uvw"[1, 5] 115 212 Move left by one word 116 213 " rst uvw"[8, 5, 1], "hij opq"[4], "abc def "[8, 4, 0] 117 Test 22, RTL:214 Test 42, RTL: 118 215 Move left by one word 119 216 "abc def "[0], " rst uvw"[4], "hij opq"[3], "abc def "[7, 3] FAIL expected: ["abc def "[ 0, ]" rst uvw"[ 4, ]"hij opq"[ 7, 3, ]"abc def "[ 7, 3] … … 128 225 "hij opq"[5], " rst uvw"[4] FAIL expected "hij opq"[ 7] 129 226 "hij opq"[6], " rst uvw"[4] FAIL expected "hij opq"[ 7] 130 Test 23, RTL:227 Test 43, RTL: 131 228 Move left by one word 132 229 "abc def "[0], " rst uvw"[4], "hij opq"[3], "abc def "[7, 3] FAIL expected: ["abc def "[ 0, ]" rst uvw"[ 4, ]"hij opq"[ 7, 3, ]"abc def "[ 7, 3] … … 141 238 "hij opq"[5], " rst uvw"[4] FAIL expected "hij opq"[ 7] 142 239 "hij opq"[6], " rst uvw"[4] FAIL expected "hij opq"[ 7] 143 Test 24, LTR:240 Test 44, LTR: 144 241 Move right by one word 145 242 "abc def "[0, 4, 8], "hij opq"[4], " rst uvw"[1, 5] 146 243 Move left by one word 147 244 " rst uvw"[8, 5, 1], "hij opq"[4], "abc def "[8, 4, 0] 148 Test 25, RTL:245 Test 45, RTL: 149 246 Move left by one word 150 247 "ABD DSU "[0, 4, 8], "EJH FUX"[4], "FFZ LIG"[4] 151 248 Move right by one word 152 249 "FFZ LIG"[7, 4], "EJH FUX"[4], "ABD DSU "[8, 4, 0] 153 Test 26, LTR:250 Test 46, LTR: 154 251 Move right by one word 155 252 "ABD DSU "[0], "FFZ LIG"[3], "EJH FUX"[3], "ABD DSU "[7, 3] 156 253 Move left by one word 157 254 "FFZ LIG"[7], "ABD DSU "[3, 7], "EJH FUX"[3], "FFZ LIG"[3], "ABD DSU "[0] 158 Test 27, RTL:255 Test 47, RTL: 159 256 Move left by one word 160 257 "ABD DSU "[0, 4, 8], "EJH FUX"[4], "FFZ LIG"[4] 161 258 Move right by one word 162 259 "FFZ LIG"[7, 4], "EJH FUX"[4], "ABD DSU "[8, 4, 0] 163 Test 28, LTR:260 Test 48, LTR: 164 261 Move right by one word 165 262 "ABD DSU "[0], "FFZ LIG"[3], "EJH FUX"[3], "ABD DSU "[7, 3] 166 263 Move left by one word 167 264 "FFZ LIG"[7], "ABD DSU "[3, 7], "EJH FUX"[3], "FFZ LIG"[3], "ABD DSU "[0] 168 Test 29, RTL:265 Test 49, RTL: 169 266 Move left by one word 170 267 "ABD DSU "[0, 4, 8], "abc def"[3], "FFZ LIG"[4] 171 268 Move right by one word 172 269 "FFZ LIG"[7, 4], "abc def"[3], "ABD DSU "[8, 4, 0] 173 Test 30, LTR:270 Test 50, LTR: 174 271 Move right by one word 175 272 "ABD DSU "[0], "FFZ LIG"[3], "ABD DSU "[8], "abc def"[4], "ABD DSU "[7, 3] … … 180 277 "FFZ LIG"[5, 5] FAIL expected "ABD DSU "[ 0] 181 278 "FFZ LIG"[6, 6] FAIL expected "ABD DSU "[ 0] 182 Test 31, RTL:279 Test 51, RTL: 183 280 Move left by one word 184 281 "ABD DSU "[0, 4, 8], "abc def"[3], "FFZ LIG"[4] 185 282 Move right by one word 186 283 "FFZ LIG"[7, 4], "abc def"[3], "ABD DSU "[8, 4, 0] 187 Test 32, LTR:284 Test 52, LTR: 188 285 Move right by one word 189 286 "ABD DSU "[0, 3, 8], "abc def"[4], "FFZ LIG"[3] 190 287 Move left by one word 191 "FFZ LIG"[7, 3], "abc def"[4], "ABD DSU "[8, 4, 0] FAIL expected: ["FFZ LIG"[ 7, 3, ]"abc def"[ 4, ]"ABD DSU "[ 8, 3, 0] 192 "ABD DSU "[8, 4] FAIL expected "ABD DSU "[ 3] 193 Test 33, RTL: 194 Move left by one word 195 "ABD opq DSU "[0, 4, 8], "abc AAA def"[8, 4, 3], "FFZ rst LIG"[4, 8] FAIL expected: ["ABD opq DSU "[ 0, 4, 8, 12, ]"abc AAA def"[ 4, 3, ]"FFZ rst LIG"[ 4, 8] 196 "ABD opq DSU "[8], "abc AAA def"[8] FAIL expected "ABD opq DSU "[ 12] 197 "ABD opq DSU "[9], "abc AAA def"[8] FAIL expected "ABD opq DSU "[ 12] 198 "ABD opq DSU "[10], "abc AAA def"[8] FAIL expected "ABD opq DSU "[ 12] 199 "ABD opq DSU "[11], "abc AAA def"[8] FAIL expected "ABD opq DSU "[ 12] 288 "FFZ LIG"[7, 3], "abc def"[4], "ABD DSU "[8, 3, 0] 289 Test 53, RTL: 290 Move left by one word 291 "ABD opq DSU "[0, 4, 8, 12], "abc AAA def"[8, 4, 3], "FFZ rst LIG"[4, 8] FAIL expected: ["ABD opq DSU "[ 0, 4, 8, 12, ]"abc AAA def"[ 4, 3, ]"FFZ rst LIG"[ 4, 8] 200 292 "ABD opq DSU "[12], "abc AAA def"[8] FAIL expected "abc AAA def"[ 4] 201 293 "abc AAA def"[10, 8] FAIL expected "abc AAA def"[ 4] 202 294 "abc AAA def"[9, 8] FAIL expected "abc AAA def"[ 4] 203 295 Move right by one word 204 "FFZ rst LIG"[11, 8, 4], "abc AAA def"[4, 8], "ABD opq DSU "[8, 4, 0] FAIL expected: ["FFZ rst LIG"[ 11, 8, 4, ]"abc AAA def"[ 3, 4, ]"ABD opq DSU "[ 12, 8, 4, 0] 205 "FFZ rst LIG"[4], "abc AAA def"[4] FAIL expected "abc AAA def"[ 3] 296 "FFZ rst LIG"[11, 8, 4], "abc AAA def"[3, 4, 8], "ABD opq DSU "[12, 8, 4, 0] FAIL expected: ["FFZ rst LIG"[ 11, 8, 4, ]"abc AAA def"[ 3, 4, ]"ABD opq DSU "[ 12, 8, 4, 0] 206 297 "abc AAA def"[4, 8] FAIL expected "ABD opq DSU "[ 12] 207 "abc AAA def"[8], "ABD opq DSU "[8] FAIL expected "ABD opq DSU "[ 12] 208 "abc AAA def"[9], "ABD opq DSU "[8] FAIL expected "ABD opq DSU "[ 12] 209 "abc AAA def"[10], "ABD opq DSU "[8] FAIL expected "ABD opq DSU "[ 12] 210 Test 34, LTR: 298 Test 54, LTR: 211 299 Move right by one word 212 300 "ABD opq DSU "[0, 4], "abc AAA def"[8, 4], "ABD opq DSU "[12, 11], "FFZ rst LIG"[4, 8, 11] FAIL expected: ["ABD opq DSU "[ 0, 4, 8, ]"abc AAA def"[ 8, 7, ]"ABD opq DSU "[ 12, 11, ]"FFZ rst LIG"[ 4, 8, 11] … … 223 311 "abc AAA def"[5, 4] FAIL expected "ABD opq DSU "[ 12] 224 312 Move left by one word 225 "FFZ rst LIG"[11, 8, 4], "ABD opq DSU "[11, 12], "abc AAA def"[7, 8], "ABD opq DSU "[ 7,4, 0] FAIL expected: ["FFZ rst LIG"[ 11, 8, 4, ]"ABD opq DSU "[ 11, 12, ]"abc AAA def"[ 7, 8, ]"ABD opq DSU "[ 8, 4, 0]226 "abc AAA def"[8], "ABD opq DSU "[ 7] FAIL expected "ABD opq DSU "[ 8]313 "FFZ rst LIG"[11, 8, 4], "ABD opq DSU "[11, 12], "abc AAA def"[7, 8], "ABD opq DSU "[4, 0] FAIL expected: ["FFZ rst LIG"[ 11, 8, 4, ]"ABD opq DSU "[ 11, 12, ]"abc AAA def"[ 7, 8, ]"ABD opq DSU "[ 8, 4, 0] 314 "abc AAA def"[8], "ABD opq DSU "[4] FAIL expected "ABD opq DSU "[ 8] 227 315 "FFZ rst LIG"[1], "ABD opq DSU "[4] FAIL expected "ABD opq DSU "[ 8] 228 316 "FFZ rst LIG"[2], "ABD opq DSU "[4] FAIL expected "ABD opq DSU "[ 8] 229 Test 35, RTL: 230 Move left by one word 231 "ABD opq DSU "[0, 4, 8], "abc AAA def"[4, 8], "FFZ rst LIG"[4, 8] FAIL expected: ["ABD opq DSU "[ 0, 4, 8, 12, ]"abc AAA def"[ 4, 8, ]"FFZ rst LIG"[ 4, 8] 232 "ABD opq DSU "[8], "abc AAA def"[4] FAIL expected "ABD opq DSU "[ 12] 233 "ABD opq DSU "[9], "abc AAA def"[4] FAIL expected "ABD opq DSU "[ 12] 234 "ABD opq DSU "[10], "abc AAA def"[4] FAIL expected "ABD opq DSU "[ 12] 235 "ABD opq DSU "[11], "abc AAA def"[4] FAIL expected "ABD opq DSU "[ 12] 236 Move right by one word 237 "FFZ rst LIG"[11, 8, 4], "abc AAA def"[8, 4], "ABD opq DSU "[11, 8, 4, 0] FAIL expected: ["FFZ rst LIG"[ 11, 8, 4, ]"abc AAA def"[ 8, 4, ]"ABD opq DSU "[ 12, 8, 4, 0] 238 "abc AAA def"[4], "ABD opq DSU "[11] FAIL expected "ABD opq DSU "[ 12] 239 "abc AAA def"[3], "ABD opq DSU "[11] FAIL expected "ABD opq DSU "[ 12] 240 "abc AAA def"[1], "ABD opq DSU "[8] FAIL expected "ABD opq DSU "[ 12] 241 "abc AAA def"[2], "ABD opq DSU "[8] FAIL expected "ABD opq DSU "[ 12] 242 Test 36, LTR: 317 Test 55, RTL: 318 Move left by one word 319 "ABD opq DSU "[0, 4, 8, 12], "abc AAA def"[4, 8], "FFZ rst LIG"[4, 8] 320 Move right by one word 321 "FFZ rst LIG"[11, 8, 4], "abc AAA def"[8, 4], "ABD opq DSU "[12, 8, 4, 0] 322 Test 56, LTR: 243 323 Move right by one word 244 324 "ABD opq DSU "[0, 4, 8, 12], "abc AAA def"[4, 8], "FFZ rst LIG"[4, 8, 11] 245 325 Move left by one word 246 326 "FFZ rst LIG"[11, 8, 4], "abc AAA def"[8, 4], "ABD opq DSU "[12, 8, 4, 0] 247 Test 37, LTR:327 Test 57, LTR: 248 328 Move right by one word 249 329 "aaa "[0, 4], "bbb AAA "[4, 7] 250 330 Move left by one word 251 331 "FFZ"[3], "bbb AAA "[7, 4], "aaa "[4, 0] 332 Test 58, RTL: 333 Move left by one word 334 "ABD opq rst DSU "[0, 4, 7, 12, 16], "abc uvw AAA def lmn"[12, 8, 7, 3], "ABW hij xyz FXX"[4, 7, 12] FAIL expected: ["ABD opq rst DSU "[ 0, 4, 7, 12, 16, ]"abc uvw AAA def lmn"[ 15, 8, 7, 3, ]"ABW hij xyz FXX"[ 4, 7, 12] 335 "ABD opq rst DSU "[16], "abc uvw AAA def lmn"[12] FAIL expected "abc uvw AAA def lmn"[ 15] 336 "abc uvw AAA def lmn"[15, 12] FAIL expected "abc uvw AAA def lmn"[ 8] 337 "abc uvw AAA def lmn"[14, 12] FAIL expected "abc uvw AAA def lmn"[ 8] 338 "abc uvw AAA def lmn"[13, 12] FAIL expected "abc uvw AAA def lmn"[ 8] 339 Move right by one word 340 "ABW hij xyz FXX"[15, 12, 7, 4], "abc uvw AAA def lmn"[3, 7, 8, 15], "ABD opq rst DSU "[16, 12, 7, 4, 0] 252 341 -
trunk/LayoutTests/editing/selection/move-by-word-visually.html
r84710 r86966 187 187 validateData(positions); 188 188 log("\n"); 189 }190 191 function positionPassWordBreak(position, wordBreak, searchDirection)192 {193 // Hack for space collapse.194 // sel.modify("move", dir, "character") not reach multi-space.195 var node = position.node;196 if (node.parentNode.id == "multispace") {197 if (searchDirection == "right" && position.offset >= wordBreak198 || searchDirection == "left" && position.offset <= wordBreak)199 return true;200 }201 return false;202 189 } 203 190 … … 240 227 position = { node: sel.anchorNode, offset: sel.anchorOffset }; 241 228 if (wordBreakIndex < wordBreaks.length 242 && (positionEqualToWordBreak(position, wordBreaks[wordBreakIndex]) 243 || positionPassWordBreak(position, wordBreaks[wordBreakIndex], searchDirection))) 229 && positionEqualToWordBreak(position, wordBreaks[wordBreakIndex])) 244 230 ++wordBreakIndex; 245 231 … … 353 339 <div dir=rtl class="test_move_by_word" title="11 8 4 0|0 4 8" contenteditable>שנב abc סטז</div> 354 340 355 <!-- multiple spaces between word. 356 FAILED: word break between "def" and "hij" is unreachable. 357 --> 358 <div id="multispace" dir=ltr class="test_move_by_word" title="0 4 11 15|18 15 11 4 0" contenteditable>abc def hij opq</div> 341 <!-- test multispaces --> 342 <div dir=ltr class="test_move_by_word" title="0 4 8 15|18 15 8 4 0" contenteditable>abc def hij opq</div> 343 <div dir=ltr class="test_move_by_word" title="4 8 15 22|28 22 15 8 4" contenteditable> abc def hij opq </div> 344 <div dir=ltr class="test_move_by_word" title="4 8 15|21 15 8 4" contenteditable> abc אבצ def </div> 345 <div dir=ltr class="test_move_by_word" title="4 8 15 21 29 36|42 36 29 21 15 8 4" contenteditable> abc def אבצ דדפ hij opq </div> 346 <div dir=ltr class="test_move_by_word" title="4 8 15 22 35 28 43 50 57|63 57 50 43 28 35 22 15 8 4" contenteditable> abc def hij אבצ דעפ היח opq rst uvw </div> 347 <div dir=ltr class="test_move_by_word" title="4 21 14 7|28 7 14 21 4" contenteditable> אבצ דעפ חיח ופק </div> 348 <div dir=ltr class="test_move_by_word" title="4 8 15|21 15 8 4" contenteditable> אבצ abc דעפ </div> 349 <div dir=ltr class="test_move_by_word" title="4 7 15 22 28 33|40 33 28 22 15 7 4" contenteditable> אבצ דעפ abc def חיח ופק </div> 350 <div dir=ltr class="test_move_by_word" title="4 14 7 22 29 35 41 51 46|58 46 51 41 35 29 22 7 14 4" contenteditable> אבצ דעפ חיח abc def jih ופק ופק רסת </div> 351 352 <div dir=ltr class="test_move_by_word" title="0 14 7 3|18 3 7 14 0" contenteditable>אבצ דעפ היח ופק</div> 353 <div dir=ltr class="test_move_by_word" title="0 7 3 12 19 23|26 23 19 12 3 7 0" contenteditable>אבצ דעפ היח abc def hij</div> 354 <div dir=ltr class="test_move_by_word" title="0 4 8 12 22 18 27 34 38|41 38 34 27 18 22 12 8 4 0" contenteditable>abc def hij אבצ דעפ היח opq rst uvw</div> 355 356 <div dir=rtl class="test_move_by_word" title="18 3 7 14 0|0 14 7 3" contenteditable>abc def hij opq</div> 357 <div dir=rtl class="test_move_by_word" title="28 7 14 21 4|4 21 14 7" contenteditable> abc def hij opq </div> 358 <div dir=rtl class="test_move_by_word" title="21 15 8 4|4 8 15" contenteditable> abc אבצ def </div> 359 <div dir=rtl class="test_move_by_word" title="42 35 29 22 15 7 4|4 7 15 22 29 35" contenteditable> abc def אבצ דדפ hij opq </div> 360 <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" contenteditable> abc def hij אבצ דעפ היח opq rst uvw </div> 361 <div dir=rtl class="test_move_by_word" title="28 22 15 8 4|4 8 15 22" contenteditable> אבצ דעפ חיח ופק </div> 362 <div dir=rtl class="test_move_by_word" title="21 15 8 4|4 8 15" contenteditable> אבצ abc דעפ </div> 363 <div dir=rtl class="test_move_by_word" title="40 34 28 21 15 8 4|4 8 15 21 28 34" contenteditable> אבצ דעפ abc def חיח ופק </div> 364 <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" contenteditable> אבצ דעפ חיח abc def jih ופק ופק רסת </div> 365 359 366 360 367 <!-- Inline element --> … … 406 413 <div id="div_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> 407 414 415 <div id="div_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> 408 416 </div> 409 417 -
trunk/Source/WebCore/ChangeLog
r86965 r86966 1 2011-05-20 Xiaomei Ji <xji@chromium.org> 2 3 Reviewed by Ryosuke Niwa. 4 5 ctrl-arrow does not work on words separated by multiple spaces. 6 https://bugs.webkit.org/show_bug.cgi?id=57543. 7 8 Add the leftmost boundary of a box in RTL block or the rightmost boundary of a box in LTR 9 block as word break if its inlineBox is the current box and it is a word break. 10 11 * editing/visible_units.cpp: 12 (WebCore::previousWordBreakInBoxInsideBlockWithSameDirectionality): Add the rightmost 13 boundary of a box in LTR block or leftmost boundary of a box in RTL block as visually 14 first word break. 15 (WebCore::nextWordBreakInBoxInsideBlockWithDifferentDirectionality): 16 (WebCore::collectWordBreaksInBoxInsideBlockWithDifferntDirectionality): 17 (WebCore::leftWordBoundary): Fix bug change "box" to "adjacentBox". 18 (WebCore::rightWordBoundary): Fix bug change "box" to "adjacentBox". 19 1 20 2011-05-19 Evan Martin <evan@chromium.org> 2 21 -
trunk/Source/WebCore/editing/visible_units.cpp
r86325 r86966 1163 1163 1164 1164 static const int invalidOffset = -1; 1165 1165 1166 1166 static VisiblePosition previousWordBreakInBoxInsideBlockWithSameDirectionality(const InlineBox* box, const VisiblePosition& previousWordBreak, int& offsetOfWordBreak) 1167 1167 { 1168 bool hasSeenWordBreakInThisBox = previousWordBreak.isNotNull();1169 1168 // In a LTR block, the word break should be on the left boundary of a word. 1170 1169 // In a RTL block, the word break should be on the right boundary of a word. … … 1173 1172 // to find the previous word break (i.e. the first word break on the left). The same applies to RTL text. 1174 1173 1175 VisiblePosition wordBreak = hasSeenWordBreakInThisBox ? previousWordBreak : Position(box->renderer()->node(), box->caretMaxOffset(), Position::PositionIsOffsetInAnchor); 1176 1177 // FIXME: handle multi-spaces (http://webkit.org/b/57543). 1178 1174 bool hasSeenWordBreakInThisBox = previousWordBreak.isNotNull(); 1175 1176 VisiblePosition wordBreak; 1177 1178 if (hasSeenWordBreakInThisBox) 1179 wordBreak = previousWordBreak; 1180 else { 1181 wordBreak = Position(box->renderer()->node(), box->caretMaxOffset(), Position::PositionIsOffsetInAnchor); 1182 // Return the rightmost word boundary of LTR box or leftmost word boundary of RTL box if 1183 // it is not in the previously visited boxes. For example, given a logical text 1184 // "abc def hij opq", there are 2 boxes: the "abc def " (starts at 0 and length is 8) 1185 // and the "hij opq" (starts at 12 and length is 7). The word breaks are 1186 // "abc |def | hij |opq". We normally catch the word break between "def" and "hij" when 1187 // we visit the box that contains "hij opq", but this word break doesn't exist in the box 1188 // that contains "hij opq" when there are multiple spaces. So we detect it when we're 1189 // traversing the box that contains "abc def " instead. 1190 1191 if ((box->isLeftToRightDirection() && box->nextLeafChild()) 1192 || (!box->isLeftToRightDirection() && box->prevLeafChild())) { 1193 1194 VisiblePosition positionAfterWord = nextWordPosition(wordBreak); 1195 VisiblePosition positionBeforeWord = previousWordPosition(positionAfterWord); 1196 1197 InlineBox* boxContainingPreviousWordBreak; 1198 positionBeforeWord.getInlineBoxAndOffset(boxContainingPreviousWordBreak, offsetOfWordBreak); 1199 1200 if (boxContainingPreviousWordBreak == box) 1201 return positionBeforeWord; 1202 } 1203 } 1204 1179 1205 wordBreak = previousWordPosition(wordBreak); 1180 1206 if (previousWordBreak == wordBreak) … … 1283 1309 // we need to use nextWordPosition() to traverse words within the inline boxes from right to left to find the next word break. 1284 1310 // The same applies to LTR text, in which words are traversed within the inline boxes from left to right. 1285 1286 // FIXME: handle multi-spaces (http://webkit.org/b/57543).1287 1311 1288 1312 bool hasSeenWordBreakInThisBox = previousWordBreak.isNotNull(); … … 1344 1368 VisiblePosition wordBreak; 1345 1369 int offsetOfWordBreak = invalidOffset; 1370 bool isLastWordBreakInBox = false; 1346 1371 while (1) { 1347 bool isLastWordBreakInBox = false;1348 1372 wordBreak = nextWordBreakInBoxInsideBlockWithDifferentDirectionality(box, wordBreak, offsetOfWordBreak, isLastWordBreakInBox); 1349 1373 if (wordBreak.isNotNull()) { … … 1447 1471 for (const InlineBox* adjacentBox = box; adjacentBox; adjacentBox = adjacentBox->prevLeafChild()) { 1448 1472 if (blockDirection == LTR) { 1449 if ( box->isLeftToRightDirection())1473 if (adjacentBox->isLeftToRightDirection()) 1450 1474 wordBreak = previousWordBoundaryInBox(adjacentBox, adjacentBox == box ? offset : invalidOffset); 1451 1475 else … … 1465 1489 for (const InlineBox* adjacentBox = box; adjacentBox; adjacentBox = adjacentBox->nextLeafChild()) { 1466 1490 if (blockDirection == RTL) { 1467 if ( box->isLeftToRightDirection())1491 if (adjacentBox->isLeftToRightDirection()) 1468 1492 wordBreak = nextWordBoundaryInBox(adjacentBox, adjacentBox == box ? offset : invalidOffset); 1469 1493 else
Note: See TracChangeset
for help on using the changeset viewer.