Reviewed by Darin.
- Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9358
REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer
(value == constrainValue(value)) when deleting all text
Test: editing/deleting/delete-all-text-in-text-field-assertion.html
Bug 9661 filed to fix the follow-up issue:
http://bugzilla.opendarwin.org/show_bug.cgi?id=9661
textContent returns "\n" for a <br> even if it is collapsed
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValueFromRenderer): Work around "\n" value
when all characters are deleted from a text field.
LayoutTests:
Reviewed by Darin.
- Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9358
REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer
(value == constrainValue(value)) when deleting all text
* editing/deleting/delete-all-text-in-text-field-assertion-expected.txt: Added.
* editing/deleting/delete-all-text-in-text-field-assertion.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15111
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-06-30 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed by Darin.
+
+ - Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9358
+ REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer
+ (value == constrainValue(value)) when deleting all text
+
+ * editing/deleting/delete-all-text-in-text-field-assertion-expected.txt: Added.
+ * editing/deleting/delete-all-text-in-text-field-assertion.html: Added.
+
2006-06-29 Sam Weinig <sam.weinig@gmail.com>
Reviewed by Hyatt.
--- /dev/null
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 1 of #text > DIV toDOMRange:range from 0 of #text > DIV to 1 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV to 0 of DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+Bug 9358: REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer (value == constrainValue(value)) when deleting all text
+http://bugzilla.opendarwin.org/show_bug.cgi?id=9358
+
+Assertion fails when all characters are deleted:
+SUCCESS if the test didn't crash and you see this message.
+
--- /dev/null
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+}
+</script>
+<script src="../editing.js"></script>
+</head>
+<body>
+<div>Bug 9358: REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer (value == constrainValue(value)) when deleting all text</div>
+<div><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9358">http://bugzilla.opendarwin.org/show_bug.cgi?id=9358</a></div>
+<div><br></div>
+<form>
+Assertion fails when all characters are deleted: <input type="text" id="t" value="X">
+</form>
+<script>
+document.getElementById("t").focus();
+document.execCommand("SelectAll");
+document.execCommand("Delete");
+</script>
+<div>SUCCESS if the test didn't crash and you see this message.</div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.notifyDone()
+}
+</script>
+<body>
+</html>
+2006-06-30 David Kilzer <ddkilzer@kilzer.net>
+
+ Reviewed by Darin.
+
+ - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9358
+ REGRESSION: Assertion failure in HTMLInputElement::setValueFromRenderer
+ (value == constrainValue(value)) when deleting all text
+
+ Test: editing/deleting/delete-all-text-in-text-field-assertion.html
+
+ Bug 9661 filed to fix the follow-up issue:
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=9661
+ textContent returns "\n" for a <br> even if it is collapsed
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::setValueFromRenderer): Work around "\n" value
+ when all characters are deleted from a text field.
+
2006-06-30 David Harrison <harrison@apple.com>
Reviewed by Tim Omernick
void HTMLInputElement::setValueFromRenderer(const String& value)
{
// Renderer and our event handler are responsible for constraining values.
- ASSERT(value == constrainValue(value));
+ ASSERT(value == constrainValue(value) || constrainValue(value).isEmpty());
+
+ // Workaround for bug where trailing \n is included in the result of textContent.
+ // The assert macro above may also be simplified to: value == constrainValue(value)
+ // http://bugzilla.opendarwin.org/show_bug.cgi?id=9661
+ if (value == "\n")
+ m_value = "";
+ else
+ m_value = value;
- m_value = value;
setValueMatchesRenderer();
// Fire the "input" DOM event.