summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLTextAreaElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/HTMLTextAreaElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLTextAreaElement.cpp14
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();
}