WebKit places caret in front of pasted Numbers cells instead of behind
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Apr 2015 16:03:07 +0000 (16:03 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Apr 2015 16:03:07 +0000 (16:03 +0000)
commitc7949941c3444354663317639e8ce942052084e3
tree2e47576af180a16c4e27c6d0939c09fe4aa22d7c
parent44745fe2265afe87d07e038d4c95f10e21b0410a
WebKit places caret in front of pasted Numbers cells instead of behind
https://bugs.webkit.org/show_bug.cgi?id=143627

Reviewed by Darin Adler.

The bug was caused by Position::downstream not respecting modern position types inside a table.
Fixed it by using Position::atStartOfNode which respects before/after positions.

This bug doesn't reproduce when there is no whitespace after td element in the pasted content
because positionAtEndOfInsertedContent() will be inside the last pasted cell inside
ReplaceSelectionCommand::completeHTMLReplacement in those cases. This related but separate bug
is tracked in https://webkit.org/b/143628.

Tests: editing/pasteboard/paste-table-with-unrendered-text-nodes.html

* dom/Position.cpp:
(WebCore::Position::downstream):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/editing/pasteboard/paste-table-with-unrendered-text-nodes-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/paste-table-with-unrendered-text-nodes.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Position.cpp