Title: [119701] trunk
Revision
119701
Author
[email protected]
Date
2012-06-07 03:36:38 -0700 (Thu, 07 Jun 2012)

Log Message

InsertUnorderedList and InsertOrderedList (execCommand) do not remove bullets
https://bugs.webkit.org/show_bug.cgi?id=84597

Patch by Arpita Bahuguna <[email protected]> on 2012-06-07
Reviewed by Ryosuke Niwa.

Source/WebCore:

Comparison between start and end VisiblePositions will fail when a position inside
a paragraph is compared with one at the start of the paragraph.

This fix thus converts the end VisiblePosition (which could be inside the paragraph)
to the start of the paragraph thereby enabling a proper comparison of start and end
positions.

Test: editing/execCommand/remove-list-from-multi-list-items.html

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

LayoutTests:

This test verifies removing of an (un)ordered list on a selection consisting of multiple
list items (paragraphs) when the end point of the selection points to the end of the last
list item; followed by another paragraph not part of the selection/list.

* editing/execCommand/remove-list-from-multi-list-items-expected.txt: Added.
* editing/execCommand/remove-list-from-multi-list-items.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119700 => 119701)


--- trunk/LayoutTests/ChangeLog	2012-06-07 10:16:03 UTC (rev 119700)
+++ trunk/LayoutTests/ChangeLog	2012-06-07 10:36:38 UTC (rev 119701)
@@ -1,3 +1,17 @@
+2012-06-07  Arpita Bahuguna  <[email protected]>
+
+        InsertUnorderedList and InsertOrderedList (execCommand) do not remove bullets
+        https://bugs.webkit.org/show_bug.cgi?id=84597
+
+        Reviewed by Ryosuke Niwa.
+
+        This test verifies removing of an (un)ordered list on a selection consisting of multiple
+        list items (paragraphs) when the end point of the selection points to the end of the last
+        list item; followed by another paragraph not part of the selection/list.
+ 
+        * editing/execCommand/remove-list-from-multi-list-items-expected.txt: Added.
+        * editing/execCommand/remove-list-from-multi-list-items.html: Added.
+
 2012-06-07  Yoshifumi Inoue  <[email protected]>
 
         [Forms] Improve test coverage of input-number-size.html

Added: trunk/LayoutTests/editing/execCommand/remove-list-from-multi-list-items-expected.txt (0 => 119701)


--- trunk/LayoutTests/editing/execCommand/remove-list-from-multi-list-items-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/remove-list-from-multi-list-items-expected.txt	2012-06-07 10:36:38 UTC (rev 119701)
@@ -0,0 +1,16 @@
+This test verifies removing of an (Un)OrderedList on a selection consisting of multiple list items (paragaraphs) when the end point of the selection points to the end of the last list item; followed by another paragraph not part of the selection/list.
+| "
+"
+| <p>
+|   id="start"
+|   "<#selection-anchor>This content should"
+|   <br>
+|   "not be displayed as"
+|   <br>
+|   "an unordered list.<#selection-focus>"
+| "
+"
+| <p>
+|   "This is some content that should not be added to the selection or the list."
+| "
+"

Added: trunk/LayoutTests/editing/execCommand/remove-list-from-multi-list-items.html (0 => 119701)


--- trunk/LayoutTests/editing/execCommand/remove-list-from-multi-list-items.html	                        (rev 0)
+++ trunk/LayoutTests/editing/execCommand/remove-list-from-multi-list-items.html	2012-06-07 10:36:38 UTC (rev 119701)
@@ -0,0 +1,17 @@
+<script src=""
+<p>Layout test case for Bugzilla bug <a href=""
+<p id="description">This test verifies removing of an (Un)OrderedList on a selection consisting of multiple list items (paragaraphs) when the end point of the selection points to the end of the last list item; followed by another paragraph not part of the selection/list.</p>
+<div id="test" contenteditable="true">
+<p id="start">This content should</p><p>not be displayed as</p><p id="end">an unordered list.</p>
+<p>This is some content that should not be added to the selection or the list.</p>
+</div>
+<script>
+Markup.description(document.getElementById('description').textContent);
+var sel = window.getSelection();
+var start = document.getElementById("start").firstChild;
+var end = document.getElementById("end").firstChild;
+sel.setBaseAndExtent(start, 0, end, 18);
+document.execCommand("InsertUnorderedList", false, "");
+document.execCommand("InsertUnorderedList", false, "");
+Markup.dump("test");
+</script>

Modified: trunk/Source/WebCore/ChangeLog (119700 => 119701)


--- trunk/Source/WebCore/ChangeLog	2012-06-07 10:16:03 UTC (rev 119700)
+++ trunk/Source/WebCore/ChangeLog	2012-06-07 10:36:38 UTC (rev 119701)
@@ -1,3 +1,22 @@
+2012-06-07  Arpita Bahuguna  <[email protected]>
+
+        InsertUnorderedList and InsertOrderedList (execCommand) do not remove bullets
+        https://bugs.webkit.org/show_bug.cgi?id=84597
+
+        Reviewed by Ryosuke Niwa.
+
+        Comparison between start and end VisiblePositions will fail when a position inside
+        a paragraph is compared with one at the start of the paragraph.
+        
+        This fix thus converts the end VisiblePosition (which could be inside the paragraph)
+        to the start of the paragraph thereby enabling a proper comparison of start and end
+        positions.
+
+        Test: editing/execCommand/remove-list-from-multi-list-items.html
+
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::selectionHasListOfType):
+
 2012-06-07  Li Yin  <[email protected]>
 
         [FileAPI] FileReader should throw an InvalidStateError exception when readyState is LOADING

Modified: trunk/Source/WebCore/editing/InsertListCommand.cpp (119700 => 119701)


--- trunk/Source/WebCore/editing/InsertListCommand.cpp	2012-06-07 10:16:03 UTC (rev 119700)
+++ trunk/Source/WebCore/editing/InsertListCommand.cpp	2012-06-07 10:36:38 UTC (rev 119701)
@@ -87,7 +87,7 @@
     if (!enclosingList(start.deepEquivalent().deprecatedNode()))
         return false;
 
-    VisiblePosition end = selection.visibleEnd();
+    VisiblePosition end = startOfParagraph(selection.visibleEnd());
     while (start.isNotNull() && start != end) {
         Element* listNode = enclosingList(start.deepEquivalent().deprecatedNode());
         if (!listNode || !listNode->hasTagName(listTag))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to