LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Oct 2006 20:42:17 +0000 (20:42 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Oct 2006 20:42:17 +0000 (20:42 +0000)
commitfac398149a2b9183d31bb39e04cd1f1fa177aa4b
tree4e13e01c4dc9cb8ae2d8c23dd64bde1c4dc8c3c2
parentada4144308a2b569de1b1bc4aea1bdbbb9edbca4
LayoutTests:

        Reviewed by harrison

        <http://bugs.webkit.org/show_bug.cgi?id=11423>
        REGRESSION: First newline missing from textarea's value

        Changes reflect the removal of more brs that were about
        to collapse:
        * editing/deleting/delete-4038408-fix-expected.txt:
        * editing/inserting/insert-3654864-fix-expected.txt:
        * editing/inserting/insert-3659587-fix-expected.txt:
        * editing/inserting/insert-3775316-fix-expected.txt:
        * editing/inserting/insert-at-end-01-expected.txt:
        * editing/inserting/insert-at-end-02-expected.txt:
        * editing/inserting/insert-br-001-expected.txt:
        * editing/inserting/insert-br-005-expected.txt:

        Added to demonstrate fix:
        * fast/forms/11423-expected.txt: Added.
        * fast/forms/11423.html: Added.

WebCore:

        Reviewed by harrison

        <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 a '\n'
        (the line break) then a br to prevent the '\n' from collapsing, 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 or collapsed.

        We could remove this assumption, but, for consistancy's sake, I changed InsertLineBreak
        to insert two '\n's when at the end of a block in white-space:pre text.  This alone
        would have fixed the bug, but introduced a new one, because foo, return, bar would
        produce "foo\nbar\n" which would serialize as "foo\nbar\n" (even though the second
        '\n' is collapsed, because of 9661).  So, then I changed placeholder displacement to
        displace a '\n' if it's acting as a placeholder.  A "placeholder" is now defined as
        a br or '\n' that will collapse (become superfluous) when content is inserted just
        before it.

        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::removePlaceholderAt): Renamed.  Remove
        a br or '\n' if content inserted just before it will cause it to collapse.
        * editing/CompositeEditCommand.h:
        * editing/InsertLineBreakCommand.cpp:
        (WebCore::InsertLineBreakCommand::doApply): Insert the same type of node
        to prevent a collapse as was used for the line break.  Fixed comments.
        * editing/InsertTextCommand.cpp:
        (WebCore::InsertTextCommand::input): Call the renamed function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17386 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/deleting/delete-4038408-fix-expected.txt
LayoutTests/editing/inserting/insert-3654864-fix-expected.txt
LayoutTests/editing/inserting/insert-3659587-fix-expected.txt
LayoutTests/editing/inserting/insert-3775316-fix-expected.txt
LayoutTests/editing/inserting/insert-at-end-01-expected.txt
LayoutTests/editing/inserting/insert-at-end-02-expected.txt
LayoutTests/editing/inserting/insert-br-001-expected.txt
LayoutTests/editing/inserting/insert-br-005-expected.txt
LayoutTests/fast/forms/11423-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/11423.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/CompositeEditCommand.cpp
WebCore/editing/CompositeEditCommand.h
WebCore/editing/InsertLineBreakCommand.cpp
WebCore/editing/InsertTextCommand.cpp