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

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

Issue 551283002: Remove HTMLInputElement::isText and isTextType. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
« no previous file with comments | « Source/core/html/forms/BaseTextInputType.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/BaseTextInputType.cpp
diff --git a/Source/core/html/forms/BaseTextInputType.cpp b/Source/core/html/forms/BaseTextInputType.cpp
index b7029e5b00e445f037b35b29e2b5baa701225656..9ee4ab54e517401cb94de4ff6f30f0ff78f1f01a 100644
--- a/Source/core/html/forms/BaseTextInputType.cpp
+++ b/Source/core/html/forms/BaseTextInputType.cpp
@@ -32,9 +32,23 @@ namespace blink {
using namespace HTMLNames;
-bool BaseTextInputType::isTextType() const
+int BaseTextInputType::maxLength() const
{
- return true;
+ return element().maxLength();
+}
+
+bool BaseTextInputType::tooLong(const String& value, HTMLTextFormControlElement::NeedsToCheckDirtyFlag check) const
+{
+ int max = element().maxLength();
+ if (max < 0)
+ return false;
+ if (check == HTMLTextFormControlElement::CheckDirtyFlag) {
+ // Return false for the default value or a value set by a script even if
+ // it is longer than maxLength.
+ if (!element().hasDirtyValue() || !element().lastChangeWasUserEdit())
+ return false;
+ }
+ return value.length() > static_cast<unsigned>(max);
}
bool BaseTextInputType::patternMismatch(const String& value) const
« no previous file with comments | « Source/core/html/forms/BaseTextInputType.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698