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

Unified Diff: Source/core/html/forms/InputType.cpp

Issue 435753003: Implement minlength for <input> and <textarea>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests for minlength & maxlength together; fix comments Created 6 years, 2 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: Source/core/html/forms/InputType.cpp
diff --git a/Source/core/html/forms/InputType.cpp b/Source/core/html/forms/InputType.cpp
index 27d69d87471e9b92722ef3773c1e1286a022f858..1da08da15942c3c79ef7482c2af50cf136b5cd88 100644
--- a/Source/core/html/forms/InputType.cpp
+++ b/Source/core/html/forms/InputType.cpp
@@ -239,6 +239,11 @@ bool InputType::tooLong(const String&, HTMLTextFormControlElement::NeedsToCheckD
return false;
}
+bool InputType::tooShort(const String&, HTMLTextFormControlElement::NeedsToCheckDirtyFlag) const
+{
+ return false;
+}
+
bool InputType::patternMismatch(const String&) const
{
return false;
@@ -370,6 +375,9 @@ String InputType::validationMessage() const
if (element().tooLong())
return locale().validationMessageTooLongText(value.length(), element().maxLength());
+ if (element().tooShort())
+ return locale().validationMessageTooShortText(value.length(), element().minLength());
+
if (!isSteppable())
return emptyString();
@@ -650,6 +658,11 @@ int InputType::maxLength() const
return HTMLInputElement::maximumLength;
}
+int InputType::minLength() const
+{
+ return 0;
+}
+
bool InputType::supportsPlaceholder() const
{
return false;

Powered by Google App Engine
This is Rietveld 408576698