Diff
Modified: trunk/LayoutTests/ChangeLog (249962 => 249963)
--- trunk/LayoutTests/ChangeLog 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/ChangeLog 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,3 +1,22 @@
+2019-09-17 Antti Koivisto <[email protected]>
+
+ TextIterator should convert tabs to spaces
+ https://bugs.webkit.org/show_bug.cgi?id=201863
+
+ Reviewed by Zalan Bujtas.
+
+ * editing/pasteboard/5761530-1.html:
+
+ Set body to 'whitespace:pre' so tabs don't get lost in test output.
+
+ * fast/tokenizer/script_extra_close-expected.txt:
+ * imported/blink/fast/text/font-linux-normalize-expected.txt:
+ * platform/mac/editing/pasteboard/5761530-1-expected.txt: Removed.
+
+ No need for platform specific result.
+
+ * editing/pasteboard/5761530-1-expected.txt:
+
2019-09-17 Chris Dumez <[email protected]>
REGRESSION (iOS 13): rAF stops firing when navigating away cross-origin and then back
Modified: trunk/LayoutTests/editing/pasteboard/5761530-1-expected.txt (249962 => 249963)
--- trunk/LayoutTests/editing/pasteboard/5761530-1-expected.txt 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/editing/pasteboard/5761530-1-expected.txt 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,3 +1,4 @@
This tests to see that tabs are put into tab spans when they are copied individually. The pasted tab should be inside of a tab span, not a style span. To run the test manually, paste and then inspect the editable region, and ensure that there is a tab span at the beginning of the editable div.
<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx
+
Modified: trunk/LayoutTests/editing/pasteboard/5761530-1.html (249962 => 249963)
--- trunk/LayoutTests/editing/pasteboard/5761530-1.html 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/editing/pasteboard/5761530-1.html 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,10 +1,8 @@
<div id="description">This tests to see that tabs are put into tab spans when they are copied individually. The pasted tab should be inside of a tab span, not a style span. To run the test manually, paste and then inspect the editable region, and ensure that there is a tab span at the beginning of the editable div.</div>
<div id="edit" contenteditable="true"><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx</div>
<script>
-if (window.testRunner && window.internals) {
+if (window.testRunner && window.internals)
window.testRunner.dumpAsText();
- internals.settings.setSimpleLineLayoutEnabled(false);
-}
edit = document.getElementById("edit");
window.getSelection().setPosition(edit, 0);
@@ -12,6 +10,8 @@
document.execCommand("Copy");
window.getSelection().modify("move", "backward", "character");
document.execCommand("Paste");
-if (window.testRunner)
+if (window.testRunner) {
document.body.innerText = document.getElementById("description").innerText + "\n\n" + edit.innerHTML;
+ document.body.style.whiteSpace = 'pre';
+}
</script>
Modified: trunk/LayoutTests/fast/tokenizer/script_extra_close-expected.txt (249962 => 249963)
--- trunk/LayoutTests/fast/tokenizer/script_extra_close-expected.txt 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/fast/tokenizer/script_extra_close-expected.txt 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1 +1 @@
-TEST... PASSED. This text should show up.
+TEST... PASSED. This text should show up.
Modified: trunk/LayoutTests/imported/blink/fast/text/font-linux-normalize-expected.txt (249962 => 249963)
--- trunk/LayoutTests/imported/blink/fast/text/font-linux-normalize-expected.txt 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/imported/blink/fast/text/font-linux-normalize-expected.txt 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,2 +1,2 @@
-क़उ ä
+क़उ ä
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (249962 => 249963)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,3 +1,13 @@
+2019-09-17 Antti Koivisto <[email protected]>
+
+ TextIterator should convert tabs to spaces
+ https://bugs.webkit.org/show_bug.cgi?id=201863
+
+ Reviewed by Zalan Bujtas.
+
+ * web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-expected.txt:
+ * web-platform-tests/innerText/getter-expected.txt:
+
2019-09-17 Chris Dumez <[email protected]>
Unreviewed, address flakiness of imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-expected.txt (249962 => 249963)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-expected.txt 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter-expected.txt 2019-09-17 17:31:20 UTC (rev 249963)
@@ -7,7 +7,7 @@
PASS Internal whitespace compressed ("<div>abc def")
PASS \n converted to space ("<div>abc\ndef")
PASS \r converted to space ("<div>abc\rdef")
-FAIL \t converted to space ("<div>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef"
+PASS \t converted to space ("<div>abc\tdef")
FAIL Trailing whitespace before hard line break removed ("<div>abc <br>def") assert_equals: expected "abc\ndef" but got "abc \ndef"
PASS Leading whitespace after hard line break removed ("<div>abc<br> def")
PASS Leading whitespace preserved ("<pre> abc")
@@ -34,7 +34,7 @@
PASS Internal whitespace collapsed ("<div style='white-space:pre-line'>abc def")
FAIL \n preserved ("<div style='white-space:pre-line'>abc\ndef") assert_equals: expected "abc\ndef" but got "abc def"
FAIL \r converted to newline ("<div style='white-space:pre-line'>abc\rdef") assert_equals: expected "abc\ndef" but got "abc def"
-FAIL \t converted to space ("<div style='white-space:pre-line'>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef"
+PASS \t converted to space ("<div style='white-space:pre-line'>abc\tdef")
PASS Whitespace collapses across element boundaries ("<div><span>abc </span> def")
PASS Whitespace collapses across element boundaries ("<div><span>abc </span><span></span> def")
FAIL Whitespace collapses across element boundaries ("<div><span>abc </span><span style='white-space:pre'></span> def") assert_equals: expected "abc def" but got "abc def"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/getter-expected.txt (249962 => 249963)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/getter-expected.txt 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/innerText/getter-expected.txt 2019-09-17 17:31:20 UTC (rev 249963)
@@ -7,7 +7,7 @@
PASS Internal whitespace compressed ("<div>abc def")
PASS \n converted to space ("<div>abc\ndef")
PASS \r converted to space ("<div>abc\rdef")
-FAIL \t converted to space ("<div>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef"
+PASS \t converted to space ("<div>abc\tdef")
FAIL Trailing whitespace before hard line break removed ("<div>abc <br>def") assert_equals: expected "abc\ndef" but got "abc \ndef"
PASS Leading whitespace preserved ("<pre> abc")
PASS Trailing whitespace preserved ("<pre>abc ")
@@ -33,7 +33,7 @@
PASS Internal whitespace collapsed ("<div style='white-space:pre-line'>abc def")
FAIL \n preserved ("<div style='white-space:pre-line'>abc\ndef") assert_equals: expected "abc\ndef" but got "abc def"
FAIL \r converted to newline ("<div style='white-space:pre-line'>abc\rdef") assert_equals: expected "abc\ndef" but got "abc def"
-FAIL \t converted to space ("<div style='white-space:pre-line'>abc\tdef") assert_equals: expected "abc def" but got "abc\tdef"
+PASS \t converted to space ("<div style='white-space:pre-line'>abc\tdef")
PASS Whitespace collapses across element boundaries ("<div><span>abc </span> def")
PASS Whitespace collapses across element boundaries ("<div><span>abc </span><span></span> def")
FAIL Whitespace collapses across element boundaries ("<div><span>abc </span><span style='white-space:pre'></span> def") assert_equals: expected "abc def" but got "abc def"
Deleted: trunk/LayoutTests/platform/mac/editing/pasteboard/5761530-1-expected.txt (249962 => 249963)
--- trunk/LayoutTests/platform/mac/editing/pasteboard/5761530-1-expected.txt 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/LayoutTests/platform/mac/editing/pasteboard/5761530-1-expected.txt 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,3 +0,0 @@
-This tests to see that tabs are put into tab spans when they are copied individually. The pasted tab should be inside of a tab span, not a style span. To run the test manually, paste and then inspect the editable region, and ensure that there is a tab span at the beginning of the editable div.
-
-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>xxx
Modified: trunk/Source/WebCore/ChangeLog (249962 => 249963)
--- trunk/Source/WebCore/ChangeLog 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/Source/WebCore/ChangeLog 2019-09-17 17:31:20 UTC (rev 249963)
@@ -1,3 +1,20 @@
+2019-09-17 Antti Koivisto <[email protected]>
+
+ TextIterator should convert tabs to spaces
+ https://bugs.webkit.org/show_bug.cgi?id=201863
+
+ Reviewed by Zalan Bujtas.
+
+ As seen in tests
+
+ imported/w3c/web-platform-tests/innerText/getter.html
+ imported/w3c/web-platform-tests/html/dom/elements/the-innertext-idl-attribute/getter.html
+
+ The old simple line layout path in TextIterator used to do this.
+
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::handleTextBox):
+
2019-09-17 Zalan Bujtas <[email protected]>
[LFC[MarginCollapsing] MarginCollapse::estimatedMarginBefore should take pre-computed non-collapsed margin values.
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (249962 => 249963)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2019-09-17 17:12:04 UTC (rev 249962)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2019-09-17 17:31:20 UTC (rev 249963)
@@ -671,17 +671,23 @@
nextTextBox.traverseNextInTextOrder();
if (runStart < runEnd) {
- // Handle either a single newline character (which becomes a space),
- // or a run of characters that does not include a newline.
- // This effectively translates newlines to spaces without copying the text.
- if (rendererText[runStart] == '\n') {
+ auto isNewlineOrTab = [&](UChar character) {
+ return character == '\n' || character == '\t';
+ };
+ // Handle either a single newline or tab character (which becomes a space),
+ // or a run of characters that does not include newlines or tabs.
+ // This effectively translates newlines and tabs to spaces without copying the text.
+ if (isNewlineOrTab(rendererText[runStart])) {
emitCharacter(' ', textNode, nullptr, runStart, runStart + 1);
m_offset = runStart + 1;
} else {
- size_t subrunEnd = rendererText.find('\n', runStart);
- if (subrunEnd == notFound || subrunEnd > runEnd) {
- subrunEnd = runEnd;
- bool lastSpaceCollapsedByNextNonTextBox = !nextTextBox && (m_behavior & TextIteratorBehavesAsIfNodesFollowing) && rendererText.length() > runEnd;
+ auto subrunEnd = runStart + 1;
+ for (; subrunEnd < runEnd; ++subrunEnd) {
+ if (isNewlineOrTab(rendererText[subrunEnd]))
+ break;
+ }
+ if (subrunEnd == runEnd && (m_behavior & TextIteratorBehavesAsIfNodesFollowing)) {
+ bool lastSpaceCollapsedByNextNonTextBox = !nextTextBox && rendererText.length() > subrunEnd && rendererText[subrunEnd] == ' ';
if (lastSpaceCollapsedByNextNonTextBox)
++subrunEnd; // runEnd stopped before last space. Increment by one to restore the space.
}