WebCore:
2007-07-05 Alp Toker <alp.toker@collabora.co.uk>
Fix Bug 14388: Input in text fields limited to 1024 characters
http://bugs.webkit.org/show_bug.cgi?id=14388
Slightly modified by Adam Roben.
Reviewed by Adele.
Test: fast/forms/input-length.html
* html/HTMLInputElement.cpp: Bump limit to 524288.
(WebCore::HTMLInputElement::init):
(WebCore::HTMLInputElement::parseMappedAttribute):
* html/HTMLInputElement.h:
LayoutTests:
Added two tests for Bug 14388: Input in text fields limited to 1024 characters
fast/forms/input-maxlength-2.html is obsoleted by
fast/forms/input-maxlength.html.
Reviewed by Adele.
* fast/forms/input-implicit-length-limit-expected.txt: Added.
* fast/forms/input-implicit-length-limit.html: Added.
* fast/forms/input-maxlength-2-expected.checksum: Removed.
* fast/forms/input-maxlength-2-expected.png: Removed.
* fast/forms/input-maxlength-2-expected.txt: Removed.
* fast/forms/input-maxlength-2.html: Removed.
* fast/forms/input-maxlength-expected.txt: Added.
* fast/forms/input-maxlength.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24037
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
* mac/leopard/fast/encoding/idn-security-expected.txt: Copied from fast/encoding/idn-security-expected.txt.
The modified.
+2007-07-05 Adam Roben <aroben@apple.com>
+
+ Added two tests for Bug 14388: Input in text fields limited to 1024 characters
+
+ fast/forms/input-maxlength-2.html is obsoleted by
+ fast/forms/input-maxlength.html.
+
+ Reviewed by Adele.
+
+ * fast/forms/input-implicit-length-limit-expected.txt: Added.
+ * fast/forms/input-implicit-length-limit.html: Added.
+ * fast/forms/input-maxlength-2-expected.checksum: Removed.
+ * fast/forms/input-maxlength-2-expected.png: Removed.
+ * fast/forms/input-maxlength-2-expected.txt: Removed.
+ * fast/forms/input-maxlength-2.html: Removed.
+ * fast/forms/input-maxlength-expected.txt: Added.
+ * fast/forms/input-maxlength.html: Added.
+
2007-07-05 Adam Roben <aroben@apple.com>
Add another hanging test to the Leopard Skipped file
--- /dev/null
+This page tests that the length of an <input> element's string is implicitly limited to 524288 characters. http://bugs.webkit.org/show_bug.cgi?id=14388
+
+
+Attempting to insert 0 characters.
+PASS
+Attempting to insert 5 characters.
+PASS
+Attempting to insert 1025 characters.
+PASS
+Attempting to insert 524287 characters.
+PASS
+Attempting to insert 524288 characters.
+PASS
+Attempting to insert 524289 characters.
+PASS
+Attempting to insert 530000 characters.
+PASS
+
--- /dev/null
+<p>This page tests that the length of an <tt><input></tt> element's string is implicitly limited to 524288 characters. <a href="http://bugs.webkit.org/show_bug.cgi?id=14388">http://bugs.webkit.org/show_bug.cgi?id=14388</a></p>
+<input id="input">
+<pre id="log"></pre>
+<script>
+ function log(msg)
+ {
+ document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var testString = "";
+
+ function attempt(length, expected)
+ {
+ log("Attempting to insert " + length + " characters.");
+
+ if (testString.length > length)
+ testString = "";
+
+ for (var i = testString.length; i < length; ++i)
+ testString += i % 10;
+
+ var input = document.getElementById("input");
+ input.value = testString;
+
+ if (input.value.length == expected)
+ log("PASS");
+ else
+ log("FAIL: Expected " + expected + " characters to be inserted, but " + input.value.length + " characters were actually inserted.");
+ }
+
+ attempt(0, 0);
+ attempt(5, 5);
+ attempt(1025, 1025);
+ attempt(524287, 524287);
+ attempt(524288, 524288);
+ attempt(524289, 524288);
+ attempt(530000, 524288);
+</script>
+++ /dev/null
-63a7e999da3bc216eeb50e6c15abe12a
\ No newline at end of file
+++ /dev/null
-layer at (0,0) size 800x600
- RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
- RenderBlock {HTML} at (0,0) size 800x600
- RenderBody {BODY} at (8,8) size 784x584
- RenderBlock {P} at (0,0) size 784x18
- RenderText {#text} at (0,0) size 540x18
- text run at (0,0) width 540: "The string pasted into the text field should be truncated at the maxlength, 5 characters."
- RenderBlock (anonymous) at (0,34) size 784x23
- RenderTextControl {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
- RenderText {#text} at (0,0) size 0x0
-layer at (13,47) size 142x13
- RenderBlock {DIV} at (3,3) size 142x13
- RenderText {#text} at (1,0) size 35x13
- text run at (1,0) width 35: "12345"
-caret: position 5 of child 0 {#text} of child 0 {DIV} of child 2 {INPUT} of child 0 {BODY} of child 0 {HTML} of document
+++ /dev/null
-<p>The string pasted into the text field should be truncated at the maxlength, 5 characters.</p>
-<input maxlength="5" id="test" type="text">
-
-<script>
-var e = document.getElementById("test");
-e.focus();
-e.setSelectionRange(0, 0);
-document.execCommand("InsertHTML", false, "123456789");
-</script>
\ No newline at end of file
--- /dev/null
+This page tests that the maxlength attribute of the <input> element works correctly. http://bugs.webkit.org/show_bug.cgi?id=14388
+
+
+Attempting to insert 0 characters with maxLength = -1.
+PASS
+Attempting to insert 0 characters with maxLength = 100.
+PASS
+Attempting to insert 0 characters with maxLength = 524288.
+PASS
+Attempting to insert 0 characters with maxLength = 600000.
+PASS
+Attempting to insert 5 characters with maxLength = -1.
+PASS
+Attempting to insert 5 characters with maxLength = 100.
+PASS
+Attempting to insert 5 characters with maxLength = 524288.
+PASS
+Attempting to insert 5 characters with maxLength = 600000.
+PASS
+Attempting to insert 100 characters with maxLength = -1.
+PASS
+Attempting to insert 100 characters with maxLength = 100.
+PASS
+Attempting to insert 100 characters with maxLength = 524288.
+PASS
+Attempting to insert 100 characters with maxLength = 600000.
+PASS
+Attempting to insert 101 characters with maxLength = -1.
+PASS
+Attempting to insert 101 characters with maxLength = 100.
+PASS
+Attempting to insert 101 characters with maxLength = 524288.
+PASS
+Attempting to insert 101 characters with maxLength = 600000.
+PASS
+Attempting to insert 200 characters with maxLength = -1.
+PASS
+Attempting to insert 200 characters with maxLength = 100.
+PASS
+Attempting to insert 200 characters with maxLength = 524288.
+PASS
+Attempting to insert 200 characters with maxLength = 600000.
+PASS
+Attempting to insert 524287 characters with maxLength = -1.
+PASS
+Attempting to insert 524287 characters with maxLength = 100.
+PASS
+Attempting to insert 524287 characters with maxLength = 524288.
+PASS
+Attempting to insert 524287 characters with maxLength = 600000.
+PASS
+Attempting to insert 524288 characters with maxLength = -1.
+PASS
+Attempting to insert 524288 characters with maxLength = 100.
+PASS
+Attempting to insert 524288 characters with maxLength = 524288.
+PASS
+Attempting to insert 524288 characters with maxLength = 600000.
+PASS
+Attempting to insert 524289 characters with maxLength = -1.
+PASS
+Attempting to insert 524289 characters with maxLength = 100.
+PASS
+Attempting to insert 524289 characters with maxLength = 524288.
+PASS
+Attempting to insert 524289 characters with maxLength = 600000.
+PASS
+Attempting to insert 530000 characters with maxLength = -1.
+PASS
+Attempting to insert 530000 characters with maxLength = 100.
+PASS
+Attempting to insert 530000 characters with maxLength = 524288.
+PASS
+Attempting to insert 530000 characters with maxLength = 600000.
+PASS
+
--- /dev/null
+<p>This page tests that the <tt>maxlength</tt> attribute of the <tt><input></tt> element works correctly. <a href="http://bugs.webkit.org/show_bug.cgi?id=14388">http://bugs.webkit.org/show_bug.cgi?id=14388</a></p>
+<input id="input">
+<pre id="log"></pre>
+<script>
+ function log(msg)
+ {
+ document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var testString = "";
+ var input = document.getElementById("input");
+
+ function attempt(length, expected)
+ {
+ log("Attempting to insert " + length + " characters with maxLength = " + input.getAttribute("maxlength") + ".");
+
+ if (testString.length > length)
+ testString = "";
+
+ for (var i = testString.length; i < length; ++i)
+ testString += i % 10;
+
+ input.value = testString;
+
+ if (input.value.length == expected)
+ log("PASS");
+ else
+ log("FAIL: Expected " + expected + " characters to be inserted, but " + input.value.length + " characters were actually inserted.");
+ }
+
+ var implicitMaxLength = 524288;
+
+ var stringLengthsToTest = [0, 5, 100, 101, 200, 524287, 524288, 524289, 530000];
+ var maxLengthsToTest = ["-1", "100", "524288", "600000"];
+
+ for (var i = 0; i < stringLengthsToTest.length; ++i) {
+ var stringLength = stringLengthsToTest[i];
+ for (var j = 0; j < maxLengthsToTest.length; ++j) {
+ var maxLength = maxLengthsToTest[j];
+ input.setAttribute("maxlength", maxLength);
+ if (maxLength < 0 || maxLength > implicitMaxLength)
+ maxLength = implicitMaxLength;
+ var expected = Math.min(stringLength, maxLength);
+ attempt(stringLength, expected);
+ }
+ }
+</script>
+2007-07-05 Alp Toker <alp.toker@collabora.co.uk>
+
+ Fix Bug 14388: Input in text fields limited to 1024 characters
+ http://bugs.webkit.org/show_bug.cgi?id=14388
+
+ Slightly modified by Adam Roben.
+
+ Reviewed by Adele.
+
+ Tests: fast/forms/input-implicit-length-limit.html
+ fast/forms/input-maxlength.html
+
+ * html/HTMLInputElement.cpp: Bump limit to 524288.
+ (WebCore::HTMLInputElement::init):
+ (WebCore::HTMLInputElement::parseMappedAttribute):
+ * html/HTMLInputElement.h:
+
2007-07-05 Anders Carlsson <andersca@apple.com>
Build fix.
const int maxSavedResults = 256;
+// FIXME: According to HTML4, the length attribute's value can be arbitrarily
+// large. However, due to http://bugs.webkit.org/show_bugs.cgi?id=14536 things
+// get rather sluggish when a text field has a larger number of characters than
+// this, even when just clicking in the text field.
+static const int cMaxLen = 524288;
+
static int numGraphemeClusters(const StringImpl* s)
{
if (!s)
{
m_imageLoader = 0;
m_type = TEXT;
- m_maxLen = 1024;
+ m_maxLen = cMaxLen;
m_size = 20;
m_checked = false;
m_defaultChecked = false;
}
} else if (attr->name() == maxlengthAttr) {
int oldMaxLen = m_maxLen;
- m_maxLen = !attr->isNull() ? attr->value().toInt() : 1024;
- if (m_maxLen <= 0 || m_maxLen > 1024)
- m_maxLen = 1024;
+ m_maxLen = !attr->isNull() ? attr->value().toInt() : cMaxLen;
+ if (m_maxLen <= 0 || m_maxLen > cMaxLen)
+ m_maxLen = cMaxLen;
if (oldMaxLen != m_maxLen)
recheckValue();
setChanged();
String m_value;
String m_originalValue;
int xPos;
- short m_maxLen;
+ int m_maxLen;
short m_size;
short yPos;