| Index: Source/core/html/forms/BaseTextInputType.cpp
|
| diff --git a/Source/core/html/forms/BaseTextInputType.cpp b/Source/core/html/forms/BaseTextInputType.cpp
|
| index 9ee4ab54e517401cb94de4ff6f30f0ff78f1f01a..cc4db0faedd9d39eb82aec18a930e027c5bc242c 100644
|
| --- a/Source/core/html/forms/BaseTextInputType.cpp
|
| +++ b/Source/core/html/forms/BaseTextInputType.cpp
|
| @@ -51,6 +51,22 @@ bool BaseTextInputType::tooLong(const String& value, HTMLTextFormControlElement:
|
| return value.length() > static_cast<unsigned>(max);
|
| }
|
|
|
| +bool BaseTextInputType::tooShort(const String& value, HTMLTextFormControlElement::NeedsToCheckDirtyFlag check) const
|
| +{
|
| + int min = element().minLength();
|
| + if (min <= 0)
|
| + return false;
|
| + if (check == HTMLTextFormControlElement::CheckDirtyFlag) {
|
| + // Return false for the default value or a value set by a script even if
|
| + // it is shorter than minLength.
|
| + if (!element().hasDirtyValue() || !element().lastChangeWasUserEdit())
|
| + return false;
|
| + }
|
| + // An empty string is excluded from minlength check.
|
| + unsigned len = value.length();
|
| + return len > 0 && len < static_cast<unsigned>(min);
|
| +}
|
| +
|
| bool BaseTextInputType::patternMismatch(const String& value) const
|
| {
|
| const AtomicString& rawPattern = element().fastGetAttribute(patternAttr);
|
|
|