Changeset 249963 in webkit
- Timestamp:
- Sep 17, 2019 10:31:20 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249961 r249963 1 2019-09-17 Antti Koivisto <antti@apple.com> 2 3 TextIterator should convert tabs to spaces 4 https://bugs.webkit.org/show_bug.cgi?id=201863 5 6 Reviewed by Zalan Bujtas. 7 8 * editing/pasteboard/5761530-1.html: 9 10 Set body to 'whitespace:pre' so tabs don't get lost in test output. 11 12 * fast/tokenizer/script_extra_close-expected.txt: 13 * imported/blink/fast/text/font-linux-normalize-expected.txt: 14 * platform/mac/editing/pasteboard/5761530-1-expected.txt: Removed. 15 16 No need for platform specific result. 17 18 * editing/pasteboard/5761530-1-expected.txt: 19 1 20 2019-09-17 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/LayoutTests/editing/pasteboard/5761530-1-expected.txt
r180172 r249963 2 2 3 3 <span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx 4 -
trunk/LayoutTests/editing/pasteboard/5761530-1.html
r244854 r249963 2 2 <div id="edit" contenteditable="true"><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx</div> 3 3 <script> 4 if (window.testRunner && window.internals) {4 if (window.testRunner && window.internals) 5 5 window.testRunner.dumpAsText(); 6 internals.settings.setSimpleLineLayoutEnabled(false);7 }8 6 edit = document.getElementById("edit"); 9 7 … … 13 11 window.getSelection().modify("move", "backward", "character"); 14 12 document.execCommand("Paste"); 15 if (window.testRunner) 13 if (window.testRunner) { 16 14 document.body.innerText = document.getElementById("description").innerText + "\n\n" + edit.innerHTML; 15 document.body.style.whiteSpace = 'pre'; 16 } 17 17 </script> -
trunk/LayoutTests/fast/tokenizer/script_extra_close-expected.txt
r249895 r249963 1 TEST... 1 TEST... PASSED. This text should show up. -
trunk/LayoutTests/imported/blink/fast/text/font-linux-normalize-expected.txt
r190629 r249963 1 क़उ 1 क़उ ä 2 2 -
trunk/LayoutTests/imported/w3c/ChangeLog
r249957 r249963 1 2019-09-17 Antti Koivisto <antti@apple.com> 2 3 TextIterator should convert tabs to spaces 4 https://bugs.webkit.org/show_bug.cgi?id=201863 5 6 Reviewed by Zalan Bujtas. 7 8 * web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-expected.txt: 9 * web-platform-tests/innerText/getter-expected.txt: 10 1 11 2019-09-17 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-expected.txt
r249895 r249963 8 8 PASS \n converted to space ("<div>abc\ndef") 9 9 PASS \r converted to space ("<div>abc\rdef") 10 FAIL \t converted to space ("<div>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef" 10 PASS \t converted to space ("<div>abc\tdef") 11 11 FAIL Trailing whitespace before hard line break removed ("<div>abc <br>def") assert_equals: expected "abc\ndef" but got "abc \ndef" 12 12 PASS Leading whitespace after hard line break removed ("<div>abc<br> def") … … 35 35 FAIL \n preserved ("<div style='white-space:pre-line'>abc\ndef") assert_equals: expected "abc\ndef" but got "abc def" 36 36 FAIL \r converted to newline ("<div style='white-space:pre-line'>abc\rdef") assert_equals: expected "abc\ndef" but got "abc def" 37 FAIL \t converted to space ("<div style='white-space:pre-line'>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef" 37 PASS \t converted to space ("<div style='white-space:pre-line'>abc\tdef") 38 38 PASS Whitespace collapses across element boundaries ("<div><span>abc </span> def") 39 39 PASS Whitespace collapses across element boundaries ("<div><span>abc </span><span></span> def") -
trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/getter-expected.txt
r249895 r249963 8 8 PASS \n converted to space ("<div>abc\ndef") 9 9 PASS \r converted to space ("<div>abc\rdef") 10 FAIL \t converted to space ("<div>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef" 10 PASS \t converted to space ("<div>abc\tdef") 11 11 FAIL Trailing whitespace before hard line break removed ("<div>abc <br>def") assert_equals: expected "abc\ndef" but got "abc \ndef" 12 12 PASS Leading whitespace preserved ("<pre> abc") … … 34 34 FAIL \n preserved ("<div style='white-space:pre-line'>abc\ndef") assert_equals: expected "abc\ndef" but got "abc def" 35 35 FAIL \r converted to newline ("<div style='white-space:pre-line'>abc\rdef") assert_equals: expected "abc\ndef" but got "abc def" 36 FAIL \t converted to space ("<div style='white-space:pre-line'>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef" 36 PASS \t converted to space ("<div style='white-space:pre-line'>abc\tdef") 37 37 PASS Whitespace collapses across element boundaries ("<div><span>abc </span> def") 38 38 PASS Whitespace collapses across element boundaries ("<div><span>abc </span><span></span> def") -
trunk/Source/WebCore/ChangeLog
r249955 r249963 1 2019-09-17 Antti Koivisto <antti@apple.com> 2 3 TextIterator should convert tabs to spaces 4 https://bugs.webkit.org/show_bug.cgi?id=201863 5 6 Reviewed by Zalan Bujtas. 7 8 As seen in tests 9 10 imported/w3c/web-platform-tests/innerText/getter.html 11 imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter.html 12 13 The old simple line layout path in TextIterator used to do this. 14 15 * editing/TextIterator.cpp: 16 (WebCore::TextIterator::handleTextBox): 17 1 18 2019-09-17 Zalan Bujtas <zalan@apple.com> 2 19 -
trunk/Source/WebCore/editing/TextIterator.cpp
r249943 r249963 672 672 673 673 if (runStart < runEnd) { 674 // Handle either a single newline character (which becomes a space), 675 // or a run of characters that does not include a newline. 676 // This effectively translates newlines to spaces without copying the text. 677 if (rendererText[runStart] == '\n') { 674 auto isNewlineOrTab = [&](UChar character) { 675 return character == '\n' || character == '\t'; 676 }; 677 // Handle either a single newline or tab character (which becomes a space), 678 // or a run of characters that does not include newlines or tabs. 679 // This effectively translates newlines and tabs to spaces without copying the text. 680 if (isNewlineOrTab(rendererText[runStart])) { 678 681 emitCharacter(' ', textNode, nullptr, runStart, runStart + 1); 679 682 m_offset = runStart + 1; 680 683 } else { 681 size_t subrunEnd = rendererText.find('\n', runStart); 682 if (subrunEnd == notFound || subrunEnd > runEnd) { 683 subrunEnd = runEnd; 684 bool lastSpaceCollapsedByNextNonTextBox = !nextTextBox && (m_behavior & TextIteratorBehavesAsIfNodesFollowing) && rendererText.length() > runEnd; 684 auto subrunEnd = runStart + 1; 685 for (; subrunEnd < runEnd; ++subrunEnd) { 686 if (isNewlineOrTab(rendererText[subrunEnd])) 687 break; 688 } 689 if (subrunEnd == runEnd && (m_behavior & TextIteratorBehavesAsIfNodesFollowing)) { 690 bool lastSpaceCollapsedByNextNonTextBox = !nextTextBox && rendererText.length() > subrunEnd && rendererText[subrunEnd] == ' '; 685 691 if (lastSpaceCollapsedByNextNonTextBox) 686 692 ++subrunEnd; // runEnd stopped before last space. Increment by one to restore the space.
Note: See TracChangeset
for help on using the changeset viewer.