diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
commit | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch) | |
tree | b7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/WebCore/html/HTMLTextAreaElement.cpp | |
parent | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff) | |
download | qtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz |
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/WebCore/html/HTMLTextAreaElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLTextAreaElement.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index 1652c8911..bc44e7b7b 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -44,6 +44,7 @@ #include "TextControlInnerElements.h" #include "TextIterator.h" #include <wtf/StdLibExtras.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { @@ -115,9 +116,10 @@ void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChan { HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); setLastChangeWasNotUserEdit(); - if (!m_isDirty) + if (m_isDirty) + setInnerTextValue(value()); + else setNonDirtyValue(defaultValue()); - setInnerTextValue(value()); } bool HTMLTextAreaElement::isPresentationAttribute(const QualifiedName& name) const @@ -372,15 +374,15 @@ void HTMLTextAreaElement::setValueCommon(const String& newValue) String HTMLTextAreaElement::defaultValue() const { - String value = ""; + StringBuilder value; // Since there may be comments, ignore nodes other than text nodes. for (Node* n = firstChild(); n; n = n->nextSibling()) { if (n->isTextNode()) - value += toText(n)->data(); + value.append(toText(n)->data()); } - return value; + return value.toString(); } void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) @@ -436,7 +438,7 @@ String HTMLTextAreaElement::validationMessage() const return validationMessageValueMissingText(); if (tooLong()) - return validationMessageTooLongText(numGraphemeClusters(value()), maxLength()); + return validationMessageTooLongText(computeLengthForSubmission(value()), maxLength()); return String(); } |