LayoutTests/ChangeLog

 12009-12-15 MORITA Hajime <morrita@gmail.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Bug 28306: double-clicking a word inside <b> beside newline select two words
 6 https://bugs.webkit.org/show_bug.cgi?id=28306
 7
 8 SimplifiedBackwardsTextIterator missed trailing whitespaces just
 9 before folding line-break, which is used to detect word
 10 boundaries. This fix checks strings on RenderText and expand text
 11 range on SimplifiedBackwardsTextIterator to include trailing
 12 whitespaces if availble.
 13
 14 * editing/selection/doubleclick-beside-cr-span-expected.txt: Added.
 15 * editing/selection/doubleclick-beside-cr-span.html: Added.
 16
1172009-12-12 Kenneth Russell <kbr@google.com>
218
319 Reviewed by Oliver Hunt.

28632879 Unskip a bunch of passing http/navigation tests.
28642880
28652881 * platform/qt/Skipped:
2866 
286728822009-11-22 Chris Fleizach <cfleizach@apple.com>
28682883
28692884 Reviewed by Oliver Hunt.

LayoutTests/editing/selection/doubleclick-beside-cr-span-expected.txt

 1This tests that double-clicking a word that follows newline and span
 2
 3cases for white-space: pre
 4
 5Note: Here for pre, we change width value to 200 to prevent layout change on contentEditable enabled.
 6
 7cases for white-space: pre-wrap
 8
 9cases for white-space: pre-line
 10
 11cases for white-space: nowrap
 12
 13Note: Although following cases have no line-breaks that had caused problem reported bug28036, we add these for comprehensiveness.
 14
 15Passed totest_minimum
 16Passed totest_minimum (with contentEditable)
 17Passed totest_before_after
 18Passed totest_before_after (with contentEditable)
 19Passed totest_linebreak_out
 20Passed totest_linebreak_out (with contentEditable)
 21Passed totest_tab_out
 22Passed totest_tab_out (with contentEditable)
 23Passed totest_multiple_whitespaces_out
 24Passed totest_multiple_whitespaces_out (with contentEditable)
 25Passed totest_linebreak_in
 26Passed totest_linebreak_in (with contentEditable)
 27Passed totest_tab_in
 28Passed totest_tab_in (with contentEditable)
 29Passed totest_multiple_whitespaces_in
 30Passed totest_multiple_whitespaces_in (with contentEditable)
 31Passed totest_multiple_word_in_span
 32Passed totest_multiple_word_in_span (with contentEditable)
 33Passed totest_word_before_here_in_line
 34Passed totest_word_before_here_in_line (with contentEditable)
 35Passed totest_span_first_half
 36Passed totest_span_first_half (with contentEditable)
 37Passed totest_span_second_half
 38Passed totest_span_second_half (with contentEditable)
 39Passed totest_linebreak_out_pre
 40Passed totest_linebreak_out_pre (with contentEditable)
 41Passed totest_tab_out_pre
 42Passed totest_tab_out_pre (with contentEditable)
 43Passed totest_multiple_whitespaces_out_pre
 44Passed totest_multiple_whitespaces_out_pre (with contentEditable)
 45Passed totest_linebreak_in_pre
 46Passed totest_linebreak_in_pre (with contentEditable)
 47Passed totest_tab_in_pre
 48Passed totest_tab_in_pre (with contentEditable)
 49Passed totest_multiple_whitespaces_in_pre
 50Passed totest_multiple_whitespaces_in_pre (with contentEditable)
 51Passed totest_linebreak_out_prewrap
 52Passed totest_linebreak_out_prewrap (with contentEditable)
 53Passed totest_tab_out_prewrap
 54Passed totest_tab_out_prewrap (with contentEditable)
 55Passed totest_multiple_whitespaces_out_prewrap
 56Passed totest_multiple_whitespaces_out_prewrap (with contentEditable)
 57Passed totest_linebreak_in_prewrap
 58Passed totest_linebreak_in_prewrap (with contentEditable)
 59Passed totest_tab_in_prewrap
 60Passed totest_tab_in_prewrap (with contentEditable)
 61Passed totest_multiple_whitespaces_in_prewrap
 62Passed totest_multiple_whitespaces_in_prewrap (with contentEditable)
 63Passed totest_linebreak_out_preline
 64Passed totest_linebreak_out_preline (with contentEditable)
 65Passed totest_tab_out_preline
 66Passed totest_tab_out_preline (with contentEditable)
 67Passed totest_multiple_whitespaces_out_preline
 68Passed totest_multiple_whitespaces_out_preline (with contentEditable)
 69Passed totest_linebreak_in_preline
 70Passed totest_linebreak_in_preline (with contentEditable)
 71Passed totest_tab_in_preline
 72Passed totest_tab_in_preline (with contentEditable)
 73Passed totest_multiple_whitespaces_in_preline
 74Passed totest_multiple_whitespaces_in_preline (with contentEditable)
 75Passed totest_linebreak_out_nowrap
 76Passed totest_linebreak_out_nowrap (with contentEditable)
 77Passed totest_tab_out_nowrap
 78Passed totest_tab_out_nowrap (with contentEditable)
 79Passed totest_multiple_whitespaces_out_nowrap
 80Passed totest_multiple_whitespaces_out_nowrap (with contentEditable)
 81Passed totest_linebreak_in_nowrap
 82Passed totest_linebreak_in_nowrap (with contentEditable)
 83Passed totest_tab_in_nowrap
 84Passed totest_tab_in_nowrap (with contentEditable)
 85Passed totest_multiple_whitespaces_in_nowrap
 86Passed totest_multiple_whitespaces_in_nowrap (with contentEditable)
 87

LayoutTests/editing/selection/doubleclick-beside-cr-span.html

 1<html>
 2<head>
 3<script>
 4if (window.layoutTestController) {
 5 layoutTestController.dumpAsText();
 6 layoutTestController.setSmartInsertDeleteEnabled(false);
 7 layoutTestController.setSelectTrailingWhitespaceEnabled(true);
 8}
 9
 10function getPositionOfNode(id)
 11{
 12 var n = document.getElementById(id);
 13 var pos = {x: 0, y: 0};
 14
 15 while (n) {
 16 pos.x += n.offsetLeft + n.clientLeft;
 17 pos.y += n.offsetTop + n.clientTop;
 18 n = n.offsetParent;
 19 }
 20 return pos;
 21}
 22
 23function doubleClickPosition(pos)
 24{
 25 eventSender.mouseMoveTo(pos.x + 2, pos.y + 2);
 26 eventSender.mouseDown();
 27 eventSender.leapForward(1);
 28 eventSender.mouseUp();
 29 eventSender.leapForward(100);
 30 eventSender.mouseDown();
 31 eventSender.leapForward(1);
 32 eventSender.mouseUp();
 33}
 34
 35function defocus()
 36{
 37 doubleClickPosition({x:0, y:0});
 38}
 39
 40function findParentDiv(spanId)
 41{
 42 var n = document.getElementById(spanId);
 43 while (n) {
 44 var parent = n.parentNode;
 45 if (parent && parent.tagName == "DIV")
 46 return parent;
 47 n = parent;
 48 }
 49
 50 return null;
 51}
 52
 53function makeParentBlockEditable(spanId)
 54{
 55 var parent = findParentDiv(spanId);
 56 parent.contentEditable = true;
 57}
 58
 59function hideCaseBlockFor(spanId)
 60{
 61 var n = document.getElementById(spanId);
 62 while (n) {
 63 n = n.parentNode;
 64 if (n && n.className == "case") {
 65 n.style.display = "none";
 66 n.style.offsetTop;
 67 return;
 68 }
 69 }
 70}
 71
 72function doTest(testId, expectedText, givenClickPosition)
 73{
 74 // Simulate a double click.
 75 defocus()
 76 var pos = givenClickPosition || getPositionOfNode(testId);
 77 doubleClickPosition(pos);
 78
 79 // Get the text of the current selection.
 80 var sel = window.getSelection();
 81 var actualText = sel.getRangeAt(0).toString();
 82
 83 if (expectedText == actualText) {
 84 log("Passed " + testId);
 85 } else {
 86 log("Failed " + testId);
 87 log(" Expected: " + expectedText);
 88 log(" Actual: " + actualText);
 89 }
 90
 91 // Run the same case with contentEditable enabled.
 92 makeParentBlockEditable(testId);
 93
 94 defocus();
 95 doubleClickPosition(pos);
 96
 97 sel = window.getSelection();
 98 actualText = sel.getRangeAt(0).toString();
 99
 100 if (expectedText == actualText) {
 101 log("Passed " + testId + " (with contentEditable)");
 102 } else {
 103 log("Failed " + testId + " (with contentEditable)");
 104 log(" Expected: " + expectedText);
 105 log(" Actual: " + actualText);
 106 }
 107
 108 // Hide a container for the case to workaround limited window size
 109 hideCaseBlockFor(testId);
 110}
 111
 112function log(msg)
 113{
 114 var l = document.getElementById('log');
 115 l.appendChild(document.createTextNode(msg));
 116 l.appendChild(document.createElement('br'));
 117}
 118
 119function initConstants()
 120{
 121 var heightMeasure = document.getElementById("heightMeasure");
 122 LINE_HEIGHT = heightMeasure.offsetHeight;
 123 LINE_LEFT = heightMeasure.offsetLeft + heightMeasure.clientLeft;
 124 CHAR_WIDTH = heightMeasure.offsetWidth;
 125 heightMeasure.style.display = "none"; // hide for readable test result
 126}
 127
 128function getPositionOfNextLineHeadOf(spanId)
 129{
 130 var pos = getPositionOfNode(spanId)
 131 pos.x = LINE_LEFT;
 132 pos.y += LINE_HEIGHT;
 133 return pos;
 134}
 135
 136function getPositionForward(spanId, ncharacters)
 137{
 138 var pos = getPositionOfNode(spanId)
 139 pos.x += CHAR_WIDTH*ncharacters;
 140 return pos;
 141}
 142
 143function runTests()
 144{
 145 initConstants();
 146
 147 if (window.layoutTestController) {
 148 doTest("totest_minimum", "select1");
 149 // We may have to make EditorClient::isSelectTrailingWhitespaceEnabled false on
 150 // DumpRenderTree to clarify cases...
 151 doTest("totest_before_after", "select2 ");
 152
 153 doTest("totest_linebreak_out", "select3\n");
 154 doTest("totest_tab_out", "select4\t");
 155 doTest("totest_multiple_whitespaces_out", "select5 ");
 156 doTest("totest_linebreak_in", "select6\n");
 157 doTest("totest_tab_in", "select7\t");
 158 doTest("totest_multiple_whitespaces_in", "select8 ");
 159
 160 doTest("totest_multiple_word_in_span", "select9 ");
 161 doTest("totest_word_before_here_in_line", "select10 ");
 162 doTest("totest_span_first_half", "select11 ");
 163 doTest("totest_span_second_half", "select12 ");
 164
 165 doTest("totest_linebreak_out_pre", "select1");
 166 doTest("totest_tab_out_pre", "select2\t");
 167 doTest("totest_multiple_whitespaces_out_pre", "select3 ");
 168 doTest("totest_linebreak_in_pre", "select4", getPositionOfNextLineHeadOf("totest_linebreak_in_pre"));
 169 doTest("totest_tab_in_pre", "select5\t");
 170 doTest("totest_multiple_whitespaces_in_pre", "select6 ", getPositionForward("totest_multiple_whitespaces_in_pre", " ".length));
 171
 172 doTest("totest_linebreak_out_prewrap", "select1");
 173 doTest("totest_tab_out_prewrap", "select2\t");
 174 doTest("totest_multiple_whitespaces_out_prewrap", "select3 ");
 175 doTest("totest_linebreak_in_prewrap", "select4", getPositionOfNextLineHeadOf("totest_linebreak_in_prewrap"));
 176 doTest("totest_tab_in_prewrap", "select5\t", getPositionOfNextLineHeadOf("totest_tab_in_prewrap"));
 177 doTest("totest_multiple_whitespaces_in_prewrap", "select6 ", getPositionOfNextLineHeadOf("totest_multiple_whitespaces_in_prewrap"));
 178
 179 doTest("totest_linebreak_out_preline", "select1\n");
 180 doTest("totest_tab_out_preline", "select2\t");
 181 doTest("totest_multiple_whitespaces_out_preline", "select3 ");
 182 doTest("totest_linebreak_in_preline", "select4\n", getPositionOfNextLineHeadOf("totest_linebreak_in_preline"));
 183 doTest("totest_tab_in_preline", "select5\t");
 184 doTest("totest_multiple_whitespaces_in_preline", "select6 ");
 185
 186 doTest("totest_linebreak_out_nowrap", "select1\n");
 187 doTest("totest_tab_out_nowrap", "select2\t");
 188 doTest("totest_multiple_whitespaces_out_nowrap", "select3 ");
 189 doTest("totest_linebreak_in_nowrap", "select4\n", getPositionForward("totest_linebreak_in_nowrap", 1));
 190 doTest("totest_tab_in_nowrap", "select5\t", getPositionForward("totest_tab_in_nowrap", 1));
 191 doTest("totest_multiple_whitespaces_in_nowrap", "select6 ", getPositionForward("totest_multiple_whitespaces_in_nowrap", 1));
 192
 193 }
 194}
 195
 196
 197</script>
 198</head>
 199<body onload="runTests()">
 200
 201<p>
 202This tests that double-clicking a word that follows newline and span
 203</p>
 204
 205<div class="case">
 206<h3>minimum case</h3>
 207<div style="width:100pt">
 208abcd efgh ijkl mnop <b id="totest_minimum">select1</b>
 209</div>
 210</div>
 211
 212<div class="case">
 213<h3>with another word after the span</h3>
 214<div style="width:100pt">
 215abcd efgh ijkl mnop <b id="totest_before_after">select2</b> nottoselect
 216</div>
 217</div>
 218
 219<div class="case">
 220<h3>use linebreak as word separator (outside element)</h3>
 221<div style="width:100pt">
 222abcd efgh ijkl mnop
 223<b id="totest_linebreak_out">select3</b>
 224nottoselect
 225</div>
 226</div>
 227
 228<div class="case">
 229<h3>use tab as word separator (outside element)</h3>
 230<div style="width:100pt">
 231abcd efgh ijkl mnop <b id="totest_tab_out">select4</b> nottoselect
 232</div>
 233</div>
 234
 235<div class="case">
 236<h3>use multiple whitespaces as word separator (outside element)</h3>
 237<div style="width:100pt">
 238abcd efgh ijkl mnop <b id="totest_multiple_whitespaces_out">select5</b> nottoselect
 239</div>
 240</div>
 241
 242<div class="case">
 243<h3>use linebreak as word separator (inside element)</h3>
 244<div style="width:100pt">
 245abcd efgh ijkl mnop<b id="totest_linebreak_in">
 246select6
 247</b>nottoselect
 248</div>
 249</div>
 250
 251<div class="case">
 252<h3>use tab as word separator (inside element)</h3>
 253<div style="width:100pt">
 254abcd efgh ijkl mnop<b id="totest_tab_in"> select7 </b>nottoselect
 255</div>
 256</div>
 257
 258<div class="case">
 259<h3>use multiple whitespaces as word separator (inside element)</h3>
 260<div style="width:100pt">
 261abcd efgh ijkl mnop<b id="totest_multiple_whitespaces_in"> select8 </b>nottoselect
 262</div>
 263</div>
 264
 265<div class="case">
 266<h3>with another word in same the span</h3>
 267<div style="width:100pt">
 268abcd efgh ijkl mnop <b id="totest_multiple_word_in_span">select9 not</b> notyet
 269</div>
 270</div>
 271
 272<div class="case">
 273<h3>with another word before the span, in the same line</h3>
 274<div style="width:100pt">
 275abcd efgh ijkl mnop qrst <b id="totest_word_before_here_in_line">select10</b> notyet
 276</div>
 277</div>
 278
 279<div class="case">
 280<h3>a first half of word is inside b element</h3>
 281<div style="width:100pt">
 282abcd efgh ijkl mnop qrst <b id="totest_span_first_half">sel</b>ect11 notyet
 283</div>
 284</div>
 285
 286<div class="case">
 287<h3>a second half of word is inside b element</h3>
 288<div style="width:100pt">
 289abcd efgh ijkl mnop qrst sel<b id="totest_span_second_half">ect12</b> notyet
 290</div>
 291</div>
 292
 293<h2>cases for white-space: pre</h2>
 294<p>
 295Note: Here for pre, we change width value to 200 to prevent layout change on contentEditable enabled.
 296</p>
 297
 298<div class="case">
 299<h3>use linebreak as word separator (outside element, white-space:pre)</h3>
 300<div style="width:200pt;white-space:pre;">
 301abcd efgh ijkl mnop
 302<b id="totest_linebreak_out_pre">select1</b>
 303nottoselect
 304</div>
 305</div>
 306
 307<div class="case">
 308<h3>use tab as word separator (outside element, white-space:pre)</h3>
 309<div style="width:200pt;white-space:pre;">
 310abcd efgh ijkl mnop <b id="totest_tab_out_pre">select2</b> nottoselect
 311</div>
 312</div>
 313
 314<div class="case">
 315<h3>use multiple whitespaces as word separator (outside element, white-space:pre)</h3>
 316<div style="width:200pt;white-space:pre;">
 317abcd efgh ijkl mnop <b id="totest_multiple_whitespaces_out_pre">select3</b> nottoselect
 318</div>
 319</div>
 320
 321<div class="case">
 322<h3>use linebreak as word separator (inside element, white-space:pre)</h3>
 323<div style="width:200pt;white-space:pre;">
 324abcd efgh ijkl mnop<b id="totest_linebreak_in_pre">
 325select4
 326</b>nottoselect
 327</div>
 328</div>
 329
 330<div class="case">
 331<h3>use tab as word separator (inside element, white-space:pre)</h3>
 332<div style="width:200pt;white-space:pre;">
 333abcd efgh ijkl mnop<b id="totest_tab_in_pre"> select5 </b>nottoselect
 334</div>
 335</div>
 336
 337<div class="case">
 338<h3>use multiple whitespaces as word separator (inside element, white-space:pre)</h3>
 339<div style="width:200pt;white-space:pre;">
 340abcd efgh ijkl mnop<b id="totest_multiple_whitespaces_in_pre"> select6 </b>nottoselect
 341</div>
 342</div>
 343
 344<h2>cases for white-space: pre-wrap</h2>
 345
 346<div class="case">
 347<h3>use linebreak as word separator (outside element, white-space:pre-wrap)</h3>
 348<div style="width:100pt;white-space:pre-wrap;">
 349abcd efgh ijkl mnop
 350<b id="totest_linebreak_out_prewrap">select1</b>
 351nottoselect
 352</div>
 353</div>
 354
 355<div class="case">
 356<h3>use tab as word separator (outside element, white-space:pre-wrap)</h3>
 357<div style="width:100pt;white-space:pre-wrap;">
 358abcd efgh ijkl mnop <b id="totest_tab_out_prewrap">select2</b> nottoselect
 359</div>
 360</div>
 361
 362<div class="case">
 363<h3>use multiple whitespaces as word separator (outside element, white-space:pre-wrap)</h3>
 364<div style="width:100pt;white-space:pre-wrap;">
 365abcd efgh ijkl mnop <b id="totest_multiple_whitespaces_out_prewrap">select3</b> nottoselect
 366</div>
 367</div>
 368
 369<div class="case">
 370<h3>use linebreak as word separator (inside element, white-space:pre-wrap)</h3>
 371<div style="width:100pt;white-space:pre-wrap;">
 372abcd efgh ijkl mnop<b id="totest_linebreak_in_prewrap">
 373select4
 374</b>nottoselect
 375</div>
 376</div>
 377
 378<div class="case">
 379<h3>use tab as word separator (inside element, white-space:pre-wrap)</h3>
 380<div style="width:100pt;white-space:pre-wrap;">
 381abcd efgh ijkl mnop<b id="totest_tab_in_prewrap"> select5 </b>nottoselect
 382</div>
 383</div>
 384
 385<div class="case">
 386<h3>use multiple whitespaces as word separator (inside element, white-space:pre-wrap)</h3>
 387<div style="width:100pt;white-space:pre-wrap;">
 388abcd efgh ijkl mnop<b id="totest_multiple_whitespaces_in_prewrap"> select6 </b>nottoselect
 389</div>
 390</div>
 391
 392
 393
 394<h2>cases for white-space: pre-line</h2>
 395
 396<div class="case">
 397<h3>use linebreak as word separator (outside element, white-space:pre-line)</h3>
 398<div style="width:100pt;white-space:pre-line;">
 399abcd efgh ijkl mnop
 400<b id="totest_linebreak_out_preline">select1</b>
 401nottoselect
 402</div>
 403</div>
 404
 405<div class="case">
 406<h3>use tab as word separator (outside element, white-space:pre-line)</h3>
 407<div style="width:100pt;white-space:pre-line;">
 408abcd efgh ijkl mnop <b id="totest_tab_out_preline">select2</b> nottoselect
 409</div>
 410</div>
 411
 412<div class="case">
 413<h3>use multiple whitespaces as word separator (outside element, white-space:pre-line)</h3>
 414<div style="width:100pt;white-space:pre-line;">
 415abcd efgh ijkl mnop <b id="totest_multiple_whitespaces_out_preline">select3</b> nottoselect
 416</div>
 417</div>
 418
 419<div class="case">
 420<h3>use linebreak as word separator (inside element, white-space:pre-line)</h3>
 421<div style="width:100pt;white-space:pre-line;">
 422abcd efgh ijkl mnop<b id="totest_linebreak_in_preline">
 423select4
 424</b>nottoselect
 425</div>
 426</div>
 427
 428<div class="case">
 429<h3>use tab as word separator (inside element, white-space:pre-line)</h3>
 430<div style="width:100pt;white-space:pre-line;">
 431abcd efgh ijkl mnop<b id="totest_tab_in_preline"> select5 </b>nottoselect
 432</div>
 433</div>
 434
 435<div class="case">
 436<h3>use multiple whitespaces as word separator (inside element, white-space:pre-line)</h3>
 437<div style="width:100pt;white-space:pre-line;">
 438abcd efgh ijkl mnop<b id="totest_multiple_whitespaces_in_preline"> select6 </b>nottoselect
 439</div>
 440</div>
 441
 442<h2>cases for white-space: nowrap</h2>
 443<p>
 444Note: Although following cases have no line-breaks that had caused problem reported bug28036,
 445we add these for comprehensiveness.
 446</p>
 447
 448<div class="case">
 449<h3>use linebreak as word separator (outside element, white-space:nowrap)</h3>
 450<div style="width:100pt;white-space:nowrap;">
 451abcd efgh ijkl mnop
 452<b id="totest_linebreak_out_nowrap">select1</b>
 453nottoselect
 454</div>
 455</div>
 456
 457<div class="case">
 458<h3>use tab as word separator (outside element, white-space:nowrap)</h3>
 459<div style="width:100pt;white-space:nowrap;">
 460abcd efgh ijkl mnop <b id="totest_tab_out_nowrap">select2</b> nottoselect
 461</div>
 462</div>
 463
 464<div class="case">
 465<h3>use multiple whitespaces as word separator (outside element, white-space:nowrap)</h3>
 466<div style="width:100pt;white-space:nowrap;">
 467abcd efgh ijkl mnop <b id="totest_multiple_whitespaces_out_nowrap">select3</b> nottoselect
 468</div>
 469</div>
 470
 471<div class="case">
 472<h3>use linebreak as word separator (inside element, white-space:nowrap)</h3>
 473<div style="width:100pt;white-space:nowrap;">
 474abcd efgh ijkl mnop<b id="totest_linebreak_in_nowrap">
 475select4
 476</b>nottoselect
 477</div>
 478</div>
 479
 480<div class="case">
 481<h3>use tab as word separator (inside element, white-space:nowrap)</h3>
 482<div style="width:100pt;white-space:nowrap;">
 483abcd efgh ijkl mnop<b id="totest_tab_in_nowrap"> select5 </b>nottoselect
 484</div>
 485</div>
 486
 487<div class="case">
 488<h3>use multiple whitespaces as word separator (inside element, white-space:nowrap)</h3>
 489<div style="width:100pt;white-space:nowrap;">
 490abcd efgh ijkl mnop<b id="totest_multiple_whitespaces_in_nowrap"> select6 </b>nottoselect
 491</div>
 492</div>
 493
 494<!--
 495
 496<h2>cases for source-originated line-breaks with white-space: pre-* family</h2>
 497
 498<div class="case">
 499<h3>white-space:pre</h3>
 500<div style="width:200pt;white-space:pre;background-color:lightgray;">
 501abcd efgh ijkl mnop
 502<b id="totest_sourcebreak_pre">select1</b>
 503nottoselect
 504</div>
 505</div>
 506
 507<h3>white-space:pre-wrap</h3>
 508<div style="width:200pt;white-space:pre-wrap;background-color:lightgray;">
 509abcd efgh ijkl mnop
 510<b id="totest_sourcebreak_prewrap">select2</b>
 511nottoselect
 512</div>
 513</div>
 514
 515<h3>white-space:pre-line</h3>
 516<div style="width:200pt;white-space:pre-line;background-color:lightgray;">
 517abcd efgh ijkl mnop
 518<b id="totest_sourcebreak_preline">select3</b>
 519nottoselect
 520</div>
 521</div>
 522
 523-->
 524
 525<div><span id="heightMeasure">x</span></div>
 526
 527<pre id="log">
 528</pre>
 529
 530</body>
 531</html>

WebCore/ChangeLog

 12009-12-15 MORITA Hajime <morrita@gmail.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Bug 28306: double-clicking a word inside <b> beside newline select two words
 6 https://bugs.webkit.org/show_bug.cgi?id=28306
 7
 8 SimplifiedBackwardsTextIterator missed trailing whitespaces just
 9 before folding line-break, which is used to detect word
 10 boundaries. This fix checks strings on RenderText and expand text
 11 range on SimplifiedBackwardsTextIterator to include trailing
 12 whitespaces if availble.
 13
 14 Test: editing/selection/doubleclick-beside-cr-span.html
 15
 16 * editing/TextIterator.cpp:
 17 (WebCore::collapsedSpaceLength):
 18 (WebCore::maxOffsetIncludingCollapsedSpaces):
 19 (WebCore::SimplifiedBackwardsTextIterator::advance):
 20
1212009-12-12 Kenneth Russell <kbr@google.com>
222
323 Reviewed by Oliver Hunt.

WebCore/editing/TextIterator.cpp

@@static bool shouldEmitExtraNewlineForNode(Node* node)
705705 return false;
706706}
707707
 708static int collapsedSpaceLength(RenderText* renderer, int textEnd)
 709{
 710 const UChar* characters = renderer->text()->characters();
 711 int length = renderer->text()->length();
 712 for (int i = textEnd; i < length; ++i) {
 713 if (!renderer->style()->isCollapsibleWhiteSpace(characters[i]))
 714 return i - textEnd;
 715 }
 716
 717 return length - textEnd;
 718}
 719
 720static int maxOffsetIncludingCollapsedSpaces(Node* node)
 721{
 722 int offset = caretMaxOffset(node);
 723
 724 if (node->renderer() && node->renderer()->isText())
 725 offset += collapsedSpaceLength(toRenderText(node->renderer()), offset);
 726
 727 return offset;
 728}
 729
708730// Whether or not we should emit a character as we enter m_node (if it's a container) or as we hit it (if it's atomic).
709731bool TextIterator::shouldRepresentNodeOffsetZero()
710732{

@@void SimplifiedBackwardsTextIterator::advance()
10291051 m_node = next;
10301052 if (m_node)
10311053 pushFullyClippedState(m_fullyClippedStack, m_node);
1032  m_offset = m_node ? caretMaxOffset(m_node) : 0;
 1054 // For the purpose of word boundary detection,
 1055 // we should iterate all visible text and trailing (collapsed) whitespaces.
 1056 m_offset = m_node ? maxOffsetIncludingCollapsedSpaces(m_node) : 0;
10331057 m_handledNode = false;
10341058 m_handledChildren = false;
10351059