summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTMLTextAreaElement.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/html/HTMLTextAreaElement.cpp
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/html/HTMLTextAreaElement.cpp')
-rw-r--r--WebCore/html/HTMLTextAreaElement.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp
index 633e5ec..2bfde03 100644
--- a/WebCore/html/HTMLTextAreaElement.cpp
+++ b/WebCore/html/HTMLTextAreaElement.cpp
@@ -90,7 +90,10 @@ const AtomicString& HTMLTextAreaElement::formControlType() const
bool HTMLTextAreaElement::saveFormControlState(String& result) const
{
- result = value();
+ String currentValue = value();
+ if (currentValue == defaultValue())
+ return false;
+ result = currentValue;
return true;
}
@@ -170,6 +173,8 @@ bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool)
if (name().isEmpty())
return false;
+ document()->updateLayout();
+
// FIXME: It's not acceptable to ignore the HardWrap setting when there is no renderer.
// While we have no evidence this has ever been a practical problem, it would be best to fix it some day.
RenderTextControl* control = toRenderTextControl(renderer());
@@ -239,8 +244,8 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
return;
unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength);
- unsigned currentLength = toRenderTextControl(renderer())->text().numGraphemeClusters();
- unsigned selectionLength = plainText(document()->frame()->selection()->selection().toNormalizedRange().get()).numGraphemeClusters();
+ unsigned currentLength = numGraphemeClusters(toRenderTextControl(renderer())->text());
+ unsigned selectionLength = numGraphemeClusters(plainText(document()->frame()->selection()->selection().toNormalizedRange().get()));
ASSERT(currentLength >= selectionLength);
unsigned baseLength = currentLength - selectionLength;
unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLength - baseLength : 0;
@@ -249,7 +254,7 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue, unsigned maxLength)
{
- return proposedValue.left(proposedValue.numCharactersInGraphemeClusters(maxLength));
+ return proposedValue.left(numCharactersInGraphemeClusters(proposedValue, maxLength));
}
void HTMLTextAreaElement::rendererWillBeDestroyed()
@@ -295,13 +300,11 @@ void HTMLTextAreaElement::setNonDirtyValue(const String& value)
return;
m_value = normalizedValue;
+ updatePlaceholderVisibility(false);
+ setNeedsStyleRecalc();
+ setNeedsValidityCheck();
m_isDirty = false;
setFormControlValueMatchesRenderer(true);
- updatePlaceholderVisibility(false);
- if (inDocument())
- document()->updateStyleIfNeeded();
- if (renderer())
- renderer()->updateFromElement();
// Set the caret to the end of the text value.
if (document()->focusedNode() == this) {
@@ -313,7 +316,6 @@ void HTMLTextAreaElement::setNonDirtyValue(const String& value)
setSelectionRange(endOfString, endOfString);
}
- setNeedsValidityCheck();
notifyFormStateChanged(this);
}
@@ -388,7 +390,7 @@ bool HTMLTextAreaElement::tooLong() const
int max = maxLength();
if (max < 0)
return false;
- return value().numGraphemeClusters() > static_cast<unsigned>(max);
+ return numGraphemeClusters(value()) > static_cast<unsigned>(max);
}
void HTMLTextAreaElement::accessKeyAction(bool)