Skip to content

Commit

Permalink
[Quirks mode only] "Do not trim trailing whitespace followed by <br>"…
Browse files Browse the repository at this point in the history
… quirk causes lines to stretch

https://bugs.webkit.org/show_bug.cgi?id=139199

Reviewed by Antti Koivisto.

Remove legacy quirk (now we match blink and gecko).

(table-col-indent-crash.html change is specific to -webkit-user-modify)

* Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.cpp:
(WebCore::Layout::InlineFormattingQuirks::shouldPreserveTrailingWhitespace const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingQuirks.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):

Canonical link: https://commits.webkit.org/263291@main
  • Loading branch information
alanbaradlay committed Apr 23, 2023
1 parent 7f7aade commit 20416c8
Show file tree
Hide file tree
Showing 206 changed files with 4,019 additions and 5,520 deletions.
Expand Up @@ -9,7 +9,7 @@ This test ensures we compute the relative frame of table objects correctly.

{ AXRole: AXStaticText AXValue: Ruritanian } has AXRelativeFrame: NSRect: {{191, 33}, {77, 18}}

{ AXRole: AXStaticText AXValue: Population } has AXRelativeFrame: NSRect: {{190, 51}, {80, 18}}
{ AXRole: AXStaticText AXValue: Population } has AXRelativeFrame: NSRect: {{192, 51}, {76, 18}}

{ AXRole: AXStaticText AXValue: Survey } has AXRelativeFrame: NSRect: {{205, 69}, {49, 18}}

Expand Down Expand Up @@ -101,7 +101,7 @@ Moving the table down by 3000px and scrolling down 500px.

{ AXRole: AXStaticText AXValue: Ruritanian } has AXRelativeFrame: NSRect: {{184, 2525}, {77, 18}}

{ AXRole: AXStaticText AXValue: Population } has AXRelativeFrame: NSRect: {{182, 2543}, {80, 18}}
{ AXRole: AXStaticText AXValue: Population } has AXRelativeFrame: NSRect: {{184, 2543}, {76, 18}}

{ AXRole: AXStaticText AXValue: Survey } has AXRelativeFrame: NSRect: {{198, 2561}, {49, 18}}

Expand Down
Expand Up @@ -36,7 +36,7 @@ after FormatBlock:
| "\ndar"
| <br>
| "\n"
| "yar<#selection-focus>"
| "ya<#selection-focus>r"
| "\n"
| "\n"
| "\n"
@@ -1,2 +1,2 @@
Test passes if it does not crash. 
Test passes if it does not crash.

10 changes: 5 additions & 5 deletions LayoutTests/editing/execCommand/remove-list-items-expected.txt
@@ -1,7 +1,7 @@
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 7 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of OL > DIV > BODY > HTML > #document to 0 of OL > DIV > BODY > HTML > #document toDOMRange:range from 0 of SPAN > DIV > BODY > HTML > #document to 0 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of OL > DIV > BODY > HTML > #document to 0 of OL > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 0 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
Expand All @@ -13,17 +13,17 @@ EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of OL > DIV > BODY >
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of DIV > BODY > HTML > #document to 14 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 0 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of DIV > BODY > HTML > #document to 13 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 0 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 14 of DIV > BODY > HTML > #document to 14 of DIV > BODY > HTML > #document toDOMRange:range from 14 of DIV > BODY > HTML > #document to 14 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 13 of DIV > BODY > HTML > #document to 13 of DIV > BODY > HTML > #document toDOMRange:range from 13 of DIV > BODY > HTML > #document to 13 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This test checks to see that Insert{Un}OrderedList can remove items from a list, can remove empty list when they are emptied, and can remove content from orphaned list items.

foo
This should not be a list. 
This should not be a list.

bar
baz
Expand All @@ -33,4 +33,4 @@ This should not be in a list.
bar
This should not be in a list.
This should not be in a list.
<ol style="border: 1px solid red;"> <li>foo</li> </ol><span id="item1">This should not be a list.</span>&nbsp;<br><ol style="border: 1px solid red;"><br> bar <li>baz</li> </ol>This should not be in a list.<br><ol style="border: 1px solid red;"><li>foo</li> </ol>This should not be in a list.<br><ol style="border: 1px solid red;"> <li>bar</li> </ol> This should not be in a list.<br>This should not be in a list.
<ol style="border: 1px solid red;"> <li>foo</li> </ol>This should not be a list.<br><ol style="border: 1px solid red;"><br> bar <li>baz</li> </ol>This should not be in a list.<br><ol style="border: 1px solid red;"><li>foo</li> </ol>This should not be in a list.<br><ol style="border: 1px solid red;"> <li>bar</li> </ol> This should not be in a list.<br>This should not be in a list.
6 changes: 3 additions & 3 deletions LayoutTests/editing/execCommand/switch-list-type-expected.txt
@@ -1,7 +1,7 @@
EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 5 of DIV > BODY > HTML > #document
EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of OL > DIV > BODY > HTML > #document to 0 of OL > DIV > BODY > HTML > #document toDOMRange:range from 0 of LI > UL > SPAN > DIV > BODY > HTML > #document to 0 of LI > UL > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of OL > DIV > BODY > HTML > #document to 0 of OL > DIV > BODY > HTML > #document toDOMRange:range from 0 of LI > UL > DIV > BODY > HTML > #document to 0 of LI > UL > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
Expand All @@ -19,7 +19,7 @@ EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
This test checks to see if InsertOrderedList can switch the list type of list items.

This should be in an ordered list.
This should be in an unordered list. 
This should be in an unordered list.

This should be in an ordered list.
This should be in an ordered list.
Expand All @@ -29,4 +29,4 @@ This should be in an unordered list.
This should be in an ordered list.
This should not be in a list.
This should be in an ordered list.
<ol style="border: 1px solid red;"> <li>This should be in an ordered list.</li> </ol><span id="item1"><ul><li><span id="item1">This should be in an unordered list.</span>&nbsp;</li></ul></span><ol style="border: 1px solid red;"><br> This should be in an ordered list. <li>This should be in an ordered list.</li> </ol><ul><li>This should be in an unordered list.</li></ul><ol style="border: 1px solid red;"><li>This should be in an ordered list.</li> </ol><ul><li>This should be in an unordered list.</li></ul><ol style="border: 1px solid red;"> <li>This should be in an ordered list.</li> </ol> This should not be in a list.<br><ol><li>This should be in an ordered list.</li></ol>
<ol style="border: 1px solid red;"> <li>This should be in an ordered list.</li> </ol><ul><li>This should be in an unordered list.</li></ul><ol style="border: 1px solid red;"><br> This should be in an ordered list. <li>This should be in an ordered list.</li> </ol><ul><li>This should be in an unordered list.</li></ul><ol style="border: 1px solid red;"><li>This should be in an ordered list.</li> </ol><ul><li>This should be in an unordered list.</li></ul><ol style="border: 1px solid red;"> <li>This should be in an ordered list.</li> </ol> This should not be in a list. <br><ol><li>This should be in an ordered list.</li></ol>
Expand Up @@ -44,7 +44,7 @@ first test - after:
| <div>
| style="position: absolute; left: 0px; top: 0px;"
| "def"
| "ghi <#selection-caret>"
| "ghi<#selection-caret>"
| "\n\n"
| <script>
| "\n\nMarkup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');\n\ndocument.designMode = 'on';\n\nif (window.internals)\n window.internals.settings.setShouldConvertPositionStyleOnCopy(true);\n\nvar s = window.getSelection();\n\nMarkup.dump('test1', 'first test - before');\ndocument.execCommand("SelectAll");\ndocument.execCommand("Cut");\ndocument.execCommand("Paste");\nMarkup.dump('test1', 'first test - after');\n\n"
Expand Up @@ -42,6 +42,6 @@ first test - after:
| <div>
| style="position: static; left: 0px; top: 0px;"
| "def"
| "ghi <#selection-caret>\n\n"
| "ghi<#selection-caret>\n\n"
| <script>
| "\n\nMarkup.description('This tests to see if position:sticky gets converted to position:static upon copy/paste');\n\ndocument.designMode = 'on';\n\nif (window.internals)\n window.internals.settings.setShouldConvertPositionStyleOnCopy(true);\n\nvar s = window.getSelection();\n\nMarkup.dump('test1', 'first test - before');\ndocument.execCommand("SelectAll");\ndocument.execCommand("Cut");\ndocument.execCommand("Paste");\nMarkup.dump('test1', 'first test - after');\n\n"
Expand Up @@ -44,7 +44,7 @@ first test - after:
| <div>
| style="position: absolute; left: 0px; top: 0px;"
| "def"
| "ghi <#selection-caret>"
| "ghi<#selection-caret>"
| "\n\n"
| <script>
| "\n\nMarkup.description('This tests to see if position:absolute gets wrapped with a position:relative upon copy/paste');\n\ndocument.designMode = 'on';\n\nif (window.internals)\n window.internals.settings.setShouldConvertPositionStyleOnCopy(true);\n\nvar s = window.getSelection();\n\nMarkup.dump('test1', 'first test - before');\ndocument.execCommand("SelectAll");\ndocument.execCommand("Cut");\ndocument.execCommand("Paste");\nMarkup.dump('test1', 'first test - after');\n\n"
Expand Up @@ -3,7 +3,7 @@ This test exhibits a bug. The inserted content should be on a separate line but
| <blockquote>
| type="cite"
| <b>
| "line 1 "
| "line 1"
| "line 2<#selection-caret> "
| <b>
| <br>
12 changes: 6 additions & 6 deletions LayoutTests/editing/pasteboard/paste-noscript-expected.txt
Expand Up @@ -3,19 +3,19 @@ Hello
CNN Hello
This is a form
Submit.
Hello 
Hello
CNN Hello  
This is a form
Submit.
<button id="button1" onclick="sayHello()" ondblclick="sayHello()" style="width: 100px;">Hello</button>
<button id="button1" style="width: 100px;">Hello</button>
<a id="anchor1" href="http://www.cnn.com/">CNN</a>
<a id="anchor1" href="http://www.cnn.com/">CNN</a>
undefined
<a id="anchor2" href="javascript:sayHello()">Hello</a>
<a id="anchor2">Hello</a>
undefined
<iframe id="iframe1" src="javascript:var x = 1;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
<iframe id="iframe1" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
undefined
<iframe id="iframe2" srcdoc="<script>var x = 1;</script>" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
<iframe id="iframe2" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
<form id="form1" action="javascript:sayHello()" formaction="javascript:sayHello()" style="width: 200px; height: 150px; background-color:#cee;">This is a form<br><img src="../resources/abe.png"><button formaction="javascript:sayHello()">Submit.</button></form>
<form id="form1" formaction="javascript:sayHello()" style="width: 200px; height: 150px; background-color: rgb(204, 238, 238);">This is a form<br><img src="../resources/abe.png"><button>Submit.</button></form>
<form id="form1" action="javascript:sayHello()" formaction="javascript:sayHello()" style="width: 200px; height: 150px; background-color:#cee;">This is a form<br><img src="../resources/abe.png"><button formaction="javascript:sayHello()">Submit.</button></form>
undefined
@@ -1,3 +1,3 @@
Should not crash when selection start is unrooted (caused by reattachment of render objects).
 


Expand Up @@ -7,7 +7,7 @@ PASS Inserting text when selection is collapsed in <br> which is followed by a t
PASS Inserting text when selection is collapsed in <br> which follows an empty <span> element
PASS Inserting text when selection is collapsed in <br> which follows a text node and an empty <span> element
PASS Inserting text when selection is collapsed in <br> which follows a non-empty <span> element
FAIL Inserting text when selection is collapsed in <br> which follows a text node, an empty <span> element and white-space only text node assert_in_array: The text should be inserted at end of the first text node with ignoring the empty <span> and invisible text node before <br> value "<div>abc<span></span>&nbsp;def<br></div>" not in array ["<div>abcdef<span></span></div>", "<div>abcdef<span></span><br></div>", "<div>abcdef<span></span> </div>", "<div>abcdef<span></span> <br></div>"]
PASS Inserting text when selection is collapsed in <br> which follows a text node, an empty <span> element and white-space only text node
FAIL Inserting text when selection is collapsed in <embed> which is only child assert_in_array: The text should be inserted before the <embed> element value "abc<div><embed></div>" not in array ["<div>abc<embed></div>", "<div>abc<embed><br></div>"]
FAIL Inserting text when selection is collapsed in <embed> which is only child (explicitly flushes maybe pending layout) assert_in_array: The text should be inserted before the <embed> element value "abc<div><embed></div>" not in array ["<div>abc<embed></div>", "<div>abc<embed><br></div>"]
PASS Inserting text when selection is collapsed in <embed> which follows a text node
Expand Down
Expand Up @@ -8,7 +8,7 @@ PASS Internal whitespace compressed ("<div>abc def")
PASS \n converted to space ("<div>abc\ndef")
PASS \r converted to space ("<div>abc\rdef")
PASS \t converted to space ("<div>abc\tdef")
FAIL Trailing whitespace before hard line break removed ("<div>abc <br>def") assert_equals: innerText expected "abc\ndef" but got "abc \ndef"
PASS Trailing whitespace before hard line break removed ("<div>abc <br>def")
PASS Leading whitespace after hard line break removed ("<div>abc<br> def")
PASS Leading whitespace preserved ("<pre> abc")
PASS Trailing whitespace preserved ("<pre>abc ")
Expand Down
Expand Up @@ -8,7 +8,7 @@ PASS Internal whitespace compressed ("<div>abc def")
PASS \n converted to space ("<div>abc\ndef")
PASS \r converted to space ("<div>abc\rdef")
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 Trailing whitespace before hard line break removed ("<div>abc <br>def")
PASS Leading whitespace preserved ("<pre> abc")
PASS Trailing whitespace preserved ("<pre>abc ")
PASS Internal whitespace preserved ("<pre>abc def")
Expand Down
Expand Up @@ -6,15 +6,14 @@ layer at (0,0) size 800x600
RenderBlock {P} at (0,0) size 784x20
RenderText {#text} at (0,0) size 640x19
text run at (0,0) width 640: "The following textarea elements should all be rendered on the left, with their text aligned to the left."
RenderBlock (anonymous) at (0,36) size 784x141
RenderBlock (anonymous) at (0,36) size 784x136
RenderBR {BR} at (378,19) size 0x19
RenderBR {BR} at (378,53) size 0x19
RenderText {#text} at (378,87) size 4x19
text run at (378,87) width 4: " "
RenderBR {BR} at (382,87) size 0x19
RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (378,87) size 0x19
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,177) size 784x34
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,172) size 784x34
layer at (8,44) size 378x34 clip at (9,45) size 376x32
RenderTextControl {TEXTAREA} at (0,0) size 378x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
RenderBlock {DIV} at (6,3) size 366x14
Expand All @@ -30,12 +29,12 @@ layer at (8,112) size 378x34 clip at (9,113) size 376x32
RenderBlock {DIV} at (6,3) size 366x14
RenderText {#text} at (0,0) size 188x14
text run at (0,0) width 188: "This is should be aligned to the left."
layer at (8,151) size 378x34 clip at (9,152) size 376x32
RenderTextControl {TEXTAREA} at (0,107) size 378x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
layer at (8,146) size 378x34 clip at (9,147) size 376x32
RenderTextControl {TEXTAREA} at (0,102) size 378x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
RenderBlock {DIV} at (6,3) size 366x14
RenderText {#text} at (0,0) size 188x14
text run at (0,0) width 188: "This is should be aligned to the left."
layer at (8,185) size 378x34 clip at (9,186) size 376x32
layer at (8,180) size 378x34 clip at (9,181) size 376x32
RenderTextControl {TEXTAREA} at (0,0) size 378x34 [bgcolor=#FFFFFF] [border: (1px solid #3C3C4399)]
RenderBlock {DIV} at (6,3) size 366x14
RenderText {#text} at (0,0) size 188x14
Expand Down
@@ -1,33 +1,29 @@
layer at (0,0) size 800x958
layer at (0,0) size 800x938
RenderView at (0,0) size 800x600
layer at (0,0) size 800x934
RenderBlock {HTML} at (0,0) size 800x934
RenderBody {BODY} at (8,8) size 784x918
RenderText {#text} at (0,0) size 466x19
text run at (0,0) width 466: "All of the replaced elements below should be clipped to a border-radius. "
RenderBR {BR} at (465,0) size 1x19
layer at (0,0) size 800x914
RenderBlock {HTML} at (0,0) size 800x914
RenderBody {BODY} at (8,8) size 784x898
RenderText {#text} at (0,0) size 462x19
text run at (0,0) width 462: "All of the replaced elements below should be clipped to a border-radius."
RenderBR {BR} at (461,0) size 1x19
RenderImage {IMG} at (0,20) size 100x100
RenderText {#text} at (100,105) size 4x19
text run at (100,105) width 4: " "
RenderBR {BR} at (104,105) size 0x19
RenderImage {INPUT} at (0,125) size 100x100
RenderText {#text} at (100,210) size 4x19
text run at (100,210) width 4: " "
RenderBR {BR} at (104,210) size 0x19
RenderIFrame {IFRAME} at (0,230) size 304x154 [border: (2px inset #000000)]
RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (100,105) size 0x19
RenderImage {INPUT} at (0,120) size 100x100
RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (100,205) size 0x19
RenderIFrame {IFRAME} at (0,220) size 304x154 [border: (2px inset #000000)]
layer at (0,0) size 300x150
RenderView at (0,0) size 300x150
layer at (0,0) size 300x150
RenderBlock {HTML} at (0,0) size 300x150
RenderBody {BODY} at (0,0) size 300x150
RenderImage {IMG} at (0,0) size 100x100
RenderText {#text} at (304,369) size 4x19
text run at (304,369) width 4: " "
RenderBR {BR} at (308,369) size 0x19
RenderText {#text} at (300,524) size 4x19
text run at (300,524) width 4: " "
RenderBR {BR} at (304,524) size 0x19
RenderEmbeddedObject {EMBED} at (0,544) size 556x406 [bgcolor=#00FF00] [border: (3px solid #000000)]
RenderText {#text} at (0,0) size 0x0
layer at (8,397) size 300x150
RenderVideo {VIDEO} at (0,389) size 300x150
RenderBR {BR} at (304,359) size 0x19
RenderText {#text} at (0,0) size 0x0
RenderBR {BR} at (300,509) size 0x19
RenderEmbeddedObject {EMBED} at (0,524) size 556x406 [bgcolor=#00FF00] [border: (3px solid #000000)]
RenderText {#text} at (0,0) size 0x0
layer at (8,382) size 300x150
RenderVideo {VIDEO} at (0,374) size 300x150

0 comments on commit 20416c8

Please sign in to comment.