diff options
Diffstat (limited to 'WebCore/html/HTMLTextAreaElement.cpp')
-rw-r--r-- | WebCore/html/HTMLTextAreaElement.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp index b528c19..3e34844 100644 --- a/WebCore/html/HTMLTextAreaElement.cpp +++ b/WebCore/html/HTMLTextAreaElement.cpp @@ -390,16 +390,21 @@ void HTMLTextAreaElement::setMaxLength(int newValue, ExceptionCode& ec) setAttribute(maxlengthAttr, String::number(newValue)); } -bool HTMLTextAreaElement::tooLong() const +bool HTMLTextAreaElement::tooLong(const String& value, NeedsToCheckDirtyFlag check) const { // Return false for the default value even if it is longer than maxLength. - if (!m_isDirty) + if (check == CheckDirtyFlag && !m_isDirty) return false; int max = maxLength(); if (max < 0) return false; - return numGraphemeClusters(value()) > static_cast<unsigned>(max); + return numGraphemeClusters(value) > static_cast<unsigned>(max); +} + +bool HTMLTextAreaElement::isValidValue(const String& candidate) const +{ + return !valueMissing(candidate) && !tooLong(candidate, IgnoreDirtyFlag); } void HTMLTextAreaElement::accessKeyAction(bool) |