Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Issue 435753003: Implement minlength for <input> and <textarea>. (Closed)

Created:
6 years, 4 months ago by Bartek Nowierski
Modified:
6 years, 2 months ago
Reviewers:
keishi, tkent, haraken
CC:
blink-reviews, dglazkov+blink, blink-reviews-html_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Implement minlength for <input> and <textarea>. Add layout tests to test minlength behavior and new tooShort validity property. Enrich maxlength/tooLong layout tests while at it. BUG=390485 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183454

Patch Set 1 #

Total comments: 10

Patch Set 2 : Sync and make it build #

Patch Set 3 : Add support for minlength in remaining places and stop clasping it with maxlength #

Total comments: 12

Patch Set 4 : Added: message localization, minLength atribute, first layout test #

Patch Set 5 : Add layout tests and small fixes #

Patch Set 6 : Add more layout tests #

Total comments: 8

Patch Set 7 : Add layout tests for minlength & maxlength together; fix comments #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+698 lines, -29 lines) Patch
M LayoutTests/fast/forms/ValidityState-tooLong-input.html View 1 2 3 4 5 6 2 chunks +53 lines, -4 lines 0 comments Download
M LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt View 1 2 3 4 5 6 2 chunks +22 lines, -2 lines 0 comments Download
M LayoutTests/fast/forms/ValidityState-tooLong-textarea.html View 1 2 3 4 5 6 2 chunks +52 lines, -4 lines 0 comments Download
M LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt View 1 2 3 4 5 6 2 chunks +22 lines, -2 lines 0 comments Download
A LayoutTests/fast/forms/ValidityState-tooShort-input.html View 1 2 3 4 1 chunk +79 lines, -0 lines 0 comments Download
A LayoutTests/fast/forms/ValidityState-tooShort-input-expected.txt View 1 2 3 4 1 chunk +39 lines, -0 lines 0 comments Download
A LayoutTests/fast/forms/ValidityState-tooShort-textarea.html View 1 2 3 4 1 chunk +94 lines, -0 lines 0 comments Download
A LayoutTests/fast/forms/ValidityState-tooShort-textarea-expected.txt View 1 2 3 4 1 chunk +46 lines, -0 lines 0 comments Download
M LayoutTests/fast/forms/textarea-maxlength.html View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M LayoutTests/fast/forms/textarea-maxlength-expected.txt View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
A LayoutTests/fast/forms/textarea-minlength.html View 1 2 3 4 1 chunk +47 lines, -0 lines 0 comments Download
A LayoutTests/fast/forms/textarea-minlength-expected.txt View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
M LayoutTests/fast/forms/validationMessage.html View 1 2 3 4 1 chunk +30 lines, -0 lines 0 comments Download
M LayoutTests/fast/forms/validationMessage-expected.txt View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M LayoutTests/fast/forms/validity-property.html View 1 2 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/fast/forms/validity-property-expected.txt View 1 2 1 chunk +8 lines, -8 lines 0 comments Download
M Source/core/html/FormAssociatedElement.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/html/FormAssociatedElement.cpp View 1 2 3 4 5 6 2 chunks +7 lines, -1 line 0 comments Download
M Source/core/html/HTMLAttributeNames.in View 1 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLInputElement.h View 1 2 3 4 5 6 5 chunks +6 lines, -0 lines 2 comments Download
M Source/core/html/HTMLInputElement.cpp View 1 2 3 4 5 6 7 chunks +45 lines, -2 lines 0 comments Download
M Source/core/html/HTMLInputElement.idl View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLTextAreaElement.h View 1 2 3 4 5 6 3 chunks +4 lines, -0 lines 0 comments Download
M Source/core/html/HTMLTextAreaElement.cpp View 1 2 3 4 5 chunks +50 lines, -3 lines 2 comments Download
M Source/core/html/HTMLTextAreaElement.idl View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLTextFormControlElement.h View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/html/ValidityState.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/ValidityState.cpp View 1 1 chunk +5 lines, -0 lines 0 comments Download
M Source/core/html/ValidityState.idl View 1 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/forms/BaseTextInputType.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/html/forms/BaseTextInputType.cpp View 1 2 3 2 chunks +21 lines, -0 lines 0 comments Download
M Source/core/html/forms/InputType.h View 1 2 3 4 5 6 2 chunks +2 lines, -0 lines 0 comments Download
M Source/core/html/forms/InputType.cpp View 1 2 3 3 chunks +13 lines, -0 lines 0 comments Download
M Source/platform/text/PlatformLocale.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/platform/text/PlatformLocale.cpp View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (5 generated)
keishi
We are the first browsers to support minLength so I think we should be strict ...
6 years, 4 months ago (2014-08-01 03:14:54 UTC) #1
Bartek Nowierski
https://codereview.chromium.org/435753003/diff/1/Source/core/html/HTMLInputElement.cpp File Source/core/html/HTMLInputElement.cpp (right): https://codereview.chromium.org/435753003/diff/1/Source/core/html/HTMLInputElement.cpp#newcode265 Source/core/html/HTMLInputElement.cpp:265: if (!isTextType()) On 2014/08/01 03:14:54, keishi wrote: > We ...
6 years, 2 months ago (2014-10-03 12:52:00 UTC) #2
keishi
This needs layout tests. Something like ValidityState-tooLong-input.html and ValidityState-tooLong-textarea.html. https://codereview.chromium.org/435753003/diff/40001/Source/core/html/HTMLInputElement.cpp File Source/core/html/HTMLInputElement.cpp (right): https://codereview.chromium.org/435753003/diff/40001/Source/core/html/HTMLInputElement.cpp#newcode1318 Source/core/html/HTMLInputElement.cpp:1318: ...
6 years, 2 months ago (2014-10-06 03:58:23 UTC) #3
Bartek Nowierski
I held off on layout tests until I had confidence that I'm going in the ...
6 years, 2 months ago (2014-10-06 13:18:17 UTC) #4
keishi
https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html File LayoutTests/fast/forms/ValidityState-tooLong-input.html (right): https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html#newcode1 LayoutTests/fast/forms/ValidityState-tooLong-input.html:1: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> Changes to LayoutTests/fast/forms/ValidityState-tooLong-input.html and ...
6 years, 2 months ago (2014-10-08 09:17:49 UTC) #5
Bartek Nowierski
https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html File LayoutTests/fast/forms/ValidityState-tooLong-input.html (right): https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html#newcode1 LayoutTests/fast/forms/ValidityState-tooLong-input.html:1: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> On 2014/10/08 09:17:49, keishi ...
6 years, 2 months ago (2014-10-09 05:32:56 UTC) #6
keishi
LGTM +tkent https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html File LayoutTests/fast/forms/ValidityState-tooLong-input.html (right): https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html#newcode1 LayoutTests/fast/forms/ValidityState-tooLong-input.html:1: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> On 2014/10/09 ...
6 years, 2 months ago (2014-10-09 05:59:55 UTC) #8
Bartek Nowierski
+haraken to approve file changes under platform/text/ https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html File LayoutTests/fast/forms/ValidityState-tooLong-input.html (right): https://codereview.chromium.org/435753003/diff/100001/LayoutTests/fast/forms/ValidityState-tooLong-input.html#newcode1 LayoutTests/fast/forms/ValidityState-tooLong-input.html:1: <!DOCTYPE HTML ...
6 years, 2 months ago (2014-10-09 06:26:59 UTC) #10
haraken
LGTM for platform/.
6 years, 2 months ago (2014-10-09 07:37:20 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/435753003/120001
6 years, 2 months ago (2014-10-09 07:39:37 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_gn_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_chromium_gn_rel/builds/13068)
6 years, 2 months ago (2014-10-09 08:36:44 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/435753003/120001
6 years, 2 months ago (2014-10-09 09:38:44 UTC) #17
commit-bot: I haz the power
Committed patchset #7 (id:120001) as 183454
6 years, 2 months ago (2014-10-09 10:33:01 UTC) #18
tkent
https://codereview.chromium.org/435753003/diff/120001/Source/core/html/HTMLInputElement.h File Source/core/html/HTMLInputElement.h (right): https://codereview.chromium.org/435753003/diff/120001/Source/core/html/HTMLInputElement.h#newcode362 Source/core/html/HTMLInputElement.h:362: int m_minLength; I don't think we need new data ...
6 years, 2 months ago (2014-10-15 00:50:25 UTC) #19
Bartek Nowierski
6 years, 2 months ago (2014-10-16 04:55:14 UTC) #20
Message was sent while issue was closed.
https://codereview.chromium.org/435753003/diff/120001/Source/core/html/HTMLIn...
File Source/core/html/HTMLInputElement.h (right):

https://codereview.chromium.org/435753003/diff/120001/Source/core/html/HTMLIn...
Source/core/html/HTMLInputElement.h:362: int m_minLength;
On 2014/10/15 00:50:25, tkent wrote:
> I don't think we need new data member.  We should try to parse minlength
> attribute value on demand.  If it has performance problems, we should
introduce
> m_minLength then.

Someone decided that it's worth doing for maxlength, so just for symmetry we
might as well do it for minlength. The advantage of this approach is that it's
obvious that if one is correct then the other is correct too.

https://codereview.chromium.org/435753003/diff/120001/Source/core/html/HTMLTe...
File Source/core/html/HTMLTextAreaElement.cpp (right):

https://codereview.chromium.org/435753003/diff/120001/Source/core/html/HTMLTe...
Source/core/html/HTMLTextAreaElement.cpp:459: int value =
getAttribute(minlengthAttr).string().toInt(&ok);
On 2014/10/15 00:50:25, tkent wrote:
> should use parseHTMLInteger() like
HTMLInputElement::parseMinLengthAttribute().
> 
> The maxlength() above is not good too.

Good point! I'll change it for both minLength and maxLength.

Powered by Google App Engine
This is Rietveld 408576698