Title: [95017] trunk
Revision
95017
Author
commit-qu...@webkit.org
Date
2011-09-12 22:57:30 -0700 (Mon, 12 Sep 2011)

Log Message

Crashes in WebCore::InsertListCommand::unlistifyParagraph.
https://bugs.webkit.org/show_bug.cgi?id=67918

Patch by Shinya Kawanaka <shin...@google.com> on 2011-09-12
Reviewed by Ryosuke Niwa.

Source/WebCore:

execCommand("InsertUnorderedList") was crashing if the parent node of the target is
a kind of list element and it is not contenteditable.
This patch checks the parent node is contenteditable.

Test: editing/execCommand/insert-list-in-noneditable-list-parent.html

* editing/htmlediting.cpp:
(WebCore::enclosingListChild): Checks the parent node is contenteditable.

LayoutTests:

Added tests.

* editing/execCommand/insert-list-in-noneditable-list-parent-expected.txt: Added.
* editing/execCommand/insert-list-in-noneditable-list-parent.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95016 => 95017)


--- trunk/LayoutTests/ChangeLog	2011-09-13 05:35:53 UTC (rev 95016)
+++ trunk/LayoutTests/ChangeLog	2011-09-13 05:57:30 UTC (rev 95017)
@@ -1,3 +1,15 @@
+2011-09-12  Shinya Kawanaka  <shin...@google.com>
+
+        Crashes in WebCore::InsertListCommand::unlistifyParagraph.
+        https://bugs.webkit.org/show_bug.cgi?id=67918
+
+        Reviewed by Ryosuke Niwa.
+
+        Added tests.
+
+        * editing/execCommand/insert-list-in-noneditable-list-parent-expected.txt: Added.
+        * editing/execCommand/insert-list-in-noneditable-list-parent.html: Added.
+
 2011-09-12  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r94975.

Added: trunk/LayoutTests/editing/execCommand/insert-list-in-noneditable-list-parent-expected.txt (0 => 95017)


--- trunk/LayoutTests/editing/execCommand/insert-list-in-noneditable-list-parent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/insert-list-in-noneditable-list-parent-expected.txt	2011-09-13 05:57:30 UTC (rev 95017)
@@ -0,0 +1,32 @@
+execCommand("InsertUnorderedList") for contenteditable root element was crashing. The test has passed if it does not crash.
+PASS
+| "
+    "
+| <dl>
+|   <div>
+|     contenteditable="true"
+|     id="div1"
+|     <ul>
+|       <li>
+|         <br>
+| "
+    "
+| <ul>
+|   <div>
+|     contenteditable="true"
+|     id="div2"
+|     <ul>
+|       <li>
+|         <br>
+| "
+    "
+| <ol>
+|   <div>
+|     contenteditable="true"
+|     id="div3"
+|     <ul>
+|       <li>
+|         <#selection-caret>
+|         <br>
+| "
+"

Added: trunk/LayoutTests/editing/execCommand/insert-list-in-noneditable-list-parent.html (0 => 95017)


--- trunk/LayoutTests/editing/execCommand/insert-list-in-noneditable-list-parent.html	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/insert-list-in-noneditable-list-parent.html	2011-09-13 05:57:30 UTC (rev 95017)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+
+<script src=""
+<div id="div">
+    <dl><div id="div1" contenteditable="true"></div></dl>
+    <ul><div id="div2" contenteditable="true"></div></ul>
+    <ol><div id="div3" contenteditable="true"></div></ol>
+</div>
+
+<script>
+div1.focus();
+document.execCommand("InsertUnorderedList");
+
+div2.focus();
+document.execCommand("InsertUnorderedList");
+
+div3.focus();
+document.execCommand("InsertUnorderedList");
+
+Markup.description('execCommand("InsertUnorderedList") for contenteditable root element was crashing. The test has passed if it does not crash.\nPASS');
+Markup.dump(div);
+</script>

Modified: trunk/Source/WebCore/ChangeLog (95016 => 95017)


--- trunk/Source/WebCore/ChangeLog	2011-09-13 05:35:53 UTC (rev 95016)
+++ trunk/Source/WebCore/ChangeLog	2011-09-13 05:57:30 UTC (rev 95017)
@@ -1,3 +1,19 @@
+2011-09-12  Shinya Kawanaka  <shin...@google.com>
+
+        Crashes in WebCore::InsertListCommand::unlistifyParagraph.
+        https://bugs.webkit.org/show_bug.cgi?id=67918
+
+        Reviewed by Ryosuke Niwa.
+
+        execCommand("InsertUnorderedList") was crashing if the parent node of the target is
+        a kind of list element and it is not contenteditable.
+        This patch checks the parent node is contenteditable.
+
+        Test: editing/execCommand/insert-list-in-noneditable-list-parent.html
+
+        * editing/htmlediting.cpp:
+        (WebCore::enclosingListChild): Checks the parent node is contenteditable.
+
 2011-09-12  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r94975.

Modified: trunk/Source/WebCore/editing/htmlediting.cpp (95016 => 95017)


--- trunk/Source/WebCore/editing/htmlediting.cpp	2011-09-13 05:35:53 UTC (rev 95016)
+++ trunk/Source/WebCore/editing/htmlediting.cpp	2011-09-13 05:57:30 UTC (rev 95017)
@@ -666,7 +666,7 @@
     
     // FIXME: This function is inappropriately named if it starts with node instead of node->parentNode()
     for (Node* n = node; n && n->parentNode(); n = n->parentNode()) {
-        if (n->hasTagName(liTag) || isListElement(n->parentNode()))
+        if (n->hasTagName(liTag) || (isListElement(n->parentNode()) && n != root))
             return n;
         if (n == root || isTableCell(n))
             return 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to