<https://webkit.org/b/119917> Pasting multiple lines into a textarea can introduce extra new lines
Reviewed by Darin Adler.
Source/WebCore:
Inspired by https://chromium.googlesource.com/chromium/blink/+/6152a12f7ace27beea4d284ff8416631e8aa5217.
The bug was caused by createFragmentFromText's falsely assuming that the newline were not preserved
if the first node's renderer didn't exist.
Fixed the bug by obtaining the renderer of the container of the first visible position in the context.
Test: editing/pasteboard/paste-into-textarea-with-new-line.html
* editing/markup.cpp:
(WebCore::contextPreservesNewline):
(WebCore::createFragmentFromText):
LayoutTests:
Add a regression test.
* editing/pasteboard/paste-into-textarea-with-new-line-expected.txt: Added.
* editing/pasteboard/paste-into-textarea-with-new-line.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
5 files changed