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

Unified Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 1615003002: Fix behavior of HTMLInputElement.maxLength/minLength getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Different approach Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLInputElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
index b516a88512ac7f75842d34bffa22692d14b3cb04..110496672c770ea3390a3a8e0318957aa0c6ddc8 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
@@ -103,7 +103,7 @@ HTMLInputElement::HTMLInputElement(Document& document, HTMLFormElement* form, bo
: HTMLTextFormControlElement(inputTag, document, form)
, m_size(defaultSize)
, m_maxLength(maximumLength)
- , m_minLength(0)
+ , m_minLength(-1)
, m_maxResults(-1)
, m_isChecked(false)
, m_reflectsCheckedAttribute(true)
@@ -1365,6 +1365,8 @@ const AtomicString& HTMLInputElement::alt() const
int HTMLInputElement::maxLength() const
{
+ if (!hasAttribute(maxlengthAttr))
+ return -1;
return m_maxLength;
}
@@ -1693,10 +1695,8 @@ void HTMLInputElement::parseMaxLengthAttribute(const AtomicString& value)
void HTMLInputElement::parseMinLengthAttribute(const AtomicString& value)
{
int minLength;
- if (!parseHTMLInteger(value, minLength))
- minLength = 0;
- if (minLength < 0)
- minLength = 0;
+ if (!parseHTMLInteger(value, minLength) || minLength < 0)
tkent 2016/02/12 01:55:09 We need to reset m_minLength to -1 if we had a par
+ return;
m_minLength = minLength;
setNeedsValidityCheck();
}

Powered by Google App Engine
This is Rietveld 408576698