In some cases if there's no whitespace between paragraphs contenteditable will swap nodes around in the wrong order. For example given the below with the caret at the pipe: X| Y Z If you then hit delete you end up with: ZY Downstream bug: http://code.google.com/p/chromium/issues/detail?id=157925
Created attachment 170706 [details] Reduction
Created attachment 180635 [details] Patch
Created attachment 180637 [details] Patch
Comment on attachment 180637 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=180637&action=review > Source/WebCore/editing/DeleteSelectionCommand.cpp:484 > + updatePositionForNodeRemoval(m_downstreamEnd, children[i].get()); > + removeNode(children[i]); You shouldn't have to call updatePositionForNodeRemoval. DeleteSelectionCommand::removeNode should automatically take care of that.
Created attachment 180650 [details] Patch
Comment on attachment 180650 [details] Patch Rejecting attachment 180650 [details] from commit-queue. New failing tests: editing/execCommand/format-block-contenteditable-false.html editing/deleting/delete-3865854-fix.html editing/execCommand/5469868.html editing/execCommand/5190926.html editing/execCommand/delete-selection-has-style.html editing/pasteboard/testcase-9507.html editing/deleting/delete-at-paragraph-boundaries-002.html editing/pasteboard/paste-text-009.html editing/execCommand/create-list-from-range-selection.html editing/pasteboard/paste-text-015.html editing/deleting/delete-and-cleanup.html editing/deleting/delete-select-all-003.html editing/pasteboard/block-wrappers-necessary.html editing/pasteboard/paste-4039777-fix.html editing/pasteboard/paste-text-008.html editing/pasteboard/paste-without-nesting.html editing/deleting/delete-3959464-fix.html editing/execCommand/4916541.html editing/deleting/delete-at-paragraph-boundaries-001.html svg/custom/bug78838.html editing/execCommand/inline-style-after-indentoutdent.html editing/style/4916887.html editing/deleting/deleting-line-break-preserves-underline-color.html editing/pasteboard/copy-paste-bidi.html Full output: http://queues.webkit.org/results/15496480
Comment on attachment 180650 [details] Patch Attachment 180650 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/15594429 New failing tests: editing/execCommand/format-block-contenteditable-false.html editing/deleting/delete-3865854-fix.html editing/execCommand/5469868.html editing/execCommand/5190926.html editing/execCommand/delete-selection-has-style.html editing/pasteboard/testcase-9507.html editing/deleting/delete-at-paragraph-boundaries-002.html editing/pasteboard/paste-text-009.html editing/execCommand/create-list-from-range-selection.html editing/pasteboard/paste-text-015.html editing/deleting/delete-and-cleanup.html editing/deleting/delete-select-all-003.html editing/pasteboard/block-wrappers-necessary.html editing/pasteboard/paste-4039777-fix.html editing/pasteboard/paste-text-008.html editing/pasteboard/paste-without-nesting.html editing/deleting/delete-3959464-fix.html editing/execCommand/4916541.html editing/deleting/delete-at-paragraph-boundaries-001.html svg/custom/bug78838.html editing/execCommand/inline-style-after-indentoutdent.html editing/style/4916887.html editing/deleting/deleting-line-break-preserves-underline-color.html editing/pasteboard/copy-paste-bidi.html
Comment on attachment 180650 [details] Patch Attachment 180650 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/15699448 New failing tests: editing/execCommand/format-block-contenteditable-false.html editing/deleting/delete-3865854-fix.html editing/execCommand/5469868.html editing/execCommand/5190926.html editing/execCommand/delete-selection-has-style.html editing/pasteboard/testcase-9507.html editing/deleting/delete-at-paragraph-boundaries-002.html editing/pasteboard/paste-text-009.html editing/execCommand/create-list-from-range-selection.html editing/pasteboard/paste-text-015.html editing/deleting/delete-and-cleanup.html editing/deleting/delete-select-all-003.html editing/pasteboard/block-wrappers-necessary.html editing/pasteboard/paste-4039777-fix.html editing/pasteboard/paste-text-008.html editing/pasteboard/paste-without-nesting.html editing/deleting/delete-3959464-fix.html editing/execCommand/4916541.html editing/deleting/delete-at-paragraph-boundaries-001.html svg/custom/bug78838.html editing/execCommand/inline-style-after-indentoutdent.html editing/style/4916887.html editing/deleting/deleting-line-break-preserves-underline-color.html editing/pasteboard/copy-paste-bidi.html
I am unable to reproduce this bug using attached reduction in Safari 15.6 on macOS 12.5, it behaves same across all browsers and does not fix up results like mentioned in Comment 0 and the content remain where it is. Only "X" get removed and it is across all browsers (Chrome Canary 106, Firefox Nightly 104 and Safari 15.6). Thanks!
Oh yeah, I fixed this bug years ago.