Title: [257559] releases/WebKitGTK/webkit-2.28
Revision
257559
Author
carlo...@webkit.org
Date
2020-02-27 01:14:21 -0800 (Thu, 27 Feb 2020)

Log Message

Merge r257536 - Nullptr crash in WebCore::canHaveChildrenForEditing via CompositeEditCommand::insertNode
https://bugs.webkit.org/show_bug.cgi?id=208115
<rdar://problem/56685655>

Patch by Jack Lee <shihchieh_...@apple.com> on 2020-02-26
Reviewed by Ryosuke Niwa.

When inserting a list at an element with a non-list-item child, if the element is uneditable, skip creating list item for the child.

Source/WebCore:

Test: fast/lists/insert-list-uneditable-element-with-non-li-child.html

* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::listifyParagraph):

LayoutTests:

* fast/lists/insert-list-uneditable-element-with-non-li-child-expected.txt: Added.
* fast/lists/insert-list-uneditable-element-with-non-li-child.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog (257558 => 257559)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog	2020-02-27 09:14:16 UTC (rev 257558)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog	2020-02-27 09:14:21 UTC (rev 257559)
@@ -1,3 +1,16 @@
+2020-02-26  Jack Lee  <shihchieh_...@apple.com>
+
+        Nullptr crash in WebCore::canHaveChildrenForEditing via CompositeEditCommand::insertNode
+        https://bugs.webkit.org/show_bug.cgi?id=208115
+        <rdar://problem/56685655>
+
+        Reviewed by Ryosuke Niwa.
+
+        When inserting a list at an element with a non-list-item child, if the element is uneditable, skip creating list item for the child. 
+
+        * fast/lists/insert-list-uneditable-element-with-non-li-child-expected.txt: Added.
+        * fast/lists/insert-list-uneditable-element-with-non-li-child.html: Added.
+
 2020-02-25  Jack Lee  <shihchieh_...@apple.com>
 
         ASSERTION FAILURE in AppendNodeCommand::AppendNodeCommand when inserting list with read-only user-modify

Added: releases/WebKitGTK/webkit-2.28/LayoutTests/fast/lists/insert-list-uneditable-element-with-non-li-child-expected.txt (0 => 257559)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/fast/lists/insert-list-uneditable-element-with-non-li-child-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/fast/lists/insert-list-uneditable-element-with-non-li-child-expected.txt	2020-02-27 09:14:21 UTC (rev 257559)
@@ -0,0 +1 @@
+Tests inserting ol at an uneditable element with non-li child. The test passes if WebKit doesn't crash or hit an assertion.

Added: releases/WebKitGTK/webkit-2.28/LayoutTests/fast/lists/insert-list-uneditable-element-with-non-li-child.html (0 => 257559)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/fast/lists/insert-list-uneditable-element-with-non-li-child.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/fast/lists/insert-list-uneditable-element-with-non-li-child.html	2020-02-27 09:14:21 UTC (rev 257559)
@@ -0,0 +1,13 @@
+<style>
+body { -webkit-user-modify: read-write; background-image: url(); }
+</style>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    _onload_ = function fun() {
+        document.getSelection().setPosition(HR);
+        HR.appendChild(document.createElement("option"));
+        document.execCommand("insertOrderedList", false);
+    }
+</script>
+<body><hr id=HR contenteditable="false"></hr><span>Tests inserting ol at an uneditable element with non-li child. The test passes if WebKit doesn't crash or hit an assertion.</span>

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog (257558 => 257559)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-02-27 09:14:16 UTC (rev 257558)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-02-27 09:14:21 UTC (rev 257559)
@@ -1,3 +1,18 @@
+2020-02-26  Jack Lee  <shihchieh_...@apple.com>
+
+        Nullptr crash in WebCore::canHaveChildrenForEditing via CompositeEditCommand::insertNode
+        https://bugs.webkit.org/show_bug.cgi?id=208115
+        <rdar://problem/56685655>
+
+        Reviewed by Ryosuke Niwa.
+
+        When inserting a list at an element with a non-list-item child, if the element is uneditable, skip creating list item for the child. 
+
+        Test: fast/lists/insert-list-uneditable-element-with-non-li-child.html
+
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::listifyParagraph):
+
 2020-02-26  Adrian Perez de Castro  <ape...@igalia.com>
 
         Unreviewed build fix for non-unified builds with assertions enabled.

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/editing/InsertListCommand.cpp (257558 => 257559)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/editing/InsertListCommand.cpp	2020-02-27 09:14:16 UTC (rev 257558)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/editing/InsertListCommand.cpp	2020-02-27 09:14:21 UTC (rev 257559)
@@ -348,7 +348,7 @@
     VisiblePosition start = startOfParagraph(originalStart, CanSkipOverEditingBoundary);
     VisiblePosition end = endOfParagraph(start, CanSkipOverEditingBoundary);
     
-    if (start.isNull() || end.isNull())
+    if (start.isNull() || end.isNull() || !start.deepEquivalent().containerNode()->hasEditableStyle() || !end.deepEquivalent().containerNode()->hasEditableStyle())
         return 0;
 
     // Check for adjoining lists.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to