<https://webkit.org/b/119917> Pasting multiple lines into a textarea can introduce...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Aug 2013 18:54:12 +0000 (18:54 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 18 Aug 2013 18:54:12 +0000 (18:54 +0000)
commit6e782ad32d67d8808833eecebb8025214578e919
tree01e7ed02dd40aec3ab3b598d38b7052737f403b1
parentd442d9f7414e0b78ac6ca892200e2ca4d6240442
<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: https://svn.webkit.org/repository/webkit/trunk@154252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/paste-into-textarea-with-new-line-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/paste-into-textarea-with-new-line.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/editing/markup.cpp