REGRESSION(r180726): Removing an empty line at the end of textarea clears the entire texture
https://bugs.webkit.org/show_bug.cgi?id=142646
Reviewed by Darin Adler.
Source/WebCore:
The bug was caused by TypingCommand::deleteKeyPressed erroneously determining the editable root to be empty because
Position::atStartOfTree returns true when it's anchored at a BR that is immediately below the root editable element.
Fixed the bug by replacing the use of the deprecated atFirstEditingPositionForNode by a code that understands modern
position types such as PositionIsBeforeAnchor in atStartOfTree and atEndOfTree. These two functions will no longer
return true when anchored before or after BR after this patch.
Test: editing/deleting/delete-empty-line-breaks-at-end-of-textarea.html
* dom/Position.cpp:
(WebCore::Position::atStartOfTree):
(WebCore::Position::atEndOfTree):
LayoutTests:
Added a regression test for deleting empty lines at the end of a textarea element.
* editing/deleting/delete-empty-line-breaks-at-end-of-textarea-expected.txt: Added.
* editing/deleting/delete-empty-line-breaks-at-end-of-textarea.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181465
268f45cc-cd09-0410-ab3c-
d52691b4dbfc