diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-16 14:56:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-16 14:57:30 +0200 |
commit | b297e0fa5c217c9467033b7c8b46891a52870120 (patch) | |
tree | 43fc14689295e9e64f2719d05aad94e3049f6cd7 /Source/WebCore/html/HTMLTextAreaElement.cpp | |
parent | 69d517dbfa69903d8593cc1737f0474b21e3251e (diff) | |
download | qtwebkit-b297e0fa5c217c9467033b7c8b46891a52870120.tar.gz |
Revert "Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)"
This reverts commit 5466563f4b5b6b86523e3f89bb7f77e5b5270c78.
Caused OOM issues on some CI machines :(
Diffstat (limited to 'Source/WebCore/html/HTMLTextAreaElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLTextAreaElement.cpp | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index db98ccc9f..a42aa7831 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -56,15 +56,10 @@ static const int defaultCols = 20; // On submission, LF characters are converted into CRLF. // This function returns number of characters considering this. -static inline unsigned computeLengthForSubmission(const String& text, unsigned numberOfLineBreaks) -{ - return numGraphemeClusters(text) + numberOfLineBreaks; -} - -static unsigned numberOfLineBreaks(const String& text) +static unsigned computeLengthForSubmission(const String& text) { + unsigned count = numGraphemeClusters(text); unsigned length = text.length(); - unsigned count = 0; for (unsigned i = 0; i < length; i++) { if (text[i] == '\n') count++; @@ -72,16 +67,6 @@ static unsigned numberOfLineBreaks(const String& text) return count; } -static inline unsigned computeLengthForSubmission(const String& text) -{ - return numGraphemeClusters(text) + numberOfLineBreaks(text); -} - -static inline unsigned upperBoundForLengthForSubmission(const String& text, unsigned numberOfLineBreaks) -{ - return text.length() + numberOfLineBreaks; -} - HTMLTextAreaElement::HTMLTextAreaElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) : HTMLTextFormControlElement(tagName, document, form) , m_rows(defaultRows) @@ -295,13 +280,7 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* return; unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength); - const String& currentValue = innerTextValue(); - unsigned numberOfLineBreaksInCurrentValue = numberOfLineBreaks(currentValue); - if (upperBoundForLengthForSubmission(currentValue, numberOfLineBreaksInCurrentValue) - + upperBoundForLengthForSubmission(event->text(), numberOfLineBreaks(event->text())) < unsignedMaxLength) - return; - - unsigned currentLength = computeLengthForSubmission(currentValue, numberOfLineBreaksInCurrentValue); + unsigned currentLength = computeLengthForSubmission(innerTextValue()); // selectionLength represents the selection length of this text field to be // removed by this insertion. // If the text field has no focus, we don't need to take account of the @@ -487,10 +466,7 @@ bool HTMLTextAreaElement::tooLong(const String& value, NeedsToCheckDirtyFlag che int max = maxLength(); if (max < 0) return false; - unsigned unsignedMax = static_cast<unsigned>(max); - unsigned numberOfLineBreaksInValue = numberOfLineBreaks(value); - return upperBoundForLengthForSubmission(value, numberOfLineBreaksInValue) > unsignedMax - && computeLengthForSubmission(value, numberOfLineBreaksInValue) > unsignedMax; + return computeLengthForSubmission(value) > static_cast<unsigned>(max); } bool HTMLTextAreaElement::isValidValue(const String& candidate) const |