REGRESSION(r180726): Removing an empty line at the end of textarea clears the entire...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Mar 2015 00:57:10 +0000 (00:57 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Mar 2015 00:57:10 +0000 (00:57 +0000)
commit802b1b162b44cb2176ac13d60ce8f357d4dad207
tree26d83d77540678afc366e02d12a90e704c768b34
parent4822c011d4c00f333534b9d8f1c8704f18c1b298
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
LayoutTests/ChangeLog
LayoutTests/editing/deleting/delete-empty-line-breaks-at-end-of-textarea-expected.txt [new file with mode: 0644]
LayoutTests/editing/deleting/delete-empty-line-breaks-at-end-of-textarea.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Position.cpp