Title: [257408] trunk
Revision
257408
Author
commit-qu...@webkit.org
Date
2020-02-25 21:26:02 -0800 (Tue, 25 Feb 2020)

Log Message

ASSERTION FAILURE in AppendNodeCommand::AppendNodeCommand when inserting list with read-only user-modify
https://bugs.webkit.org/show_bug.cgi?id=208045
<rdar://problem/39023383>

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

When inserting a list (InsertListCommand) around enclosed list items, if new list is not editable, skip moving list items in function doApplyForSingleParagraph.

Source/WebCore:

Test: fast/lists/insert-list-user-modify-read-only-enclosed-li.html

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

LayoutTests:

* fast/lists/insert-list-user-modify-read-only-enclosed-li-expected.txt: Added.
* fast/lists/insert-list-user-modify-read-only-enclosed-li.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (257407 => 257408)


--- trunk/LayoutTests/ChangeLog	2020-02-26 05:18:06 UTC (rev 257407)
+++ trunk/LayoutTests/ChangeLog	2020-02-26 05:26:02 UTC (rev 257408)
@@ -1,5 +1,18 @@
 2020-02-25  Jack Lee  <shihchieh_...@apple.com>
 
+        ASSERTION FAILURE in AppendNodeCommand::AppendNodeCommand when inserting list with read-only user-modify
+        https://bugs.webkit.org/show_bug.cgi?id=208045
+        <rdar://problem/39023383>
+
+        Reviewed by Ryosuke Niwa.
+
+        When inserting a list (InsertListCommand) around enclosed list items, if new list is not editable, skip moving list items in function doApplyForSingleParagraph.
+
+        * fast/lists/insert-list-user-modify-read-only-enclosed-li-expected.txt: Added.
+        * fast/lists/insert-list-user-modify-read-only-enclosed-li.html: Added.
+
+2020-02-25  Jack Lee  <shihchieh_...@apple.com>
+
         Nullptr crash in CompositeEditCommand::splitTreeToNode
         https://bugs.webkit.org/show_bug.cgi?id=208039
         <rdar://problem/52011355>

Added: trunk/LayoutTests/fast/lists/insert-list-user-modify-read-only-enclosed-li-expected.txt (0 => 257408)


--- trunk/LayoutTests/fast/lists/insert-list-user-modify-read-only-enclosed-li-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/lists/insert-list-user-modify-read-only-enclosed-li-expected.txt	2020-02-26 05:26:02 UTC (rev 257408)
@@ -0,0 +1 @@
+Tests inserting ol when user-modify is read-only, with an enclosed li. The test passes if WebKit doesn't crash or hit an assertion.

Added: trunk/LayoutTests/fast/lists/insert-list-user-modify-read-only-enclosed-li.html (0 => 257408)


--- trunk/LayoutTests/fast/lists/insert-list-user-modify-read-only-enclosed-li.html	                        (rev 0)
+++ trunk/LayoutTests/fast/lists/insert-list-user-modify-read-only-enclosed-li.html	2020-02-26 05:26:02 UTC (rev 257408)
@@ -0,0 +1,13 @@
+<style>
+dir { -webkit-user-modify: read-write; }
+ol { -webkit-user-modify: read-only;}
+</style>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    _onload_ = function fun() {
+        window.getSelection().setBaseAndExtent(LI,0,LI,0);
+        document.execCommand("insertOrderedList", false);
+    }
+</script>
+<body><dir><ul><li id=LI></ul><span>Tests inserting ol when user-modify is read-only, with an enclosed li. The test passes if WebKit doesn't crash or hit an assertion.</span>

Modified: trunk/Source/WebCore/ChangeLog (257407 => 257408)


--- trunk/Source/WebCore/ChangeLog	2020-02-26 05:18:06 UTC (rev 257407)
+++ trunk/Source/WebCore/ChangeLog	2020-02-26 05:26:02 UTC (rev 257408)
@@ -1,5 +1,20 @@
 2020-02-25  Jack Lee  <shihchieh_...@apple.com>
 
+        ASSERTION FAILURE in AppendNodeCommand::AppendNodeCommand when inserting list with read-only user-modify
+        https://bugs.webkit.org/show_bug.cgi?id=208045
+        <rdar://problem/39023383>
+
+        Reviewed by Ryosuke Niwa.
+
+        When inserting a list (InsertListCommand) around enclosed list items, if new list is not editable, skip moving list items in function doApplyForSingleParagraph.
+
+        Test: fast/lists/insert-list-user-modify-read-only-enclosed-li.html
+
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::doApplyForSingleParagraph):
+
+2020-02-25  Jack Lee  <shihchieh_...@apple.com>
+
         Nullptr crash in CompositeEditCommand::splitTreeToNode
         https://bugs.webkit.org/show_bug.cgi?id=208039
         <rdar://problem/52011355>

Modified: trunk/Source/WebCore/editing/InsertListCommand.cpp (257407 => 257408)


--- trunk/Source/WebCore/editing/InsertListCommand.cpp	2020-02-26 05:18:06 UTC (rev 257407)
+++ trunk/Source/WebCore/editing/InsertListCommand.cpp	2020-02-26 05:26:02 UTC (rev 257408)
@@ -233,6 +233,8 @@
 
             RefPtr<HTMLElement> newList = createHTMLElement(document(), listTag);
             insertNodeBefore(*newList, *listNode);
+            if (!newList->hasEditableStyle())
+                return;
 
             auto* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().deprecatedNode(), listNode.get());
             Node* outerBlock = firstChildInList && isBlockFlowElement(*firstChildInList) ? firstChildInList : listNode.get();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to