RESOLVED FIXED 11423
REGRESSION: First newline missing from textarea's value
https://bugs.webkit.org/show_bug.cgi?id=11423
Summary REGRESSION: First newline missing from textarea's value
mitz
Reported 2006-10-26 07:36:48 PDT
The first newline in a textarea isn't included in the value when submitted or accessed via the value property. See the attached test case.
Attachments
Test case (191 bytes, text/html)
2006-10-26 07:38 PDT, mitz
no flags
patch (30.08 KB, patch)
2006-10-26 19:31 PDT, Justin Garcia
no flags
mitz
Comment 1 2006-10-26 07:38:01 PDT
Created attachment 11225 [details] Test case When you click Test, the words in the alert box should be on seaprate lines. In TOT, the first two words are one the same line with no space between them.
Justin Garcia
Comment 2 2006-10-26 15:58:24 PDT
Sounds like this might have been caused by my TextIterator changed. Checking.
Justin Garcia
Comment 3 2006-10-26 16:22:35 PDT
This regressed between 17205 and 17233. My change in 17223 seems most likely.
Justin Garcia
Comment 4 2006-10-26 16:23:13 PDT
...although, it didn't touch serialization.
Justin Garcia
Comment 5 2006-10-26 16:34:06 PDT
It was definitely my changes in r17223 that caused this. Before, when inserting a line break after the first paragraph, 'foo', we'd insert a '\n' (because the text is white-space:pre, and then we'd insert an extra br so that the '\n' would hold its own line open, and the extra br was inserted after the '\n'. Now the br is inserted before the '\n', and so it is the '\n' that is displaced by 'bar', leaving the br to break the line, whereas before it was the br that was displaced, and '\n' held open the line. Apparently, there is a serialization bug that leaves out brs. The quick fix is to, in InsertLineBreakCommand, use the same type of node that we used for the line break in the case that that break collapsed because it was inserted at the end of a block.
Justin Garcia
Comment 6 2006-10-26 19:31:25 PDT
mitz
Comment 7 2006-10-27 05:02:30 PDT
Comment on attachment 11231 [details] patch Justin, did you intentionally not set the review flag?
Justin Garcia
Comment 8 2006-10-27 14:02:13 PDT
harrison reviewed this and I checked it in in r17386.
David Kilzer (:ddkilzer)
Comment 9 2006-10-27 14:21:02 PDT
Comment on attachment 11231 [details] patch >Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 17351) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,40 @@ >+2006-10-26 Justin Garcia <justin.garcia@apple.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ <http://bugs.webkit.org/show_bug.cgi?id=11423> >+ REGRESSION: First newline missing from textarea's value >+ >+ The regression is that foo, return, bar in a textarea serializes as 'foobar'. >+ >+ Before my change in r11423, return (an InsertLineBreak) would insert '\n' (the >+ line break) then a br to prevent a collapse, since the insertion is being done >+ at the end of a block (the textarea's shadow div). Then, inserting "bar" would >+ displace the br, and "foo\nbar" would serialize as "foo\nbar". After my change >+ in r11423, InsertLineBreak would insert a br then a '\n' (reversed the order). >+ Then inserting "bar" would displace the '\n' and "foo"<br>"bar" would serialize as >+ "foobar" because when serializing RenderTextControl intentionally asks textContent >+ to not convert brs to newlines. It seems to think that the only brs in the shadow >+ div will be placeholders. Justin, don't you mean "r17223" (per Comment #5) above instead of "r11423"?
Justin Garcia
Comment 10 2006-10-27 15:14:21 PDT
> Justin, don't you mean "r17223" (per Comment #5) above instead of "r11423"? Oops. Fixed. Thanks.
Note You need to log in before you can comment on or make changes to this bug.