Truly independent web browser
LibWeb: Do not unwrap the first line of a child block when deleting
Andreas Klinga6b208bcddd0
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp b/Libraries/LibWeb/Editing/Internal/Algorithms.cppindex 2bffc7e330c..d5abdc7aa07 100644--- a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp@@ -1047,6 +1047,43 @@ static void restore_white_space_of_nodes(Vector<RecordedWhiteSpace> const& recor}}+// Whether nothing visible precedes point on its line, i.e. whether point is at the start of a block, or follows a br or a+// preserved newline.+static bool is_at_start_of_line(DOM::BoundaryPoint point)+{+ auto ends_with_preserved_newline = [](DOM::Node const& node) {+ auto* text = as_if<DOM::Text>(node);+ return text && text->length() > 0 && text->data().code_unit_at(text->length() - 1) == u'\n'+ && resolved_white_space(const_cast<DOM::Text&>(*text)).preserves_line_breaks();+ };++ GC::Ptr<DOM::Node> node = point.node;+ auto offset = point.offset;+ if (auto* text = as_if<DOM::Text>(*node)) {+ if (offset > 0)+ return text->data().code_unit_at(offset - 1) == u'\n' && resolved_white_space(*text).preserves_line_breaks();+ offset = text->index();+ node = text->parent();+ }++ while (node && !is_block_start_point({ *node, offset })) {+ auto* child = node->child_at_index(offset - 1);+ // NB: A visible inline element such as a span can end with a br or a preserved newline, so look into it.+ if (child && is_visible_node(*child) && !child->has_children())+ return ends_with_preserved_newline(*child);+ if (offset == 0 || !child) {+ if (is_block_node(*node) || node->is_editing_host())+ return true;+ offset = node->index();+ node = node->parent();+ } else {+ node = child;+ offset = child->length();+ }+ }+ return true;+}+// https://w3c.github.io/editing/docs/execCommand/#delete-the-selectionvoid delete_the_selection(Selection& selection, bool block_merging, bool strip_wrappers, Selection::Direction direction){@@ -1150,6 +1187,9 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_w// 10. Call extend(end node, end offset) on the context object's selection.MUST(selection.extend(end.node, end.offset));+ // NB: See the INTEROP note at step 30.+ auto starts_at_start_of_line = is_at_start_of_line(start);+// 12. Let start block be the active range's start node.GC::Ptr<DOM::Node> start_block = active_range(document)->start_container();@@ -1208,6 +1248,11 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_wreturn;}+ // NB: See the INTEROP note at step 30. Record whether the selection contains anything to delete before the steps+ // below delete it.+ bool selection_has_content = (is<DOM::Text>(*start.node) && start.node->is_editable() && start.offset < start.node->length())+ || (is<DOM::Text>(*end.node) && end.node->is_editable() && end.offset > 0);+// 22. If start node is an editable Text node, call deleteData() on it, with start offset as the first argument and// (length of start node − start offset) as the second argument.if (is<DOM::Text>(*start.node) && start.node->is_editable())@@ -1230,6 +1275,8 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_wreturn IterationDecision::Continue;});+ if (!node_list.is_empty())+ selection_has_content = true;// 25. For each node in node list:for (auto node : node_list) {@@ -1288,6 +1335,16 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_wreturn;}+ // INTEROP: If the selection started at the start of a line and ended in a descendant block of start block, browsers+ // only delete the selected content and the preceding lines, without moving the first line of end block+ // out of it. The caret then goes to where the selection ended. If the selection contained nothing, the+ // steps below are what deletes the line break before end block, so this does not apply.+ if (starts_at_start_of_line && selection_has_content && start_block->is_ancestor_of(*end_block)) {+ MUST(selection.collapse_to_end());+ restore_states_and_values(document, overrides);+ return;+ }+// 31. If start block has one child, which is a collapsed block prop, remove its child from it.if (start_block->child_count() == 1 && is_collapsed_block_prop(*start_block->first_child()))remove_node(*start_block->first_child());diff --git a/Tests/LibWeb/Text/expected/Editing/execCommand-delete-after-br-in-inline-wrapper.txt b/Tests/LibWeb/Text/expected/Editing/execCommand-delete-after-br-in-inline-wrapper.txtnew file mode 100644index 00000000000..93d89010ffe--- /dev/null+++ b/Tests/LibWeb/Text/expected/Editing/execCommand-delete-after-br-in-inline-wrapper.txt@@ -0,0 +1,4 @@+direct before: foo<br>abc<div>bar</div>+direct after: foo<br><div>bar</div>+wrapped before: foo<span>x<br></span>abc<div>bar</div>+wrapped after: foo<span>x<br></span><div>bar</div>diff --git a/Tests/LibWeb/Text/expected/Editing/execCommand-delete-at-start-of-child-block.txt b/Tests/LibWeb/Text/expected/Editing/execCommand-delete-at-start-of-child-block.txtnew file mode 100644index 00000000000..4a9f278bb7f--- /dev/null+++ b/Tests/LibWeb/Text/expected/Editing/execCommand-delete-at-start-of-child-block.txt@@ -0,0 +1,2 @@+Before: <br><div>bar</div>+After: bardiff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=br.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=br.txtindex 3bdc7217887..9a201730ede 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=br.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=br.txt@@ -1,33 +1,53 @@Harness status: OK-Found 27 tests+Found 47 tests-2 Pass-25 Fail-Fail Backspace at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail Typing "X" at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail Backspace at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail Typing "X" at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail Backspace at <br>{<br><div id="child">]def<br>ghi</div>-Fail Typing "X" at <br>{<br><div id="child">]def<br>ghi</div>-Fail Backspace at {<br><br><div id="child">]def<br>ghi</div>-Fail Typing "X" at {<br><br><div id="child">]def<br>ghi</div>-Fail Backspace at [abc<br><br><div id="child">]def<br>ghi</div>-Fail Typing "X" at [abc<br><br><div id="child">]def<br>ghi</div>-Fail Backspace at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail Backspace at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail Backspace at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail Backspace at {<br><br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at {<br><br><div id="child">d]ef<br>ghi</div>-Fail Backspace at [abc<br><br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at [abc<br><br><div id="child">d]ef<br>ghi</div>+37 Pass+10 Fail+Pass Backspace at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass Typing "X" at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass Backspace at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass Typing "X" at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass Backspace at <br>{<br><div id="child">]def<br>ghi</div>+Pass Typing "X" at <br>{<br><div id="child">]def<br>ghi</div>+Pass Backspace at {<br><br><div id="child">]def<br>ghi</div>+Pass Typing "X" at {<br><br><div id="child">]def<br>ghi</div>+Pass Backspace at [abc<br><br><div id="child">]def<br>ghi</div>+Pass Typing "X" at [abc<br><br><div id="child">]def<br>ghi</div>+Pass Backspace at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass Backspace at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass Backspace at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass Backspace at {<br><br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at {<br><br><div id="child">d]ef<br>ghi</div>+Pass Backspace at [abc<br><br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at [abc<br><br><div id="child">d]ef<br>ghi</div>Pass Backspace at abc<br><br><div id="child">[]def<br>ghi</div>Pass Backspace at <br><br><div id="child">[]def<br>ghi</div>Fail Backspace at <br><div id="child">[]def<br>ghi</div>Fail Backspace at <b>abc<br><br></b></b><div id="child">[]def<br>ghi</div>Fail Backspace at <b><br></b><div id="child">[]def<br>ghi</div>+Fail getTargetRanges() for Backspace at abc<br>{<br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at abc<br>{<br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at <br>[abc<br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at <br>[abc<br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at <br>{<br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at <br>{<br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at {<br><br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at {<br><br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at [abc<br><br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at [abc<br><br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Pass getTargetRanges() for Backspace at abc<br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at abc<br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at <br>[abc<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at <br>[abc<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at <br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at <br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at {<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at {<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at [abc<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at [abc<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>Fail getTargetRanges() for Backspace at abc<br><br><div id="child">[]def<br>ghi</div> should return a range before the child <div>Fail getTargetRanges() for Backspace at <br><br><div id="child">[]def<br>ghi</div> should return a range before the child <div>\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=preformat.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=preformat.txtindex 7526494ebdc..3c6fb4249d5 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=preformat.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=BackspaceKey&lineBreak=preformat.txt@@ -1,30 +1,51 @@Harness status: OK-Found 25 tests+Found 45 tests-25 Fail-Fail Backspace at abc\\n[\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at abc\n[\n<div id="child">]def<br>ghi</div>-Fail Backspace at \\n[abc\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at \n[abc\n<div id="child">]def<br>ghi</div>-Fail Backspace at \\n[\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at \n[\n<div id="child">]def<br>ghi</div>-Fail Backspace at [\\n\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at [\n\n<div id="child">]def<br>ghi</div>-Fail Backspace at [abc\\n\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at [abc\n\n<div id="child">]def<br>ghi</div>-Fail Backspace at abc\\n[\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at abc\n[\n<div id="child">d]ef<br>ghi</div>-Fail Backspace at \\n[abc\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at \n[abc\n<div id="child">d]ef<br>ghi</div>-Fail Backspace at \\n[\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at \n[\n<div id="child">d]ef<br>ghi</div>-Fail Backspace at [\\n\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at [\n\n<div id="child">d]ef<br>ghi</div>-Fail Backspace at [abc\\n\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at [abc\n\n<div id="child">d]ef<br>ghi</div>+35 Pass+10 Fail+Pass Backspace at abc\\n[\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at abc\n[\n<div id="child">]def<br>ghi</div>+Pass Backspace at \\n[abc\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at \n[abc\n<div id="child">]def<br>ghi</div>+Pass Backspace at \\n[\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at \n[\n<div id="child">]def<br>ghi</div>+Pass Backspace at [\\n\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at [\n\n<div id="child">]def<br>ghi</div>+Pass Backspace at [abc\\n\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at [abc\n\n<div id="child">]def<br>ghi</div>+Pass Backspace at abc\\n[\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at abc\n[\n<div id="child">d]ef<br>ghi</div>+Pass Backspace at \\n[abc\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at \n[abc\n<div id="child">d]ef<br>ghi</div>+Pass Backspace at \\n[\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at \n[\n<div id="child">d]ef<br>ghi</div>+Pass Backspace at [\\n\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at [\n\n<div id="child">d]ef<br>ghi</div>+Pass Backspace at [abc\\n\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at [abc\n\n<div id="child">d]ef<br>ghi</div>Fail Backspace at abc\\n\\n<div id="child">[]def<br>ghi</div>Fail Backspace at \\n\\n<div id="child">[]def<br>ghi</div>Fail Backspace at \\n<div id="child">[]def<br>ghi</div>Fail Backspace at <b>abc\\n\\n</b></b><div id="child">[]def<br>ghi</div>-Fail Backspace at <b>\\n</b><div id="child">[]def<br>ghi</div>\ No newline at end of file+Fail Backspace at <b>\\n</b><div id="child">[]def<br>ghi</div>+Fail getTargetRanges() for Backspace at abc\\n[\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at abc\n[\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at \\n[abc\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at \n[abc\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at \\n[\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at \n[\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at [\\n\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at [\n\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Backspace at [abc\\n\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at [abc\n\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Pass getTargetRanges() for Backspace at abc\\n[\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at abc\n[\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at \\n[abc\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at \n[abc\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at \\n[\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at \n[\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at [\\n\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at [\n\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Backspace at [abc\\n\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at [abc\n\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=br.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=br.txtindex 22af9ae0000..5d7b0d4bab7 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=br.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=br.txt@@ -1,30 +1,54 @@Harness status: OK-Found 25 tests+Found 48 tests-25 Fail-Fail Delete at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail Typing "X" at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail Delete at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail Typing "X" at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail Delete at <br>{<br><div id="child">]def<br>ghi</div>-Fail Typing "X" at <br>{<br><div id="child">]def<br>ghi</div>-Fail Delete at {<br><br><div id="child">]def<br>ghi</div>-Fail Typing "X" at {<br><br><div id="child">]def<br>ghi</div>-Fail Delete at [abc<br><br><div id="child">]def<br>ghi</div>-Fail Typing "X" at [abc<br><br><div id="child">]def<br>ghi</div>-Fail Delete at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail Delete at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail Delete at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail Delete at {<br><br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at {<br><br><div id="child">d]ef<br>ghi</div>-Fail Delete at [abc<br><br><div id="child">d]ef<br>ghi</div>-Fail Typing "X" at [abc<br><br><div id="child">d]ef<br>ghi</div>-Fail Delete at abc<br>{}<br><div id="child">def<br>ghi</div>-Fail Delete at <br>{}<br><div id="child">def<br>ghi</div>-Fail Delete at {}<br><div id="child">def<br>ghi</div>+38 Pass+10 Fail+Pass Delete at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass Typing "X" at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass Delete at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass Typing "X" at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass Delete at <br>{<br><div id="child">]def<br>ghi</div>+Pass Typing "X" at <br>{<br><div id="child">]def<br>ghi</div>+Pass Delete at {<br><br><div id="child">]def<br>ghi</div>+Pass Typing "X" at {<br><br><div id="child">]def<br>ghi</div>+Pass Delete at [abc<br><br><div id="child">]def<br>ghi</div>+Pass Typing "X" at [abc<br><br><div id="child">]def<br>ghi</div>+Pass Delete at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass Delete at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass Delete at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass Delete at {<br><br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at {<br><br><div id="child">d]ef<br>ghi</div>+Pass Delete at [abc<br><br><div id="child">d]ef<br>ghi</div>+Pass Typing "X" at [abc<br><br><div id="child">d]ef<br>ghi</div>+Pass Delete at abc<br>{}<br><div id="child">def<br>ghi</div>+Pass Delete at <br>{}<br><div id="child">def<br>ghi</div>+Pass Delete at {}<br><div id="child">def<br>ghi</div>Fail Delete at <b>abc<br>{}<br></b></b><div id="child">def<br>ghi</div>-Fail Delete at <b>{}<br></b><div id="child">def<br>ghi</div>\ No newline at end of file+Fail Delete at <b>{}<br></b><div id="child">def<br>ghi</div>+Fail getTargetRanges() for Delete at abc<br>{<br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at abc<br>{<br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at <br>[abc<br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at <br>[abc<br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at <br>{<br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at <br>{<br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at {<br><br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at {<br><br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at [abc<br><br><div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at [abc<br><br><div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Pass getTargetRanges() for Delete at abc<br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at abc<br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at <br>[abc<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at <br>[abc<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at <br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at <br>{<br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at {<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at {<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at [abc<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at [abc<br><br><div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Fail getTargetRanges() for Delete at abc<br>{}<br><div id="child">def<br>ghi</div> should return a range before the child <div>+Fail getTargetRanges() for Delete at <br>{}<br><div id="child">def<br>ghi</div> should return a range before the child <div>+Fail getTargetRanges() for Delete at {}<br><div id="child">def<br>ghi</div> should return a range before the child <div>\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=preformat.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=preformat.txtindex 1a3b7496b39..3953e10e635 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=preformat.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=DeleteKey&lineBreak=preformat.txt@@ -1,34 +1,54 @@Harness status: OK-Found 28 tests+Found 48 tests-3 Pass-25 Fail-Fail Delete at abc\\n[\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at abc\n[\n<div id="child">]def<br>ghi</div>-Fail Delete at \\n[abc\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at \n[abc\n<div id="child">]def<br>ghi</div>-Fail Delete at \\n[\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at \n[\n<div id="child">]def<br>ghi</div>-Fail Delete at [\\n\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at [\n\n<div id="child">]def<br>ghi</div>-Fail Delete at [abc\\n\\n<div id="child">]def<br>ghi</div>-Fail Typing "X" at [abc\n\n<div id="child">]def<br>ghi</div>-Fail Delete at abc\\n[\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at abc\n[\n<div id="child">d]ef<br>ghi</div>-Fail Delete at \\n[abc\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at \n[abc\n<div id="child">d]ef<br>ghi</div>-Fail Delete at \\n[\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at \n[\n<div id="child">d]ef<br>ghi</div>-Fail Delete at [\\n\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at [\n\n<div id="child">d]ef<br>ghi</div>-Fail Delete at [abc\\n\\n<div id="child">d]ef<br>ghi</div>-Fail Typing "X" at [abc\n\n<div id="child">d]ef<br>ghi</div>+38 Pass+10 Fail+Pass Delete at abc\\n[\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at abc\n[\n<div id="child">]def<br>ghi</div>+Pass Delete at \\n[abc\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at \n[abc\n<div id="child">]def<br>ghi</div>+Pass Delete at \\n[\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at \n[\n<div id="child">]def<br>ghi</div>+Pass Delete at [\\n\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at [\n\n<div id="child">]def<br>ghi</div>+Pass Delete at [abc\\n\\n<div id="child">]def<br>ghi</div>+Pass Typing "X" at [abc\n\n<div id="child">]def<br>ghi</div>+Pass Delete at abc\\n[\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at abc\n[\n<div id="child">d]ef<br>ghi</div>+Pass Delete at \\n[abc\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at \n[abc\n<div id="child">d]ef<br>ghi</div>+Pass Delete at \\n[\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at \n[\n<div id="child">d]ef<br>ghi</div>+Pass Delete at [\\n\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at [\n\n<div id="child">d]ef<br>ghi</div>+Pass Delete at [abc\\n\\n<div id="child">d]ef<br>ghi</div>+Pass Typing "X" at [abc\n\n<div id="child">d]ef<br>ghi</div>Fail Delete at abc\\n[]\\n<div id="child">def<br>ghi</div>Fail Delete at \\n[]\\n<div id="child">def<br>ghi</div>Fail Delete at []\\n<div id="child">def<br>ghi</div>Fail Delete at <b>abc\\n[]\\n</b></b><div id="child">def<br>ghi</div>Pass Delete at <b>[]\\n</b><div id="child">def<br>ghi</div>+Fail getTargetRanges() for Delete at abc\\n[\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at abc\n[\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at \\n[abc\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at \n[abc\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at \\n[\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at \n[\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at [\\n\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at [\n\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Fail getTargetRanges() for Delete at [abc\\n\\n<div id="child">]def<br>ghi</div> should return a range before the child <div>+Pass getTargetRanges() for Typing "X" at [abc\n\n<div id="child">]def<br>ghi</div> should return a range ending in the child <div>+Pass getTargetRanges() for Delete at abc\\n[\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at abc\n[\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at \\n[abc\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at \n[abc\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at \\n[\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at \n[\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at [\\n\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at [\n\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Delete at [abc\\n\\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>+Pass getTargetRanges() for Typing "X" at [abc\n\n<div id="child">d]ef<br>ghi</div> should return a range ends at start of the child <div>Pass getTargetRanges() for Delete at abc\\n[]\\n<div id="child">def<br>ghi</div> should return a range before the child <div>Pass getTargetRanges() for Delete at <b>abc\\n[]\\n</b></b><div id="child">def<br>ghi</div> should return a range before the child <div>Fail getTargetRanges() for Delete at <b>[]\\n</b><div id="child">def<br>ghi</div> should return a range before the child <div>\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=br.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=br.txtindex a4e00638fb8..1e8f4b9e845 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=br.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=br.txt@@ -2,28 +2,28 @@ Harness status: OKFound 25 tests-2 Pass-23 Fail-Fail document.execCommand("delete") at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at <br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at {<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at {<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at [abc<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at {<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at {<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at [abc<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">d]ef<br>ghi</div>+22 Pass+3 Fail+Pass document.execCommand("delete") at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at <br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at {<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at {<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at [abc<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at {<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at {<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at [abc<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">d]ef<br>ghi</div>Pass document.execCommand("delete") at abc<br><br><div id="child">[]def<br>ghi</div>Pass document.execCommand("delete") at <br><br><div id="child">[]def<br>ghi</div>Fail document.execCommand("delete") at <br><div id="child">[]def<br>ghi</div>diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=preformat.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=preformat.txtindex 6711e25da7c..199715e74ef 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=preformat.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=deleteCommand&lineBreak=preformat.txt@@ -2,27 +2,28 @@ Harness status: OKFound 25 tests-25 Fail-Fail document.execCommand("delete") at abc\\n[\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at \\n[abc\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at \\n[\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at [\\n\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [\n\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at [abc\\n\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("delete") at abc\\n[\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at \\n[abc\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at \\n[\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at [\\n\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [\n\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("delete") at [abc\\n\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">d]ef<br>ghi</div>+20 Pass+5 Fail+Pass document.execCommand("delete") at abc\\n[\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at \\n[abc\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at \\n[\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at [\\n\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [\n\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at [abc\\n\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("delete") at abc\\n[\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at \\n[abc\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at \\n[\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at [\\n\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [\n\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("delete") at [abc\\n\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">d]ef<br>ghi</div>Fail document.execCommand("delete") at abc\\n\\n<div id="child">[]def<br>ghi</div>Fail document.execCommand("delete") at \\n\\n<div id="child">[]def<br>ghi</div>Fail document.execCommand("delete") at \\n<div id="child">[]def<br>ghi</div>diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=br.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=br.txtindex a2f905bf7ed..b665055f18d 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=br.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=br.txt@@ -2,29 +2,30 @@ Harness status: OKFound 25 tests-25 Fail-Fail document.execCommand("forwarddelete") at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at <br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>{<br><div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at {<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at {<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at [abc<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at <br>{<br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at {<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at {<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at [abc<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at abc<br>{}<br><div id="child">def<br>ghi</div>-Fail document.execCommand("forwarddelete") at <br>{}<br><div id="child">def<br>ghi</div>-Fail document.execCommand("forwarddelete") at {}<br><div id="child">def<br>ghi</div>+23 Pass+2 Fail+Pass document.execCommand("forwarddelete") at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at <br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>{<br><div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at {<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at {<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at [abc<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc<br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>[abc<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at <br>{<br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at {<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at {<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at [abc<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc<br><br><div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at abc<br>{}<br><div id="child">def<br>ghi</div>+Pass document.execCommand("forwarddelete") at <br>{}<br><div id="child">def<br>ghi</div>+Pass document.execCommand("forwarddelete") at {}<br><div id="child">def<br>ghi</div>Fail document.execCommand("forwarddelete") at <b>abc<br>{}<br></b></b><div id="child">def<br>ghi</div>Fail document.execCommand("forwarddelete") at <b>{}<br></b><div id="child">def<br>ghi</div>\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=preformat.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=preformat.txtindex e8fdf9bba30..952bacac346 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=preformat.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/delete-without-unwrapping-first-line-of-child-block@method=forwardDeleteCommand&lineBreak=preformat.txt@@ -2,28 +2,28 @@ Harness status: OKFound 25 tests-1 Pass-24 Fail-Fail document.execCommand("forwarddelete") at abc\\n[\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at \\n[abc\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at \\n[\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at [\\n\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [\n\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at [abc\\n\\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">]def<br>ghi</div>-Fail document.execCommand("forwarddelete") at abc\\n[\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at \\n[abc\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at \\n[\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at \n[\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at [\\n\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [\n\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("forwarddelete") at [abc\\n\\n<div id="child">d]ef<br>ghi</div>-Fail document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">d]ef<br>ghi</div>+21 Pass+4 Fail+Pass document.execCommand("forwarddelete") at abc\\n[\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at \\n[abc\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at \\n[\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at [\\n\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [\n\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at [abc\\n\\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">]def<br>ghi</div>+Pass document.execCommand("forwarddelete") at abc\\n[\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at abc\n[\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at \\n[abc\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[abc\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at \\n[\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at \n[\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at [\\n\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [\n\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("forwarddelete") at [abc\\n\\n<div id="child">d]ef<br>ghi</div>+Pass document.execCommand("insertText", false, "X") at [abc\n\n<div id="child">d]ef<br>ghi</div>Fail document.execCommand("forwarddelete") at abc\\n[]\\n<div id="child">def<br>ghi</div>Fail document.execCommand("forwarddelete") at \\n[]\\n<div id="child">def<br>ghi</div>Fail document.execCommand("forwarddelete") at []\\n<div id="child">def<br>ghi</div>diff --git a/Tests/LibWeb/Text/input/Editing/execCommand-delete-after-br-in-inline-wrapper.html b/Tests/LibWeb/Text/input/Editing/execCommand-delete-after-br-in-inline-wrapper.htmlnew file mode 100644index 00000000000..61edc138a75--- /dev/null+++ b/Tests/LibWeb/Text/input/Editing/execCommand-delete-after-br-in-inline-wrapper.html@@ -0,0 +1,17 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<div id="direct" contenteditable>foo<br>abc<div>bar</div></div>+<div id="wrapped" contenteditable>foo<span>x<br></span>abc<div>bar</div></div>+<script>+ test(() => {+ for (const id of ["direct", "wrapped"]) {+ const host = document.getElementById(id);+ host.focus();+ const abc = host.querySelector("div").previousSibling;+ getSelection().setBaseAndExtent(abc, 0, host.querySelector("div").firstChild, 0);+ println(`${id} before: ${host.innerHTML}`);+ document.execCommand("delete");+ println(`${id} after: ${host.innerHTML}`);+ }+ });+</script>diff --git a/Tests/LibWeb/Text/input/Editing/execCommand-delete-at-start-of-child-block.html b/Tests/LibWeb/Text/input/Editing/execCommand-delete-at-start-of-child-block.htmlnew file mode 100644index 00000000000..c6dc40c2410--- /dev/null+++ b/Tests/LibWeb/Text/input/Editing/execCommand-delete-at-start-of-child-block.html@@ -0,0 +1,13 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<div id="host" contenteditable><br><div>bar</div></div>+<script>+ test(() => {+ const host = document.getElementById("host");+ host.focus();+ getSelection().collapse(host.querySelector("div").firstChild, 0);+ println(`Before: ${host.innerHTML}`);+ document.execCommand("delete");+ println(`After: ${host.innerHTML}`);+ });+</script>