Title: [269894] trunk
Revision
269894
Author
[email protected]
Date
2020-11-17 00:22:08 -0800 (Tue, 17 Nov 2020)

Log Message

Check whether destination still can be selected
https://bugs.webkit.org/show_bug.cgi?id=218491

Patch by Rob Buis <[email protected]> on 2020-11-17
Reviewed by Ryosuke Niwa.

Source/WebCore:

Check whether destination still can be selected
after deletion.

Test: editing/deleting/delete-selection-crash.html

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::moveParagraphs):

LayoutTests:

Add testcase.

* editing/deleting/delete-selection-crash-expected.txt: Added.
* editing/deleting/delete-selection-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269893 => 269894)


--- trunk/LayoutTests/ChangeLog	2020-11-17 05:23:24 UTC (rev 269893)
+++ trunk/LayoutTests/ChangeLog	2020-11-17 08:22:08 UTC (rev 269894)
@@ -1,3 +1,15 @@
+2020-11-17  Rob Buis  <[email protected]>
+
+        Check whether destination still can be selected
+        https://bugs.webkit.org/show_bug.cgi?id=218491
+
+        Reviewed by Ryosuke Niwa.
+
+        Add testcase.
+
+        * editing/deleting/delete-selection-crash-expected.txt: Added.
+        * editing/deleting/delete-selection-crash.html: Added.
+
 2020-11-16  Sam Weinig  <[email protected]>
 
         Standardize enums that are used by Settings in preparation for autogeneration

Added: trunk/LayoutTests/editing/deleting/delete-selection-crash-expected.txt (0 => 269894)


--- trunk/LayoutTests/editing/deleting/delete-selection-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/delete-selection-crash-expected.txt	2020-11-17 08:22:08 UTC (rev 269894)
@@ -0,0 +1 @@
+Test passes if it does not crash.

Added: trunk/LayoutTests/editing/deleting/delete-selection-crash.html (0 => 269894)


--- trunk/LayoutTests/editing/deleting/delete-selection-crash.html	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/delete-selection-crash.html	2020-11-17 08:22:08 UTC (rev 269894)
@@ -0,0 +1,15 @@
+<script>
+window._onload_ = () => {
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    getSelection().setPosition(start, 0);
+    document.querySelector('span').appendChild(document.createElement("video"));
+    document.execCommand("delete", false);
+    document.write("Test passes if it does not crash.")
+}
+</script>
+<div contentEditable="true" style="-webkit-border-fit: lines;">
+    <div style="-webkit-margin-start: 40px;"><span></span> </div>
+    <div id="start"><details open="true">content</details></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (269893 => 269894)


--- trunk/Source/WebCore/ChangeLog	2020-11-17 05:23:24 UTC (rev 269893)
+++ trunk/Source/WebCore/ChangeLog	2020-11-17 08:22:08 UTC (rev 269894)
@@ -1,3 +1,18 @@
+2020-11-17  Rob Buis  <[email protected]>
+
+        Check whether destination still can be selected
+        https://bugs.webkit.org/show_bug.cgi?id=218491
+
+        Reviewed by Ryosuke Niwa.
+
+        Check whether destination still can be selected
+        after deletion.
+
+        Test: editing/deleting/delete-selection-crash.html
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::moveParagraphs):
+
 2020-11-16  Kimmo Kinnunen  <[email protected]>
 
         Textures Fail to Render in WebGL from HLS Stream on iPhone 12 [iOS 14.2]

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (269893 => 269894)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2020-11-17 05:23:24 UTC (rev 269893)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2020-11-17 08:22:08 UTC (rev 269894)
@@ -1458,7 +1458,7 @@
     cleanupAfterDeletion(destination);
 
     // FIXME (Bug 211793): We should redesign cleanupAfterDeletion or find another destination when it is removed.
-    if (!destination.deepEquivalent().anchorNode()->isConnected())
+    if (!destination.deepEquivalent().anchorNode()->isConnected() || VisibleSelection(destination, originalIsDirectional).isNone())
         return;
 
     // Add a br if pruning an empty block level element caused a collapse. For example:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to