[Forms] The "maxlength" attribute on "textarea" tag miscounts hard newlines
https://bugs.webkit.org/show_bug.cgi?id=74686
Patch by Yosifumi Inoue <yosin@chromium.org> on 2011-12-16
Reviewed by Kent Tamura.
Source/WebCore:
This patch counts LF in textarea value as two for LF to CRLF conversion on submission.
No new tests. Existing tests cover all changes.
* html/HTMLTextAreaElement.cpp:
(WebCore::computeLengthForSubmission): Count LF as 2 for CR LF conversion on submission.
(WebCore::HTMLTextAreaElement::handleBeforeTextInsertedEvent): Use computeLengthForSubmission instead of numGraphemeClusters.
(WebCore::HTMLTextAreaElement::tooLong): Use computeLengthForSubmission instead of numGraphemeClusters.
LayoutTests:
* fast/forms/script-tests/textarea-maxlength.js: Doubles maxlength for counting LF as two chars.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103051 268f45cc-cd09-0410-ab3c-d52691b4dbfc
4 files changed