Description was changed from ========== maxlength WIP BUG= ========== to ========== Fix behavior of HTMLInputElement.maxLength/minLength ...
4 years, 11 months ago
(2016-01-21 22:34:17 UTC)
#1
Description was changed from
==========
maxlength WIP
BUG=
==========
to
==========
Fix behavior of HTMLInputElement.maxLength/minLength getter
According to [1], the maxLength/minLength getter should "if the attribute
is absent, the default value must be returned instead, or −1 if there is
no default value". Since maxLength/minLength do not have a default value
indeed -1 should be used.
This fixes the imported w3c test:
http://w3c-test.org/html/semantics/forms/the-input-element/maxlength.html
Behavior matches Firefox.
[1]
https://html.spec.whatwg.org/multipage/infrastructure.html#limited-to-only-no...
==========
4 years, 11 months ago
(2016-01-21 22:34:46 UTC)
#3
PTAL.
tkent
Please file new bug for this bug. The code change LGTM. https://codereview.chromium.org/1615003002/diff/20001/third_party/WebKit/LayoutTests/fast/forms/text/input-maxlength.html File third_party/WebKit/LayoutTests/fast/forms/text/input-maxlength.html (right): ...
4 years, 11 months ago
(2016-01-22 05:03:30 UTC)
#4
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1615003002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1615003002/40001
4 years, 11 months ago
(2016-01-22 15:06:04 UTC)
#9
Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/105679)
4 years, 11 months ago
(2016-01-22 15:54:35 UTC)
#13
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1615003002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1615003002/60001
4 years, 11 months ago
(2016-01-22 16:04:37 UTC)
#16
Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/105710) linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, ...
4 years, 11 months ago
(2016-01-22 17:00:53 UTC)
#18
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1615003002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1615003002/60001
4 years, 11 months ago
(2016-01-22 17:51:12 UTC)
#20
Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/105749)
4 years, 11 months ago
(2016-01-22 18:39:51 UTC)
#22
On 2016/01/22 05:03:30, tkent wrote: > Please file new bug for this bug. > > ...
4 years, 11 months ago
(2016-01-22 21:27:15 UTC)
#23
On 2016/01/22 05:03:30, tkent wrote:
> Please file new bug for this bug.
>
> The code change LGTM.
>
>
https://codereview.chromium.org/1615003002/diff/20001/third_party/WebKit/Layo...
> File third_party/WebKit/LayoutTests/fast/forms/text/input-maxlength.html
> (right):
>
>
https://codereview.chromium.org/1615003002/diff/20001/third_party/WebKit/Layo...
> third_party/WebKit/LayoutTests/fast/forms/text/input-maxlength.html:49:
> shouldBe("input.maxLength", "-1");
> Let's remove line 49 and 50 because they are tested in web-platform-tests.
Unfortunately the patch as-is has a problem when browser_tests are run. Some of
them use the maxLength constant(524288) but compare with the new returned value
(-1).
I think there are two solutions:
a) put the new code in maxlengthForBindings, only used for bindings, and keep
maxLength getter as before this CL.
b) start using -1 instead of 524288 for comparisons through use of
WebInputElement::defaultMaxLength. However that would also mean changing the
type here:
components/autofill/core/common/form_field_data.h:
size_t max_length;
I guess a is the easier/cleaner fix. Let me know, thanks.
tkent
On 2016/01/22 at 21:27:15, rob.buis wrote: > On 2016/01/22 05:03:30, tkent wrote: > > Please ...
4 years, 10 months ago
(2016-01-25 01:21:09 UTC)
#24
On 2016/01/22 at 21:27:15, rob.buis wrote:
> On 2016/01/22 05:03:30, tkent wrote:
> > Please file new bug for this bug.
> >
> > The code change LGTM.
> >
> >
https://codereview.chromium.org/1615003002/diff/20001/third_party/WebKit/Layo...
> > File third_party/WebKit/LayoutTests/fast/forms/text/input-maxlength.html
> > (right):
> >
> >
https://codereview.chromium.org/1615003002/diff/20001/third_party/WebKit/Layo...
> > third_party/WebKit/LayoutTests/fast/forms/text/input-maxlength.html:49:
> > shouldBe("input.maxLength", "-1");
> > Let's remove line 49 and 50 because they are tested in web-platform-tests.
>
> Unfortunately the patch as-is has a problem when browser_tests are run. Some
of them use the maxLength constant(524288) but compare with the new returned
value (-1).
>
> I think there are two solutions:
> a) put the new code in maxlengthForBindings, only used for bindings, and keep
maxLength getter as before this CL.
> b) start using -1 instead of 524288 for comparisons through use of
WebInputElement::defaultMaxLength. However that would also mean changing the
type here:
> components/autofill/core/common/form_field_data.h:
> size_t max_length;
>
> I guess a is the easier/cleaner fix. Let me know, thanks.
B looks the right approach. I looked the tests, and they don't need the
implicit maximum length.
rwlbuis
On 2016/01/25 01:21:09, tkent wrote: > On 2016/01/22 at 21:27:15, rob.buis wrote: > > I ...
4 years, 10 months ago
(2016-01-26 22:40:28 UTC)
#25
On 2016/01/25 01:21:09, tkent wrote:
> On 2016/01/22 at 21:27:15, rob.buis wrote:
> > I think there are two solutions:
> > a) put the new code in maxlengthForBindings, only used for bindings, and
keep
> maxLength getter as before this CL.
> > b) start using -1 instead of 524288 for comparisons through use of
> WebInputElement::defaultMaxLength. However that would also mean changing the
> type here:
> > components/autofill/core/common/form_field_data.h:
> > size_t max_length;
> >
> > I guess a is the easier/cleaner fix. Let me know, thanks.
>
> B looks the right approach. I looked the tests, and they don't need the
> implicit maximum length.
@tkent it may seem now B is getting a bit too complicated. Consider
components/autofill/content/renderer/form_autofill_util.cc:881:
881 // If the maxlength attribute contains a negative value, maxLength()
882 // returns the default maxlength value.
883 TruncateString(&value, input_element->maxLength());
The comment no longer applies. Furthermore, I am not sure how TruncateString
could keep having its current behavior, except for
duplicating the internal HTMLInputElement::maximumLength constant, or choosing
something close to that. Not truncating at all for
negative value sounds dangerous as well. Let me know if you have an idea here
(this looks like the final problem of plan B), but
otherwise plan A seems to save us from a lot of possible pitfalls, maybe even
regressions.
tkent
On 2016/01/26 at 22:40:28, rob.buis wrote: > @tkent it may seem now B is getting ...
4 years, 10 months ago
(2016-01-28 00:14:07 UTC)
#26
On 2016/01/26 at 22:40:28, rob.buis wrote:
> @tkent it may seem now B is getting a bit too complicated. Consider
components/autofill/content/renderer/form_autofill_util.cc:881:
>
> 881 // If the maxlength attribute contains a negative value,
maxLength()
> 882 // returns the default maxlength value.
> 883 TruncateString(&value, input_element->maxLength());
>
> The comment no longer applies. Furthermore, I am not sure how TruncateString
could keep having its current behavior, except for
> duplicating the internal HTMLInputElement::maximumLength constant, or choosing
something close to that. Not truncating at all for
> negative value sounds dangerous as well. Let me know if you have an idea here
(this looks like the final problem of plan B), but
> otherwise plan A seems to save us from a lot of possible pitfalls, maybe even
regressions.
I guess the intention of the code is:
if maxlength attribute is specified, truncate autofill value.
so I think we should do nothing if maxlength attribute is not specified. Also,
an autofill values are not so large and truncation by 524k doesn't make sense
practically.
The code would be:
if (input_element->maxLength() >= 0)
TruncateString(&value, input_element->maxLength());
rwlbuis
Patchset #7 (id:120001) has been deleted
4 years, 10 months ago
(2016-01-28 03:38:02 UTC)
#27
Patchset #7 (id:120001) has been deleted
rwlbuis
On 2016/01/28 00:14:07, tkent wrote: > I guess the intention of the code is: > ...
4 years, 10 months ago
(2016-02-08 19:16:44 UTC)
#28
On 2016/01/28 00:14:07, tkent wrote:
> I guess the intention of the code is:
> if maxlength attribute is specified, truncate autofill value.
> so I think we should do nothing if maxlength attribute is not specified.
Also,
> an autofill values are not so large and truncation by 524k doesn't make sense
> practically.
> The code would be:
>
> if (input_element->maxLength() >= 0)
> TruncateString(&value, input_element->maxLength());
Finally got it to show up green :) Do you think we should add reviewers for the
chromium part? If so, can you think of any?
tkent
> Do you think we should add reviewers for the chromium part? If so, can ...
4 years, 10 months ago
(2016-02-08 23:48:21 UTC)
#29
4 years, 10 months ago
(2016-02-09 16:17:05 UTC)
#30
Patchset #13 (id:260001) has been deleted
rwlbuis
On 2016/02/08 23:48:21, tkent wrote: > > Do you think we should add reviewers for ...
4 years, 10 months ago
(2016-02-11 21:58:04 UTC)
#31
On 2016/02/08 23:48:21, tkent wrote:
> > Do you think we should add reviewers for the chromium part? If so, can you
> think of any?
>
> Of course. I'm not an owner of components/autofill/.
> Please choose someone from components/autofill/OWNERS.
Thanks.
>
https://codereview.chromium.org/1615003002/diff/240001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
>
>
https://codereview.chromium.org/1615003002/diff/240001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1368: if
> (!hasAttribute(maxlengthAttr) || m_maxLength == maximumLength)
> input.maxLength for <input maxlength="524288"> returns -1. It's not right.
You are right, fixed now.
>
https://codereview.chromium.org/1615003002/diff/240001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1375: if
> (!hasAttribute(minlengthAttr))
> We should have a test for this change.
Added in Patch Set 16. Sadly Firefox does not seem to support this attribute :(
> I think we can change the initial value of m_minLength to -1.
Done, good idea.
I also made Patch Set #17, which makes the chromium side work as before and is
less intrusive. I personally like it better, anyway now we have something to
choose from. Let me know what you think?
tkent
> I also made Patch Set #17, which makes the chromium side work as before ...
4 years, 10 months ago
(2016-02-12 01:55:10 UTC)
#32
> I also made Patch Set #17, which makes the chromium side work as before and is
less intrusive. I personally like it better, anyway now we have something to
choose from. Let me know what you think?
It's acceptable. However we should add a comment that
WebInputElement::maxLength is different from 'maxLength' IDL attribute, in
WebInputElement.h.
https://codereview.chromium.org/1615003002/diff/360001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
https://codereview.chromium.org/1615003002/diff/360001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1698: if
(!parseHTMLInteger(value, minLength) || minLength < 0)
We need to reset m_minLength to -1 if we had a parse error.
rwlbuis
On 2016/02/12 01:55:10, tkent wrote: > > I also made Patch Set #17, which makes ...
4 years, 10 months ago
(2016-02-12 19:35:30 UTC)
#33
On 2016/02/12 01:55:10, tkent wrote:
> > I also made Patch Set #17, which makes the chromium side work as before and
is
> less intrusive. I personally like it better, anyway now we have something to
> choose from. Let me know what you think?
>
> It's acceptable. However we should add a comment that
> WebInputElement::maxLength is different from 'maxLength' IDL attribute, in
> WebInputElement.h.
Done.
>
https://codereview.chromium.org/1615003002/diff/360001/third_party/WebKit/Sou...
> File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
>
>
https://codereview.chromium.org/1615003002/diff/360001/third_party/WebKit/Sou...
> third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1698: if
> (!parseHTMLInteger(value, minLength) || minLength < 0)
> We need to reset m_minLength to -1 if we had a parse error.
Done.
PTAL. Sorry this has taken so many iterations!
tkent
https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Source/core/html/HTMLInputElement.cpp File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right): https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Source/core/html/HTMLInputElement.cpp#newcode1685 third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1685: maxLength = maximumLength; Similar to parseMinLengthAttribute(), we need to ...
4 years, 10 months ago
(2016-02-14 23:28:12 UTC)
#34
4 years, 10 months ago
(2016-02-15 21:15:12 UTC)
#35
PTAL.
https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1685: maxLength =
maximumLength;
On 2016/02/14 23:28:11, tkent wrote:
> Similar to parseMinLengthAttribute(), we need to reset |m_maxLength| to |-1|
if
> maxlegth content attribute value is not a number.
Done.
> I think
web-platform-tests/html/semantics/forms/the-input-element/maxlength.html
> is broken. type= attributes in the test should be maxlegnth=.
I noticed the same thing. Do you want this fixed as part of this patch? I
suppose the best thing would be if it gets fixed at the source though...
tkent
The CQ bit was checked by tkent@chromium.org
4 years, 10 months ago
(2016-02-15 22:54:06 UTC)
#36
lgtm https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Source/core/html/HTMLInputElement.cpp File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right): https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Source/core/html/HTMLInputElement.cpp#newcode1685 third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1685: maxLength = maximumLength; On 2016/02/15 at 21:15:10, rwlbuis ...
4 years, 10 months ago
(2016-02-15 22:54:07 UTC)
#37
lgtm
https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
https://codereview.chromium.org/1615003002/diff/380001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1685: maxLength =
maximumLength;
On 2016/02/15 at 21:15:10, rwlbuis wrote:
> On 2016/02/14 23:28:11, tkent wrote:
> > Similar to parseMinLengthAttribute(), we need to reset |m_maxLength| to |-1|
if
> > maxlegth content attribute value is not a number.
>
> Done.
>
> > I think
web-platform-tests/html/semantics/forms/the-input-element/maxlength.html
> > is broken. type= attributes in the test should be maxlegnth=.
>
> I noticed the same thing. Do you want this fixed as part of this patch? I
suppose the best thing would be if it gets fixed at the source though...
We can't fix the imported test in Chromium repository.
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1615003002/400001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1615003002/400001
4 years, 10 months ago
(2016-02-15 22:54:24 UTC)
#38
Issue 1615003002: Fix behavior of HTMLInputElement.maxLength/minLength getter
(Closed)
Created 4 years, 11 months ago by rwlbuis
Modified 4 years, 10 months ago
Reviewers: tkent
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 7