Title: [123995] trunk
Revision
123995
Author
[email protected]
Date
2012-07-29 22:22:58 -0700 (Sun, 29 Jul 2012)

Log Message

forward-delete in the last cell of a table moves the caret after the table
https://bugs.webkit.org/show_bug.cgi?id=24250

Patch by Sukolsak Sakshuwong <[email protected]> on 2012-07-29
Reviewed by Ryosuke Niwa.

Source/WebCore:

The ForwardDelete command moved the cursor after the table when it's invoked
in an empty cell that is the last cell of a table. It also removed the break
element when invoked in an empty cell that is not the last cell of a table.
Make it do nothing inside an empty table cell.

Test: editing/deleting/forward-delete-empty-table-cell.html

* editing/TypingCommand.cpp:
(WebCore::TypingCommand::forwardDeleteKeyPressed):

LayoutTests:

* editing/deleting/forward-delete-empty-table-cell-expected.txt: Added.
* editing/deleting/forward-delete-empty-table-cell.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123994 => 123995)


--- trunk/LayoutTests/ChangeLog	2012-07-30 05:17:30 UTC (rev 123994)
+++ trunk/LayoutTests/ChangeLog	2012-07-30 05:22:58 UTC (rev 123995)
@@ -1,3 +1,13 @@
+2012-07-29  Sukolsak Sakshuwong  <[email protected]>
+
+        forward-delete in the last cell of a table moves the caret after the table
+        https://bugs.webkit.org/show_bug.cgi?id=24250
+
+        Reviewed by Ryosuke Niwa.
+
+        * editing/deleting/forward-delete-empty-table-cell-expected.txt: Added.
+        * editing/deleting/forward-delete-empty-table-cell.html: Added.
+
 2012-07-29  Kent Tamura  <[email protected]>
 
         REGRESSION(r123993): fast/forms/date/calendar-picker-type-change-onclick.html fails

Added: trunk/LayoutTests/editing/deleting/forward-delete-empty-table-cell-expected.txt (0 => 123995)


--- trunk/LayoutTests/editing/deleting/forward-delete-empty-table-cell-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/forward-delete-empty-table-cell-expected.txt	2012-07-30 05:22:58 UTC (rev 123995)
@@ -0,0 +1,30 @@
+This tests forward deleting in an empty table cell. The cursor shouldn't move.
+| "
+"
+| <table>
+|   border="1"
+|   "
+"
+|   <tbody>
+|     "
+"
+|     <tr>
+|       <td>
+|         "1"
+|       <td>
+|         "2"
+|     "
+"
+|     <tr>
+|       <td>
+|         "3"
+|       <td>
+|         id="fourth"
+|         <#selection-caret>
+|         <br>
+|     "
+"
+|   "
+"
+| "
+"

Added: trunk/LayoutTests/editing/deleting/forward-delete-empty-table-cell.html (0 => 123995)


--- trunk/LayoutTests/editing/deleting/forward-delete-empty-table-cell.html	                        (rev 0)
+++ trunk/LayoutTests/editing/deleting/forward-delete-empty-table-cell.html	2012-07-30 05:22:58 UTC (rev 123995)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Forward deleting in an empty table cell</title> 
+<script src=""
+</head> 
+<body>
+<div id="edit" contentEditable="true">
+<table border="1">
+<tbody>
+<tr><td>1</td><td>2</td></tr>
+<tr><td>3</td><td id="fourth"><br></td></tr>
+</tbody>
+</table>
+</div>
+
+<script>
+Markup.description("This tests forward deleting in an empty table cell. The cursor shouldn't move.");
+
+var fourthCell = document.getElementById("fourth");
+
+var range = document.createRange();
+range.selectNodeContents(fourthCell);
+window.getSelection().addRange(range);
+
+document.execCommand("ForwardDelete");
+
+Markup.dump(document.getElementById("edit"));
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (123994 => 123995)


--- trunk/Source/WebCore/ChangeLog	2012-07-30 05:17:30 UTC (rev 123994)
+++ trunk/Source/WebCore/ChangeLog	2012-07-30 05:22:58 UTC (rev 123995)
@@ -1,3 +1,20 @@
+2012-07-29  Sukolsak Sakshuwong  <[email protected]>
+
+        forward-delete in the last cell of a table moves the caret after the table
+        https://bugs.webkit.org/show_bug.cgi?id=24250
+
+        Reviewed by Ryosuke Niwa.
+
+        The ForwardDelete command moved the cursor after the table when it's invoked
+        in an empty cell that is the last cell of a table. It also removed the break
+        element when invoked in an empty cell that is not the last cell of a table.
+        Make it do nothing inside an empty table cell.
+
+        Test: editing/deleting/forward-delete-empty-table-cell.html
+
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::forwardDeleteKeyPressed):
+
 2012-07-29  Kwang Yul Seo  <[email protected]>
 
         Remove unused method HTMLConstructionSiteTask::take(HTMLConstructionSiteTask&)

Modified: trunk/Source/WebCore/editing/TypingCommand.cpp (123994 => 123995)


--- trunk/Source/WebCore/editing/TypingCommand.cpp	2012-07-30 05:17:30 UTC (rev 123994)
+++ trunk/Source/WebCore/editing/TypingCommand.cpp	2012-07-30 05:22:58 UTC (rev 123995)
@@ -554,6 +554,8 @@
 
         Position downstreamEnd = endingSelection().end().downstream();
         VisiblePosition visibleEnd = endingSelection().visibleEnd();
+        if (isEmptyTableCell(visibleEnd.deepEquivalent().containerNode()))
+            return;
         if (visibleEnd == endOfParagraph(visibleEnd))
             downstreamEnd = visibleEnd.next(CannotCrossEditingBoundary).deepEquivalent().downstream();
         // When deleting tables: Select the table first, then perform the deletion
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to