Reviewed by Darin.
Changed hidden input controls to reset to their initial values
when the form is reset. Also added layout tests for resetting
other input controls.
Fixes http://bugs.webkit.org/show_bug.cgi?id=11866
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValue):
(WebCore::HTMLInputElement::storesValueSeparateFromAttribute):
2006-12-18 Kirby White <KWhiteRight@gmail.com>
Reviewed by Darin.
Layout tests for http://bugs.webkit.org/show_bug.cgi?id=11866
* fast/dom/HTMLInputElement/input-checked-reset-expected.txt: Added.
* fast/dom/HTMLInputElement/input-checked-reset.html: Added.
* fast/dom/HTMLInputElement/input-text-reset-expected.txt: Added.
* fast/dom/HTMLInputElement/input-text-reset.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18288
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-12-18 Kirby White <KWhiteRight@gmail.com>
+
+ Reviewed by Darin.
+
+ Layout tests for http://bugs.webkit.org/show_bug.cgi?id=11866
+
+ * fast/dom/HTMLInputElement/input-checked-reset-expected.txt: Added.
+ * fast/dom/HTMLInputElement/input-checked-reset.html: Added.
+ * fast/dom/HTMLInputElement/input-text-reset-expected.txt: Added.
+ * fast/dom/HTMLInputElement/input-text-reset.html: Added.
+
2006-12-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Mitz.
--- /dev/null
+
+
+
+
+ Reset Button
+This test verifies that check-type input form controls are properly reset by both a reset input control and a reset button control.
+
+You should see four element IDs below, and the word "SUCCESS" twice after each:
+
+checkboxUnchecked : SUCCESS : SUCCESS
+checkboxChecked : SUCCESS : SUCCESS
+radioUnchecked : SUCCESS : SUCCESS
+radioChecked : SUCCESS : SUCCESS
+
--- /dev/null
+<html>
+<head>
+</head>
+<body>
+<form>
+<input id="checkboxUnchecked" type="checkbox" value="Unchecked"><br>
+<input id="checkboxChecked" type="checkbox" value="Checked" checked="checked"><br>
+<input id="radioUnchecked" name="radio1" type="radio" value="Unchecked"><br>
+<input id="radioChecked" name="radio1" type="radio" value="Checked" checked="checked"><br>
+
+<input id="inputReset" type="reset">
+<button id="buttonReset" type="reset">Reset Button</button>
+</form>
+<p>This test verifies that check-type input form controls are properly reset by
+both a reset input control and a reset button control.
+
+<p>You should see four element IDs below, and the word "SUCCESS" twice after each:</p>
+
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+var inputReset = document.getElementById("inputReset");
+var buttonReset = document.getElementById("buttonReset");
+
+function testChecked(testElement, expected, button)
+{
+ var success = false;
+ if (testElement.checked == expected)
+ {
+ testElement.checked = !expected;
+ button.click();
+ if (testElement.checked == expected)
+ success = true;
+ }
+ if (success)
+ document.writeln(": SUCCESS");
+ else
+ document.writeln(": FAILED (checked = " + testElement.checked + ")");
+}
+
+function test(elementId, expected)
+{
+ var element = document.getElementById(elementId);
+ document.writeln(elementId);
+ testChecked(element, expected, inputReset);
+ testChecked(element, expected, buttonReset);
+ document.writeln("<br>");
+}
+
+test("checkboxUnchecked", false);
+test("checkboxChecked", true);
+test("radioUnchecked", false);
+test("radioChecked", true);
+</script>
+</body>
+</html>
--- /dev/null
+
+
+
+
+
+ Reset Button
+This test verifies that text-type input form controls are properly reset by both a reset input control and a reset button control.
+(But file input element values can't be modified by JS, so this test can't be used for those.)
+
+You should see six element IDs below, and the word "SUCCESS" twice after each:
+
+textEmpty : SUCCESS : SUCCESS
+textValue : SUCCESS : SUCCESS
+passwordEmpty : SUCCESS : SUCCESS
+passwordValue : SUCCESS : SUCCESS
+hiddenEmpty : SUCCESS : SUCCESS
+hiddenValue : SUCCESS : SUCCESS
+
--- /dev/null
+<html>
+<head>
+</head>
+<body>
+<form>
+<input id="textEmpty" type="text"><br>
+<input id="textValue" type="text" value="Default Value"><br>
+<input id="passwordEmpty" type="password"><br>
+<input id="passwordValue" type="password" value="Default Value"><br>
+<input id="hiddenEmpty" type="hidden"><br>
+<input id="hiddenValue" type="hidden" value="Default Value">
+
+<input id="inputReset" type="reset">
+<button id="buttonReset" type="reset">Reset Button</button>
+</form>
+<p>This test verifies that text-type input form controls are properly reset by
+both a reset input control and a reset button control.<br>
+(But file input element values can't be modified by JS, so this test can't be
+used for those.)</p>
+
+<p>You should see six element IDs below, and the word "SUCCESS" twice after each:</p>
+
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+var inputReset = document.getElementById("inputReset");
+var buttonReset = document.getElementById("buttonReset");
+
+function testValue(testElement, expected, button)
+{
+ var success = false;
+ if (testElement.value == expected)
+ {
+ testElement.value = "Not Expected! " + expected;
+ button.click();
+ if (testElement.value == expected)
+ success = true;
+ }
+ if (success)
+ document.writeln(": SUCCESS");
+ else
+ document.writeln(": FAILED (value = " + testElement.value + ")");
+}
+
+function test(elementId, expected)
+{
+ var element = document.getElementById(elementId);
+ document.writeln(elementId);
+ testValue(element, expected, inputReset);
+ testValue(element, expected, buttonReset);
+ document.writeln("<br>");
+}
+
+test("textEmpty", "");
+test("textValue", "Default Value");
+test("passwordEmpty", "");
+test("passwordValue", "Default Value");
+test("hiddenEmpty", "");
+test("hiddenValue", "Default Value");
+</script>
+</body>
+</html>
+2006-12-18 Kirby White <KWhiteRight@gmail.com>
+
+ Reviewed by Darin.
+
+ Changed hidden input controls to reset to their initial values
+ when the form is reset. Also added layout tests for resetting
+ other input controls.
+
+ Fixes http://bugs.webkit.org/show_bug.cgi?id=11866
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setValue):
+ (WebCore::HTMLInputElement::storesValueSeparateFromAttribute):
+
2006-12-18 Alice Liu <alice.liu@apple.com>
Oops forgot a file.
m_value = constrainValue(value);
if (renderer())
renderer()->updateFromElement();
- setChanged();
+ // Changes to hidden values don't require re-rendering.
+ if (m_type != HIDDEN)
+ setChanged();
} else
setAttribute(valueAttr, constrainValue(value));
case BUTTON:
case CHECKBOX:
case FILE:
- case HIDDEN:
case IMAGE:
case RADIO:
case RANGE:
case RESET:
case SUBMIT:
return false;
+ case HIDDEN:
case ISINDEX:
case PASSWORD:
case SEARCH: