Diff
Modified: trunk/LayoutTests/ChangeLog (281462 => 281463)
--- trunk/LayoutTests/ChangeLog 2021-08-23 19:17:30 UTC (rev 281462)
+++ trunk/LayoutTests/ChangeLog 2021-08-23 19:38:18 UTC (rev 281463)
@@ -1,3 +1,14 @@
+2021-08-23 Alan Bujtas <za...@apple.com>
+
+ Pre-formatted content gets distorted when attempting to select content
+ https://bugs.webkit.org/show_bug.cgi?id=228655
+ <rdar://81288187>
+
+ Reviewed by Simon Fraser.
+
+ * fast/text/no-wrap-in-pre-with-word-wrap-expected.html: Added.
+ * fast/text/no-wrap-in-pre-with-word-wrap.html: Added.
+
2021-08-23 Eric Hutchison <ehutchi...@apple.com>
[Monterey] fast/animation/request-animation-frame-throttling-detached-iframe.html is failing.
Added: trunk/LayoutTests/fast/text/no-wrap-in-pre-with-word-wrap-expected.html (0 => 281463)
--- trunk/LayoutTests/fast/text/no-wrap-in-pre-with-word-wrap-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/no-wrap-in-pre-with-word-wrap-expected.html 2021-08-23 19:38:18 UTC (rev 281463)
@@ -0,0 +1,8 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+pre {
+ width: 100px;
+ font-family: Ahem;
+}
+</style>
+<pre>Wrapping is not allowed. We should not break the content even when word-wrap: break-word is on.</pre>
Added: trunk/LayoutTests/fast/text/no-wrap-in-pre-with-word-wrap.html (0 => 281463)
--- trunk/LayoutTests/fast/text/no-wrap-in-pre-with-word-wrap.html (rev 0)
+++ trunk/LayoutTests/fast/text/no-wrap-in-pre-with-word-wrap.html 2021-08-23 19:38:18 UTC (rev 281463)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+pre {
+ word-wrap: break-word;
+ width: 100px;
+ font-family: Ahem;
+}
+</style>
+<pre>Wrapping is not allowed. We should not break the content even when word-wrap: break-word is on.</pre>
Modified: trunk/LayoutTests/platform/ios/fast/forms/basic-textareas-expected.txt (281462 => 281463)
--- trunk/LayoutTests/platform/ios/fast/forms/basic-textareas-expected.txt 2021-08-23 19:17:30 UTC (rev 281462)
+++ trunk/LayoutTests/platform/ios/fast/forms/basic-textareas-expected.txt 2021-08-23 19:38:18 UTC (rev 281463)
@@ -588,14 +588,11 @@
text run at (0,28) width 56: "TUVWXYZ"
text run at (55,28) width 4: " "
text run at (0,42) width 127: "abcdefghijklmnopqrstuv"
- layer at (3,644) size 168x34 clip at (4,645) size 151x32 scrollHeight 60
+ layer at (3,644) size 168x34 clip at (4,645) size 151x17 scrollWidth 434 scrollHeight 18
RenderTextControl {TEXTAREA} at (3,33) size 168x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
- RenderBlock {DIV} at (6,3) size 141x56
- RenderText {#text} at (0,0) size 137x56
- text run at (0,0) width 135: "Lorem ipsum dolor ABCD"
- text run at (0,14) width 132: "EFGHIJKLMNOPQRSTUV"
- text run at (0,28) width 137: "WXYZ abcdefghijklmnopq"
- text run at (0,42) width 27: "rstuv"
+ RenderBlock {DIV} at (6,3) size 156x14
+ RenderText {#text} at (0,0) size 429x14
+ text run at (0,0) width 429: "Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
layer at (177,644) size 168x34 clip at (178,645) size 151x32 scrollHeight 60
RenderTextControl {TEXTAREA} at (3,33) size 168x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
RenderBlock {DIV} at (6,3) size 141x56
@@ -1325,14 +1322,11 @@
text run at (0,28) width 56: "TUVWXYZ"
text run at (55,28) width 4: " "
text run at (0,42) width 127: "abcdefghijklmnopqrstuv"
- layer at (3,587) size 168x34 clip at (4,588) size 151x32 scrollHeight 60
+ layer at (3,587) size 168x34 clip at (4,588) size 151x17 scrollWidth 434 scrollHeight 18
RenderTextControl {TEXTAREA} at (3,33) size 168x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
- RenderBlock {DIV} at (6,3) size 141x56
- RenderText {#text} at (0,0) size 137x56
- text run at (0,0) width 135: "Lorem ipsum dolor ABCD"
- text run at (0,14) width 132: "EFGHIJKLMNOPQRSTUV"
- text run at (0,28) width 137: "WXYZ abcdefghijklmnopq"
- text run at (0,42) width 27: "rstuv"
+ RenderBlock {DIV} at (6,3) size 156x14
+ RenderText {#text} at (0,0) size 429x14
+ text run at (0,0) width 429: "Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
layer at (177,587) size 168x34 clip at (178,588) size 151x32 scrollHeight 60
RenderTextControl {TEXTAREA} at (3,33) size 168x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
RenderBlock {DIV} at (6,3) size 141x56
Modified: trunk/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt (281462 => 281463)
--- trunk/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt 2021-08-23 19:17:30 UTC (rev 281462)
+++ trunk/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt 2021-08-23 19:38:18 UTC (rev 281463)
@@ -596,14 +596,11 @@
text run at (0,13) width 140: "ABCDEFGHIJKLMNOPQRS"
text run at (0,26) width 56: "TUVWXYZ"
text run at (0,39) width 127: "abcdefghijklmnopqrstuv"
- layer at (3,587) size 161x32 clip at (4,588) size 144x30 scrollHeight 56
+ layer at (3,587) size 161x32 clip at (4,588) size 144x15 scrollWidth 430 scrollHeight 17
RenderTextControl {TEXTAREA} at (3,31) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
- RenderBlock {DIV} at (3,3) size 140x52
- RenderText {#text} at (0,0) size 137x52
- text run at (0,0) width 135: "Lorem ipsum dolor ABCD"
- text run at (0,13) width 132: "EFGHIJKLMNOPQRSTUV"
- text run at (0,26) width 137: "WXYZ abcdefghijklmnopq"
- text run at (0,39) width 27: "rstuv"
+ RenderBlock {DIV} at (3,3) size 155x13
+ RenderText {#text} at (0,0) size 429x13
+ text run at (0,0) width 429: "Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
layer at (170,587) size 161x32 clip at (171,588) size 144x30 scrollHeight 56
RenderTextControl {TEXTAREA} at (3,31) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 140x52
@@ -1304,14 +1301,11 @@
text run at (0,13) width 140: "ABCDEFGHIJKLMNOPQRS"
text run at (0,26) width 56: "TUVWXYZ"
text run at (0,39) width 127: "abcdefghijklmnopqrstuv"
- layer at (3,560) size 161x32 clip at (4,561) size 144x30 scrollHeight 56
+ layer at (3,560) size 161x32 clip at (4,561) size 144x15 scrollWidth 430 scrollHeight 17
RenderTextControl {TEXTAREA} at (3,31) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
- RenderBlock {DIV} at (3,3) size 140x52
- RenderText {#text} at (0,0) size 137x52
- text run at (0,0) width 135: "Lorem ipsum dolor ABCD"
- text run at (0,13) width 132: "EFGHIJKLMNOPQRSTUV"
- text run at (0,26) width 137: "WXYZ abcdefghijklmnopq"
- text run at (0,39) width 27: "rstuv"
+ RenderBlock {DIV} at (3,3) size 155x13
+ RenderText {#text} at (0,0) size 429x13
+ text run at (0,0) width 429: "Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
layer at (170,560) size 161x32 clip at (171,561) size 144x30 scrollHeight 56
RenderTextControl {TEXTAREA} at (3,31) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 140x52
Modified: trunk/LayoutTests/platform/mac/fast/text/whitespace/tab-character-basics-expected.txt (281462 => 281463)
--- trunk/LayoutTests/platform/mac/fast/text/whitespace/tab-character-basics-expected.txt 2021-08-23 19:17:30 UTC (rev 281462)
+++ trunk/LayoutTests/platform/mac/fast/text/whitespace/tab-character-basics-expected.txt 2021-08-23 19:38:18 UTC (rev 281463)
@@ -1,8 +1,8 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
-layer at (0,0) size 800x502
- RenderBlock {HTML} at (0,0) size 800x502
- RenderBody {BODY} at (8,8) size 646x486 [border: (3px solid #FF0000)]
+layer at (0,0) size 800x481
+ RenderBlock {HTML} at (0,0) size 800x481
+ RenderBody {BODY} at (8,8) size 646x465 [border: (3px solid #FF0000)]
RenderBlock {P} at (3,19) size 640x21 [color=#0000FF]
RenderText {#text} at (0,0) size 509x20
text run at (0,0) width 509: "-- Following text and list are whitespace:NORMAL only"
@@ -41,22 +41,20 @@
RenderListMarker at (-34,0) size 29x20: "3"
RenderText {#text} at (0,0) size 87x20
text run at (0,0) width 87: "ccc\x{9}X"
- RenderBlock {P} at (3,309) size 640x63
+ RenderBlock {P} at (3,309) size 640x42
RenderText {#text} at (0,0) size 490x20
text run at (0,0) width 490: "012345678901234567890123456789012345678901234567890"
RenderBR {BR} at (489,0) size 1x20
- RenderText {#text} at (0,21) size 634x41
- text run at (0,21) width 634: "X\x{9}\x{9}XX\x{9}\x{9}XXX\x{9}\x{9}XXXX\x{9}\x{9}XX"
- text run at (0,42) width 29: "XXX"
- RenderBlock {P} at (3,388) size 640x21 [color=#0000FF]
+ RenderText {#text} at (0,21) size 663x20
+ text run at (0,21) width 663: "X\x{9}\x{9}XX\x{9}\x{9}XXX\x{9}\x{9}XXXX\x{9}\x{9}XXXXX"
+ RenderBlock {P} at (3,367) size 640x21 [color=#0000FF]
RenderText {#text} at (0,0) size 577x20
text run at (0,0) width 577: "-- Following text mixes whitespace:NORMAL and whitespace:PRE"
- RenderBlock {P} at (3,425) size 640x42
+ RenderBlock {P} at (3,404) size 640x42
RenderText {#text} at (0,0) size 471x20
text run at (0,0) width 471: "AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ"
- RenderInline {SPAN} at (0,0) size 615x41
- RenderText {#text} at (470,0) size 615x41
- text run at (470,0) width 145: "\x{9}\x{9}"
- text run at (0,21) width 154: "\x{9}\x{9}"
- RenderText {#text} at (153,21) size 40x20
- text run at (153,21) width 40: "KKKK"
+ RenderInline {SPAN} at (0,0) size 299x20
+ RenderText {#text} at (470,0) size 299x20
+ text run at (470,0) width 299: "\x{9}\x{9}\x{9}\x{9}"
+ RenderText {#text} at (0,21) size 39x20
+ text run at (0,21) width 39: "KKKK"
Modified: trunk/Source/WebCore/ChangeLog (281462 => 281463)
--- trunk/Source/WebCore/ChangeLog 2021-08-23 19:17:30 UTC (rev 281462)
+++ trunk/Source/WebCore/ChangeLog 2021-08-23 19:38:18 UTC (rev 281463)
@@ -1,3 +1,24 @@
+2021-08-23 Alan Bujtas <za...@apple.com>
+
+ Pre-formatted content gets distorted when attempting to select content
+ https://bugs.webkit.org/show_bug.cgi?id=228655
+ <rdar://81288187>
+
+ Reviewed by Simon Fraser.
+
+ https://drafts.csswg.org/css-text/#overflow-wrap-property
+
+ "This property specifies whether the UA may break at otherwise disallowed points within
+ a line to prevent overflow, when an otherwise-unbreakable string is too long to fit within the line box.
+ It only has an effect when white-space allows wrapping."
+
+ (also see https://trac.webkit.org/changeset/10095/webkit where the wrapping behavior was introduced)
+
+ Test: fast/text/no-wrap-in-pre-with-word-wrap.html
+
+ * rendering/line/BreakingContext.h:
+ (WebCore::BreakingContext::handleText):
+
2021-08-23 Martin Robinson <mrobin...@webkit.org>
Sticky position should not use transformed position to compute sticky offset.
Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (281462 => 281463)
--- trunk/Source/WebCore/rendering/line/BreakingContext.h 2021-08-23 19:17:30 UTC (rev 281462)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h 2021-08-23 19:38:18 UTC (rev 281463)
@@ -701,7 +701,8 @@
bool breakNBSP = m_autoWrap && style.nbspMode() == NBSPMode::Space;
// Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
// which is only possible if the word is the first thing on the line.
- bool breakWords = style.breakWords() && ((m_autoWrap && (!m_width.committedWidth() && !m_width.hasCommittedReplaced())) || m_currWS == WhiteSpace::Pre);
+ auto isWrappingAllowed = !(m_currWS == WhiteSpace::Pre || m_currWS == WhiteSpace::NoWrap);
+ bool breakWords = isWrappingAllowed && style.breakWords() && !m_width.committedWidth() && !m_width.hasCommittedReplaced();
bool midWordBreak = false;
bool breakAnywhere = style.lineBreak() == LineBreak::Anywhere && m_autoWrap;
bool breakAll = (style.wordBreak() == WordBreak::BreakAll || breakAnywhere) && m_autoWrap;