https://bugs.webkit.org/show_bug.cgi?id=90259
Reviewed by Hajime Morita.
Source/WebCore:
Test: fast/forms/textarea/textarea-state-restore.html
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::saveFormControlState):
We apply EOL normalization to value(), but don't apply it to
defaultValue(). Also value() can return a null string, which never
equals to any strings. To check m_isDirty is what we need..
LayoutTests:
* fast/forms/textarea/textarea-state-restore-expected.txt: Added.
* fast/forms/textarea/textarea-state-restore.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121552
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-06-29 Kent Tamura <tkent@chromium.org>
+
+ <textarea> unnecessarily saves the value in some cases
+ https://bugs.webkit.org/show_bug.cgi?id=90259
+
+ Reviewed by Hajime Morita.
+
+ * fast/forms/textarea/textarea-state-restore-expected.txt: Added.
+ * fast/forms/textarea/textarea-state-restore.html: Added.
+
2012-06-29 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com>
[EFL] Gardening after r121468
--- /dev/null
+Confirm nothing is saved and restored:
+PASS $("inserted").value is ""
+PASS $("saved1").value is ""
+PASS $("saved2").value is "aaa\nbbb"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<div id="console"></div>
+
+<input id=emptyOnFirstVisit>
+
+<script>
+jsTestIsAsync = true;
+
+function makeForms(stage) {
+ document.write('<div id=parent>');
+ document.write('<form id=form1 action="data:text/html,<script>history.back()</script>">');
+ if (stage == 2)
+ document.write('<textarea id=inserted></textarea>');
+ document.write('<textarea id=saved1></textarea>');
+ document.write('<textarea id=saved2>aaa
bbb</textarea>');
+ document.write('</form>');
+ document.write('</div>');
+}
+
+function runTest()
+{
+ var state = $('emptyOnFirstVisit');
+ if (!state.value) {
+ // First visit.
+ state.value = 'visited';
+ makeForms(1);
+
+ setTimeout(function() {
+ $('form1').submit();
+ }, 0);
+ } else {
+ // Second visit.
+ makeForms(2);
+
+ debug('Confirm nothing is saved and restored:');
+ shouldBeEqualToString('$("inserted").value', '');
+ shouldBeEqualToString('$("saved1").value', '');
+ shouldBeEqualToString('$("saved2").value', 'aaa\nbbb');
+
+ $('parent').innerHTML = '';
+ setTimeout(function() { finishJSTest(); }, 0);
+ }
+}
+
+runTest();
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+2012-06-29 Kent Tamura <tkent@chromium.org>
+
+ <textarea> unnecessarily saves the value in some cases
+ https://bugs.webkit.org/show_bug.cgi?id=90259
+
+ Reviewed by Hajime Morita.
+
+ Test: fast/forms/textarea/textarea-state-restore.html
+
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::saveFormControlState):
+ We apply EOL normalization to value(), but don't apply it to
+ defaultValue(). Also value() can return a null string, which never
+ equals to any strings. To check m_isDirty is what we need..
+
2012-06-25 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: Provide source data for all known rule types in CSSParser, except "keyframe" and "region"
FormControlState HTMLTextAreaElement::saveFormControlState() const
{
- String currentValue = value();
- if (currentValue == defaultValue())
- return FormControlState();
- return FormControlState(currentValue);
+ return m_isDirty ? FormControlState(value()) : FormControlState();
}
void HTMLTextAreaElement::restoreFormControlState(const FormControlState& state)