REGRESSION(r164329): Input fields are not honoring the maxlength attribute
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2014 22:10:23 +0000 (22:10 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2014 22:10:23 +0000 (22:10 +0000)
commit5b6f0543470faa6a0a45f582d3a95751a55f1fcc
tree9f4a74adee8c4cd860abe693e7f48b76d4e6e884
parent2f4f9e6e225b889eb56c0ba3981303b9c5c3dfbc
REGRESSION(r164329): Input fields are not honoring the maxlength attribute
https://bugs.webkit.org/show_bug.cgi?id=139447

Reviewed by Benjamin Poulain.

Source/WebCore:

The bug was caused by String::substring being called with the selection's end offset
in the second argument instead of the selection's length in handleBeforeTextInsertedEvent.

Fixed the bug by passing the right second argument to String::substring.

Test: fast/forms/input-maxlength-inserting-in-middle.html

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::handleBeforeTextInsertedEvent):

LayoutTests:

Added regression tests.

* fast/forms/input-maxlength-inserting-in-middle-expected.txt: Added.
* fast/forms/input-maxlength-inserting-in-middle.html: Added.
* fast/forms/input-maxlength-paste-clusters-in-middle-expected.txt: Added.
* fast/forms/input-maxlength-paste-clusters-in-middle.html: Added.
* fast/forms/input-maxlength-paste-in-middle-expected.txt: Added.
* fast/forms/input-maxlength-paste-in-middle.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/input-maxlength-inserting-in-middle-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-maxlength-inserting-in-middle.html [new file with mode: 0644]
LayoutTests/fast/forms/input-maxlength-paste-clusters-in-middle-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-maxlength-paste-clusters-in-middle.html [new file with mode: 0644]
LayoutTests/fast/forms/input-maxlength-paste-in-middle-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-maxlength-paste-in-middle.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/TextFieldInputType.cpp