Diff
Modified: trunk/LayoutTests/ChangeLog (93857 => 93858)
--- trunk/LayoutTests/ChangeLog 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/LayoutTests/ChangeLog 2011-08-26 08:59:01 UTC (rev 93858)
@@ -1,3 +1,16 @@
+2011-08-26 Shinya Kawanaka <[email protected]>
+
+ REGRESSION(r93390): Empty or invalid maxlength of an input tag should be ignored.
+ https://bugs.webkit.org/show_bug.cgi?id=67015
+
+ Reviewed by Kent Tamura.
+
+ * fast/forms/input-text-paste-maxlength-expected.txt:
+ Added maxlength="" and maxlength="invalid" tests.
+ * fast/forms/input-text-paste-maxlength.html: ditto.
+ * fast/forms/script-tests/textarea-maxlength.js: ditto.
+ * fast/forms/textarea-maxlength-expected.txt: ditto.
+
2011-08-25 Ben Wells <[email protected]>
Update expectations to remove conflict
Modified: trunk/LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt (93857 => 93858)
--- trunk/LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt 2011-08-26 08:59:01 UTC (rev 93858)
@@ -28,7 +28,13 @@
pasting too much text with maxlength=0
PASS domValueOf('l') is ''
PASS visibleValueOf('l') is ''
+empty maxlength should be ignored.
+PASS domValueOf('m') is '12' + fancyX + '45'
+PASS visibleValueOf('m') is '12' + fancyX + '45'
+invalid maxlength should be ignored.
+PASS domValueOf('n') is '12' + fancyX + '45'
+PASS visibleValueOf('n') is '12' + fancyX + '45'
PASS successfullyParsed is true
TEST COMPLETE
-
+
Modified: trunk/LayoutTests/fast/forms/input-text-paste-maxlength.html (93857 => 93858)
--- trunk/LayoutTests/fast/forms/input-text-paste-maxlength.html 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/LayoutTests/fast/forms/input-text-paste-maxlength.html 2011-08-26 08:59:01 UTC (rev 93858)
@@ -18,6 +18,8 @@
<input type="text" id="g" size="5">
<input type="text" id="k" size="5" maxlength="4">
<input type="text" id="l" size="5" maxlength="0">
+<input type="text" id="m" size="5" maxlength="">
+<input type="text" id="n" size="5" maxlength="invalid">
<script>
function domValueOf(id) {
@@ -100,6 +102,18 @@
shouldBe("domValueOf('l')", "''");
shouldBe("visibleValueOf('l')", "''");
+debug("empty maxlength should be ignored.");
+document.getElementById("m").focus();
+document.execCommand("InsertHTML", false, "12x̲̅45");
+shouldBe("domValueOf('m')", "'12' + fancyX + '45'");
+shouldBe("visibleValueOf('m')", "'12' + fancyX + '45'");
+
+debug("invalid maxlength should be ignored.");
+document.getElementById("n").focus();
+document.execCommand("InsertHTML", false, "12x̲̅45");
+shouldBe("domValueOf('n')", "'12' + fancyX + '45'");
+shouldBe("visibleValueOf('n')", "'12' + fancyX + '45'");
+
var successfullyParsed = true;
</script>
<script src=""
Modified: trunk/LayoutTests/fast/forms/script-tests/textarea-maxlength.js (93857 => 93858)
--- trunk/LayoutTests/fast/forms/script-tests/textarea-maxlength.js 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/LayoutTests/fast/forms/script-tests/textarea-maxlength.js 2011-08-26 08:59:01 UTC (rev 93858)
@@ -140,4 +140,16 @@
document.execCommand('insertText', false, 'ABC');
shouldBe('textArea.value', '""');
+// In the case maxlength=''
+createFocusedTextAreaWithMaxLength('');
+textArea.value = '';
+document.execCommand('insertText', false, 'ABC');
+shouldBe('textArea.value', '"ABC"');
+
+// In the case maxlength='invalid'
+createFocusedTextAreaWithMaxLength('invalid');
+textArea.value = '';
+document.execCommand('insertText', false, 'ABC');
+shouldBe('textArea.value', '"ABC"');
+
var successfullyParsed = true;
Modified: trunk/LayoutTests/fast/forms/textarea-maxlength-expected.txt (93857 => 93858)
--- trunk/LayoutTests/fast/forms/textarea-maxlength-expected.txt 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/LayoutTests/fast/forms/textarea-maxlength-expected.txt 2011-08-26 08:59:01 UTC (rev 93858)
@@ -30,6 +30,8 @@
PASS textArea.value.length is 4
PASS textArea.value is "ABC"
PASS textArea.value is ""
+PASS textArea.value is "ABC"
+PASS textArea.value is "ABC"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/Source/WebCore/ChangeLog (93857 => 93858)
--- trunk/Source/WebCore/ChangeLog 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/Source/WebCore/ChangeLog 2011-08-26 08:59:01 UTC (rev 93858)
@@ -1,3 +1,14 @@
+2011-08-26 Shinya Kawanaka <[email protected]>
+
+ REGRESSION(r93390): Empty or invalid maxlength of an input tag should be ignored.
+ https://bugs.webkit.org/show_bug.cgi?id=67015
+
+ Reviewed by Kent Tamura.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::parseMaxLengthAttribute):
+ Checks the validity of maxlength attribute when converting it to integer.
+
2011-08-25 Yuta Kitamura <[email protected]>
WebSocket: Fix indentation of WebSocket header files
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (93857 => 93858)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-08-26 08:52:16 UTC (rev 93857)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-08-26 08:59:01 UTC (rev 93858)
@@ -1921,7 +1921,9 @@
void HTMLInputElement::parseMaxLengthAttribute(Attribute* attribute)
{
- int maxLength = attribute->isNull() ? maximumLength : attribute->value().toInt();
+ int maxLength;
+ if (!parseHTMLInteger(attribute->value(), maxLength))
+ maxLength = maximumLength;
if (maxLength < 0 || maxLength > maximumLength)
maxLength = maximumLength;
int oldMaxLength = m_maxLength;