2011-03-16  Naoki Takano  <takano.naoki@gmail.com>

        Reviewed by Ryosuke Niwa.

        Textarea maxlength doesn't account for newlines
        https://bugs.webkit.org/show_bug.cgi?id=54443

        * fast/forms/script-tests/textarea-maxlength.js:
        (createFocusedTextAreaWithMaxLength3): Added two tests to make sure consecutive insertbreaks
        work correctly for textarea maxlength.
        * fast/forms/textarea-maxlength-expected.txt: Added two test results.
2011-03-16  Naoki Takano  <takano.naoki@gmail.com>

        Reviewed by Ryosuke Niwa.

        Textarea maxlength doesn't account for newlines
        https://bugs.webkit.org/show_bug.cgi?id=54443

        When a user presses a return key, TypingCommand::insertLineBreak() is called.
        So before append a new line, check if we can add the new line.

        * editing/TypingCommand.cpp:
        (WebCore::canAppendNewLineFeed): Implement new helper function to check if we can add new line.
        (WebCore::TypingCommand::insertLineBreak): Added check logic before adding the new line.
        (WebCore::TypingCommand::insertParagraphSeparator): Added check logic before adding the new line.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81328 268f45cc-cd09-0410-ab3c-d52691b4dbfc
5 files changed