Changeset 93390 in webkit
- Timestamp:
- Aug 19, 2011 1:46:47 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r93389 r93390 1 2011-08-19 Shinya Kawanaka <shinyak@google.com> 2 3 input[maxlength=0] should ignore text input. 4 https://bugs.webkit.org/show_bug.cgi?id=65497 5 6 Reviewed by Kent Tamura. 7 8 * fast/forms/input-text-paste-maxlength-expected.txt: 9 Added a case that maxlength=0 10 * fast/forms/input-text-paste-maxlength.html: ditto. 11 * fast/forms/script-tests/textarea-maxlength.js: ditto. 12 (createFocusedTextAreaWithMaxLength): 13 * fast/forms/textarea-maxlength-expected.txt: ditto. 14 1 15 2011-08-19 Ilya Tikhonovsky <loislo@chromium.org> 2 16 -
trunk/LayoutTests/fast/forms/input-text-paste-maxlength-expected.txt
r48449 r93390 26 26 PASS domValueOf('k') is '12' + fancyX + '4' 27 27 PASS visibleValueOf('k') is '12' + fancyX + '4' 28 pasting too much text with maxlength=0 29 PASS domValueOf('l') is '' 30 PASS visibleValueOf('l') is '' 28 31 PASS successfullyParsed is true 29 32 30 33 TEST COMPLETE 31 34 -
trunk/LayoutTests/fast/forms/input-text-paste-maxlength.html
r48449 r93390 18 18 <input type="text" id="g" size="5"> 19 19 <input type="text" id="k" size="5" maxlength="4"> 20 <input type="text" id="l" size="5" maxlength="0"> 20 21 21 22 <script> … … 94 95 shouldBe("visibleValueOf('k')", "'12' + fancyX + '4'"); 95 96 97 debug("pasting too much text with maxlength=0"); 98 document.getElementById("l").focus(); 99 document.execCommand("InsertHTML", false, "12x̲̅45"); 100 shouldBe("domValueOf('l')", "''"); 101 shouldBe("visibleValueOf('l')", "''"); 102 96 103 var successfullyParsed = true; 97 104 </script> -
trunk/LayoutTests/fast/forms/script-tests/textarea-maxlength.js
r81328 r93390 43 43 44 44 // Set up for user-input tests 45 function createFocusedTextAreaWithMaxLength 3() {45 function createFocusedTextAreaWithMaxLength(maxLength) { 46 46 if (textArea) 47 47 document.body.removeChild(textArea); 48 48 textArea = document.createElement('textarea'); 49 textArea.setAttribute('maxlength', '3');49 textArea.setAttribute('maxlength', maxLength); 50 50 document.body.appendChild(textArea); 51 51 textArea.focus(); … … 53 53 54 54 // Insert text of which length is maxLength. 55 createFocusedTextAreaWithMaxLength 3();55 createFocusedTextAreaWithMaxLength(3); 56 56 document.execCommand('insertText', false, 'abc'); 57 57 shouldBe('textArea.value', '"abc"'); 58 58 59 59 // Try to add characters to maxLength characters. 60 createFocusedTextAreaWithMaxLength 3();60 createFocusedTextAreaWithMaxLength(3); 61 61 textArea.value = 'abc'; 62 62 document.execCommand('insertText', false, 'def'); … … 64 64 65 65 // Replace text 66 createFocusedTextAreaWithMaxLength 3();66 createFocusedTextAreaWithMaxLength(3); 67 67 textArea.value = 'abc'; 68 68 document.execCommand('selectAll'); … … 71 71 72 72 // Existing value is longer than maxLength. We can't add text. 73 createFocusedTextAreaWithMaxLength 3();73 createFocusedTextAreaWithMaxLength(3); 74 74 textArea.value = 'abcdef'; 75 75 document.execCommand('insertText', false, 'ghi'); … … 77 77 78 78 // We can delete a character in the longer value. 79 createFocusedTextAreaWithMaxLength 3();79 createFocusedTextAreaWithMaxLength(3); 80 80 textArea.value = 'abcdef'; 81 81 document.execCommand('delete'); … … 83 83 84 84 // A linebreak is 1 character. 85 createFocusedTextAreaWithMaxLength 3();85 createFocusedTextAreaWithMaxLength(3); 86 86 document.execCommand('insertText', false, 'A'); 87 87 document.execCommand('insertLineBreak'); … … 90 90 91 91 // Confirms correct count for close linebreaks inputs. 92 createFocusedTextAreaWithMaxLength 3();92 createFocusedTextAreaWithMaxLength(3); 93 93 textArea.innerHTML = 'a\n\n'; 94 94 document.execCommand('insertLineBreak'); … … 96 96 97 97 // Confirms correct count for open consecutive linebreaks inputs. 98 createFocusedTextAreaWithMaxLength 3();98 createFocusedTextAreaWithMaxLength(3); 99 99 document.execCommand('insertLineBreak'); 100 100 document.execCommand('insertLineBreak'); … … 112 112 113 113 // Inserts 5 code-points in UTF-16 114 createFocusedTextAreaWithMaxLength 3();114 createFocusedTextAreaWithMaxLength(3); 115 115 document.execCommand('insertText', false, 'AB' + fancyX); 116 116 shouldBe('textArea.value', '"AB" + fancyX'); 117 117 shouldBe('textArea.value.length', '5'); 118 118 119 createFocusedTextAreaWithMaxLength 3();119 createFocusedTextAreaWithMaxLength(3); 120 120 textArea.value = 'AB' + fancyX; 121 121 textArea.setSelectionRange(2, 5); // Select fancyX … … 124 124 125 125 // Inserts 4 code-points in UTF-16 126 createFocusedTextAreaWithMaxLength 3();126 createFocusedTextAreaWithMaxLength(3); 127 127 document.execCommand('insertText', false, 'AB' + u10000); 128 128 shouldBe('textArea.value', '"AB" + u10000'); 129 129 shouldBe('textArea.value.length', '4'); 130 130 131 createFocusedTextAreaWithMaxLength 3();131 createFocusedTextAreaWithMaxLength(3); 132 132 textArea.value = 'AB' + u10000; 133 133 textArea.setSelectionRange(2, 4); // Select u10000 … … 135 135 shouldBe('textArea.value', '"ABC"'); 136 136 137 // In the case maxlength=0 138 createFocusedTextAreaWithMaxLength(0); 139 textArea.value = ''; 140 document.execCommand('insertText', false, 'ABC'); 141 shouldBe('textArea.value', '""'); 142 137 143 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/textarea-maxlength-expected.txt
r81328 r93390 30 30 PASS textArea.value.length is 4 31 31 PASS textArea.value is "ABC" 32 PASS textArea.value is "" 32 33 PASS successfullyParsed is true 33 34 -
trunk/Source/WebCore/ChangeLog
r93389 r93390 1 2011-08-19 Shinya Kawanaka <shinyak@google.com> 2 3 input[maxlength=0] should ignore text input. 4 https://bugs.webkit.org/show_bug.cgi?id=65497 5 6 Reviewed by Kent Tamura. 7 8 Changed the valid range of maxlength. 9 10 * html/HTMLInputElement.cpp: 11 (WebCore::HTMLInputElement::parseMaxLengthAttribute): 12 Changed maxlength check condition. 13 1 14 2011-08-19 Ilya Tikhonovsky <loislo@chromium.org> 2 15 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r92592 r93390 1923 1923 { 1924 1924 int maxLength = attribute->isNull() ? maximumLength : attribute->value().toInt(); 1925 if (maxLength < =0 || maxLength > maximumLength)1925 if (maxLength < 0 || maxLength > maximumLength) 1926 1926 maxLength = maximumLength; 1927 1927 int oldMaxLength = m_maxLength;
Note: See TracChangeset
for help on using the changeset viewer.