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 <sukolsak@google.com> 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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp
index 2194736..1c0aa78 100644
--- a/Source/WebCore/editing/TypingCommand.cpp
+++ b/Source/WebCore/editing/TypingCommand.cpp
@@ -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