Changeset 73999 in webkit
- Timestamp:
- Dec 13, 2010 9:19:30 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r73998 r73999 1 2010-12-13 Dai Mikurube <dmikurube@google.com> 2 3 Reviewed by Kent Tamura. 4 5 ValidityState's exposed functions should check if willValidate() is true before all 6 https://bugs.webkit.org/show_bug.cgi?id=50617 7 8 * fast/css/pseudo-required-optional-005-expected.txt: 9 * fast/css/pseudo-required-optional-005.html: 10 * fast/css/pseudo-valid-001-expected.txt: 11 * fast/css/pseudo-valid-001.html: 12 * fast/css/pseudo-valid-unapplied-expected.txt: 13 * fast/css/pseudo-valid-unapplied.html: 14 * fast/forms/ValidityState-customError.html: 15 * fast/forms/ValidityState-customError-expected.txt: 16 * fast/forms/ValidityState-customError.html: 17 * fast/forms/ValidityState-patternMismatch-expected.txt: 18 * fast/forms/ValidityState-patternMismatch.html: 19 * fast/forms/ValidityState-rangeOverflow-expected.txt: 20 * fast/forms/ValidityState-rangeUnderflow-expected.txt: 21 * fast/forms/ValidityState-stepMismatch-expected.txt: 22 * fast/forms/ValidityState-tooLong-input-expected.txt: 23 * fast/forms/ValidityState-tooLong-textarea-expected.txt: 24 * fast/forms/ValidityState-typeMismatch-color-expected.txt: 25 * fast/forms/ValidityState-typeMismatch-date-expected.txt: 26 * fast/forms/ValidityState-typeMismatch-datetime-expected.txt: 27 * fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt: 28 * fast/forms/ValidityState-typeMismatch-month-expected.txt: 29 * fast/forms/ValidityState-typeMismatch-number-expected.txt: 30 * fast/forms/ValidityState-typeMismatch-time-expected.txt: 31 * fast/forms/ValidityState-typeMismatch-url-expected.txt: 32 * fast/forms/ValidityState-typeMismatch-week-expected.txt: 33 * fast/forms/script-tests/ValidityState-rangeOverflow.js: 34 (checkOverflow): 35 (checkNotOverflow): 36 * fast/forms/script-tests/ValidityState-rangeUnderflow.js: 37 (checkUnderflow): 38 (checkNotUnderflow): 39 * fast/forms/script-tests/ValidityState-stepMismatch.js: 40 (stepMismatchFor): 41 * fast/forms/script-tests/ValidityState-tooLong-input.js: 42 * fast/forms/script-tests/ValidityState-tooLong-textarea.js: 43 * fast/forms/script-tests/ValidityState-typeMismatch-color.js: 44 (): 45 * fast/forms/script-tests/ValidityState-typeMismatch-date.js: 46 (): 47 (shouldBeValid): 48 (shouldBeInvalid): 49 * fast/forms/script-tests/ValidityState-typeMismatch-datetime.js: 50 (): 51 (shouldBeValid): 52 (shouldBeInvalid): 53 * fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js: 54 (): 55 (shouldBeValid): 56 (shouldBeInvalid): 57 * fast/forms/script-tests/ValidityState-typeMismatch-month.js: 58 (): 59 (shouldBeValid): 60 (shouldBeInvalid): 61 * fast/forms/script-tests/ValidityState-typeMismatch-number.js: 62 (): 63 * fast/forms/script-tests/ValidityState-typeMismatch-time.js: 64 (): 65 (shouldBeValid): 66 (shouldBeInvalid): 67 * fast/forms/script-tests/ValidityState-typeMismatch-url.js: 68 (check): 69 (expectValid): 70 (expectInvalid): 71 * fast/forms/script-tests/ValidityState-typeMismatch-week.js: 72 (): 73 (shouldBeValid): 74 (shouldBeInvalid): 75 * fast/forms/script-tests/willvalidate.js: 76 * fast/forms/willvalidate-expected.txt: 77 1 78 2010-12-13 Brian Weinstein <bweinstein@apple.com> 2 79 -
trunk/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt
r46062 r73999 1 All controls should have a green background.1 This test checks the CSS pseudoclasses for input types. 2 2 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 6 PASS isOptional("range") is true 7 PASS isOptional("submit") is true 8 PASS isOptional("image") is true 9 PASS isOptional("reset") is true 10 PASS isOptional("button") is true 11 PASS successfullyParsed is true 12 13 TEST COMPLETE 3 14 4 SUCCESS5 SUCCESS6 SUCCESS7 SUCCESS8 SUCCESS -
trunk/LayoutTests/fast/css/pseudo-required-optional-005.html
r46062 r73999 2 2 <head> 3 3 <title>required/optional CSS pseudoclasses part 5</title> 4 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> 5 <script src="../../fast/js/resources/js-test-pre.js"></script> 4 6 <style> 5 7 input:optional { background: lime; } … … 7 9 input:required { background: red; } 8 10 </style> 11 </head> 12 <body> 13 <p id="description"></p> 14 <div id="console"></div> 15 <input id="range" type="range" required/> 16 <input id="submit" type="submit" required/> 17 <input id="image" type="image" required/> 18 <input id="reset" type="reset" required/> 19 <input id="button" type="button" required/> 9 20 <script language="JavaScript" type="text/javascript"> 10 function log(message) { 11 document.getElementById("console").innerHTML += "<li>"+message+"</li>"; 12 } 13 14 function test() { 15 if (window.layoutTestController) 16 layoutTestController.dumpAsText(); 17 18 v = document.getElementsByName("victim"); 19 20 for (i = 0; i < v.length; i++) 21 if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == "rgb(0, 255, 0)") 22 log("SUCCESS"); 23 else 24 log("FAILURE"); 25 } 21 function isOptional(id) { 22 return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('background-color') == "rgb(0, 255, 0)" 23 } 24 description('This test checks the CSS pseudoclasses for input types.'); 25 shouldBeTrue('isOptional("range")'); 26 shouldBeTrue('isOptional("submit")'); 27 shouldBeTrue('isOptional("image")'); 28 shouldBeTrue('isOptional("reset")'); 29 shouldBeTrue('isOptional("button")'); 30 var successfullyParsed = true; 26 31 </script> 27 </head> 28 <body onload="test()"> 29 <p>All controls should have a green background.</p> 30 <input type="range" name="victim" required/> 31 <input type="submit" name="victim" required/> 32 <input type="image" name="victim" required/> 33 <input type="reset" name="victim" required/> 34 <input type="button" name="victim" required/> 35 <hr> 36 <ol id="console"></ol> 32 <script src="../../fast/js/resources/js-test-post.js"></script> 37 33 </body> 38 34 </html> -
trunk/LayoutTests/fast/css/pseudo-valid-001-expected.txt
r47444 r73999 1 This test performs a check for the :valid CSS selector on various input elements.1 This test performs a check for the :valid CSS selector on various input and button elements. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 6 7 PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)' 8 PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)' 7 9 PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)' 8 10 PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)' -
trunk/LayoutTests/fast/css/pseudo-valid-001.html
r47444 r73999 16 16 <input name="victim" type="text" value="Lorem ipsum" required/> 17 17 <input name="victim" type="text" value="Lorem ipsum" pattern="Lorem ipsum"/> 18 <input name="victim" type="submit"> 19 <button name="victim"></button> 18 20 </form> 19 21 <div id="console"></div> 20 22 <script> 21 description("This test performs a check for the :valid CSS selector on various input elements.");23 description("This test performs a check for the :valid CSS selector on various input and button elements."); 22 24 23 25 v = document.getElementsByName("victim"); -
trunk/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt
r59645 r73999 9 9 PASS getBackgroundColor('input-reset') is normalColor 10 10 PASS getBackgroundColor('input-hidden') is normalColor 11 PASS getBackgroundColor('input-submit') is normalColor12 11 PASS getBackgroundColor('input-image') is normalColor 13 12 PASS getBackgroundColor('fieldset') is normalColor 14 13 PASS getBackgroundColor('object') is normalColor 15 PASS getBackgroundColor('button') is normalColor 14 PASS getBackgroundColor('button-button') is normalColor 15 PASS getBackgroundColor('button-reset') is normalColor 16 16 PASS getBackgroundColor('progress') is normalColor 17 17 PASS getBackgroundColor('meter') is normalColor -
trunk/LayoutTests/fast/css/pseudo-valid-unapplied.html
r59645 r73999 23 23 <input name="input-reset" type="reset" value="Lorem ipsum"/> 24 24 <input name="input-hidden" type="hidden" value="Lorem ipsum"/> 25 <input name="input-submit" type="submit">26 25 <input name="input-image" type="image"> 27 26 <fieldset name="fieldset"></fieldset> 28 27 <object name="object"></object> 29 <button name="button">Lorem ipsum</button> 28 <button name="button-button" type="button">Lorem ipsum</button> 29 <button name="button-reset" type="reset">Lorem ipsum</button> 30 30 <progress id="progress" value=50 max=100>50</progress> 31 31 <meter id="meter" value=50 max=100>50</meter> … … 47 47 "input-reset", 48 48 "input-hidden", 49 "input-submit",50 49 "input-image", 51 50 "fieldset", 52 51 "object", 53 "button", 52 "button-button", 53 "button-reset", 54 54 "progress", 55 55 "meter", -
trunk/LayoutTests/fast/forms/ValidityState-customError-expected.txt
r73715 r73999 5 5 6 6 Set some value for customError. 7 PASS customErrorFor("fieldset-set") is true7 PASS customErrorFor("fieldset-set") is false 8 8 PASS customErrorFor("button-set") is true 9 PASS customErrorFor("button-button-set") is true10 PASS customErrorFor("button-reset-set") is true9 PASS customErrorFor("button-button-set") is false 10 PASS customErrorFor("button-reset-set") is false 11 11 PASS customErrorFor("select-set") is true 12 12 PASS customErrorFor("textarea-set") is true … … 45 45 PASS customErrorFor("input-submit-many-changes") is false 46 46 Set with three arguments. 47 PASS customErrorFor("fieldset-many-changes") is true47 PASS customErrorFor("fieldset-many-changes") is false 48 48 PASS customErrorFor("button-many-changes") is true 49 PASS customErrorFor("button-button-many-changes") is true50 PASS customErrorFor("button-reset-many-changes") is true49 PASS customErrorFor("button-button-many-changes") is false 50 PASS customErrorFor("button-reset-many-changes") is false 51 51 PASS customErrorFor("select-many-changes") is true 52 52 PASS customErrorFor("textarea-many-changes") is true -
trunk/LayoutTests/fast/forms/ValidityState-customError.html
r73715 r73999 56 56 for (i = 0; i < v.length; i++) 57 57 v[i].setCustomValidity("Custom validation message"); 58 shouldBe True('customErrorFor("fieldset-set")');58 shouldBeFalse('customErrorFor("fieldset-set")'); 59 59 shouldBeTrue('customErrorFor("button-set")'); 60 shouldBe True('customErrorFor("button-button-set")');61 shouldBe True('customErrorFor("button-reset-set")');60 shouldBeFalse('customErrorFor("button-button-set")'); 61 shouldBeFalse('customErrorFor("button-reset-set")'); 62 62 shouldBeTrue('customErrorFor("select-set")'); 63 63 shouldBeTrue('customErrorFor("textarea-set")'); … … 112 112 for (i = 0; i < v.length; i++) 113 113 v[i].setCustomValidity("one", "two", "three"); 114 shouldBe True('customErrorFor("fieldset-many-changes")');114 shouldBeFalse('customErrorFor("fieldset-many-changes")'); 115 115 shouldBeTrue('customErrorFor("button-many-changes")'); 116 shouldBe True('customErrorFor("button-button-many-changes")');117 shouldBe True('customErrorFor("button-reset-many-changes")');116 shouldBeFalse('customErrorFor("button-button-many-changes")'); 117 shouldBeFalse('customErrorFor("button-reset-many-changes")'); 118 118 shouldBeTrue('customErrorFor("select-many-changes")'); 119 119 shouldBeTrue('customErrorFor("textarea-many-changes")'); -
trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt
r73720 r73999 51 51 PASS patternMismatchFor("mismatch-20") is true 52 52 PASS patternMismatchFor("empty-pattern") is false 53 PASS patternMismatchFor("disabled") is true53 PASS patternMismatchFor("disabled") is false 54 54 PASS successfullyParsed is true 55 55 -
trunk/LayoutTests/fast/forms/ValidityState-patternMismatch.html
r73720 r73999 115 115 shouldBeFalse('patternMismatchFor("empty-pattern")'); 116 116 117 shouldBe True('patternMismatchFor("disabled")');117 shouldBeFalse('patternMismatchFor("disabled")'); 118 118 119 119 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt
r67164 r73999 19 19 PASS The value "9999-01-01" overflows the maximum value "2010-12-31". 20 20 PASS The value "2010-01-27" overflows the maximum value "2010-01-26". 21 PASS The value "9999-01-01" doesn't overflow the maximum value "2010-12-31" when disabled. 21 22 22 23 Type=datetime … … 32 33 PASS The value "9999-01-01T23:59Z" overflows the maximum value "2010-12-31T00:00Z". 33 34 PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:34Z". 35 PASS The value "9999-01-01T23:59Z" doesn't overflow the maximum value "2010-12-31T00:00Z" when disabled. 34 36 35 37 Type=datetime-local … … 45 47 PASS The value "9999-01-01T23:59" overflows the maximum value "2010-12-31T00:00". 46 48 PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:34". 49 PASS The value "9999-01-01T23:59" doesn't overflow the maximum value "2010-12-31T00:00" when disabled. 47 50 48 51 Type=month … … 58 61 PASS The value "9999-01" overflows the maximum value "2010-12". 59 62 PASS The value "2010-01" overflows the maximum value "2009-12". 63 PASS The value "9999-01" doesn't overflow the maximum value "2010-12" when disabled. 60 64 61 65 Type=number … … 73 77 PASS The value "101" overflows the maximum value "1E+2". 74 78 PASS The value "101" overflows the maximum value "100". 79 PASS The value "101" doesn't overflow the maximum value "1E+2" when disabled. 75 80 76 81 Type=time … … 85 90 PASS The value "23:59:59.999" overflows the maximum value "13:16". 86 91 PASS The value "13:16" overflows the maximum value "12:00". 92 PASS The value "23:59:59.999" doesn't overflow the maximum value "13:16" when disabled. 87 93 88 94 Type=week … … 99 105 PASS The value "9999-W01" overflows the maximum value "2010-W12". 100 106 PASS The value "2010-W01" overflows the maximum value "2009-W50". 107 PASS The value "9999-W01" doesn't overflow the maximum value "2010-W12" when disabled. 101 108 PASS successfullyParsed is true 102 109 -
trunk/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt
r67164 r73999 19 19 PASS The value "9999-01-01" undeflows the minimum value "10000-12-31". 20 20 PASS The value "2010-01-27" undeflows the minimum value "2010-02-01". 21 PASS The value "9999-01-01" doesn't underflow the minimum value "10000-12-31" when disabled. 21 22 22 23 Type=datetime … … 32 33 PASS The value "9999-01-01T12:00Z" undeflows the minimum value "10000-12-31T12:00Z". 33 34 PASS The value "2010-01-27T12:00Z" undeflows the minimum value "2010-02-01T12:00Z". 35 PASS The value "9999-01-01T12:00Z" doesn't underflow the minimum value "10000-12-31T12:00Z" when disabled. 34 36 35 37 Type=datetime-local … … 45 47 PASS The value "9999-01-01T12:00" undeflows the minimum value "10000-12-31T12:00". 46 48 PASS The value "2010-01-27T12:00" undeflows the minimum value "2010-02-01T12:00". 49 PASS The value "9999-01-01T12:00" doesn't underflow the minimum value "10000-12-31T12:00" when disabled. 47 50 48 51 Type=month … … 58 61 PASS The value "9999-01" undeflows the minimum value "10000-12". 59 62 PASS The value "2010-01" undeflows the minimum value "2010-02". 63 PASS The value "9999-01" doesn't underflow the minimum value "10000-12" when disabled. 60 64 61 65 Type=number … … 73 77 PASS The value "99" undeflows the minimum value "1E+2". 74 78 PASS The value "101" undeflows the minimum value "200". 79 PASS The value "99" doesn't underflow the minimum value "1E+2" when disabled. 75 80 76 81 Type=time … … 86 91 PASS The value "23:59" undeflows the minimum value "23:59:30". 87 92 PASS The value "13:16" undeflows the minimum value "14:00". 93 PASS The value "23:59" doesn't underflow the minimum value "23:59:30" when disabled. 88 94 89 95 Type=week … … 99 105 PASS The value "9999-W01" undeflows the minimum value "10000-W12". 100 106 PASS The value "2010-W01" undeflows the minimum value "2010-W02". 107 PASS The value "9999-W01" doesn't underflow the minimum value "10000-W12" when disabled. 101 108 PASS successfullyParsed is true 102 109 -
trunk/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
r70615 r73999 30 30 Special step value 31 31 PASS stepMismatchFor("2010-02-10", "any", "2010-02-09") is false 32 Disabled 33 PASS stepMismatchFor("2010-02-10", "2", "2010-02-09", true) is false 32 34 33 35 Datetime type … … 60 62 Special step value 61 63 PASS stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z") is false 64 Disabled 65 PASS stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true) is false 62 66 63 67 Datetime-local type … … 90 94 Special step value 91 95 PASS stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34") is false 96 Disabled 97 PASS stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true) is false 92 98 93 99 Month type … … 117 123 Special step value 118 124 PASS stepMismatchFor("2010-03", "any", "2010-02") is false 125 Disabled 126 PASS stepMismatchFor("2010-03", "2", "2010-02", true) is false 119 127 120 128 Number type … … 145 153 Rounding 146 154 PASS stepMismatchFor("5.005", "0.005", "4") is false 155 Disabled 156 PASS stepMismatchFor("1", "2", "0", true) is false 147 157 148 158 Range type … … 171 181 PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false 172 182 PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false 183 Disabled 184 PASS stepMismatchFor("1", "2", "0", true) is false 173 185 174 186 Time type … … 199 211 Special step value 200 212 PASS stepMismatchFor("12:35", "any", "12:34") is false 213 Disabled 214 PASS stepMismatchFor("12:34:55.001", "1", "12:34:56", true) is false 201 215 202 216 Week type … … 228 242 Special step value 229 243 PASS stepMismatchFor("2010-W03", "any", "2010-W02") is false 244 Disabled 245 PASS stepMismatchFor("2010-W03", "2", "2010-W02", true) is false 230 246 231 247 Unsupported types -
trunk/LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt
r54695 r73999 21 21 PASS input.validity.tooLong is true 22 22 23 Disabled 24 PASS input.validity.tooLong is false 25 23 26 Grapheme length is not greater than maxLength though character length is greater 24 27 PASS input.validity.tooLong is false -
trunk/LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt
r54695 r73999 21 21 PASS textarea.validity.tooLong is true 22 22 23 Disabled 24 PASS textarea.validity.tooLong is false 25 23 26 Grapheme length is not greater than maxLength though character length is greater 24 27 PASS textarea.validity.tooLong is false -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-color-expected.txt
r73139 r73999 28 28 PASS "xxx-non-existent-color-name" is a correct invalid color. 29 29 PASS "transparent" is a correct invalid color. 30 PASS "invalid" is a correct valid color when disabled. 30 31 PASS successfullyParsed is true 31 32 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt
r66355 r73999 57 57 PASS "2009-09" is a correct invalid date string. 58 58 PASS "2009" is a correct invalid date string. 59 PASS "2009-09" is a correct valid date string when disabled. 59 60 PASS successfullyParsed is true 60 61 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-datetime-expected.txt
r66355 r73999 35 35 PASS "2147483647-12-31T23:59-00:01" is a correct invalid datetime string. 36 36 PASS "2147483648-01-01T00:00:00Z" is a correct invalid datetime string. 37 PASS "invalid" is a correct valid datetime string when disabled. 37 38 PASS successfullyParsed is true 38 39 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt
r66355 r73999 21 21 PASS "0000-12-31T23:59:59.999" is a correct invalid datetime-local string. 22 22 PASS "275760-09-13T00:00:00.001" is a correct invalid datetime-local string. 23 PASS "invalid" is a correct valid datetime-local string when disabled. 23 24 PASS successfullyParsed is true 24 25 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-month-expected.txt
r66355 r73999 36 36 PASS "2009-xx" is a correct invalid month string. 37 37 PASS "2009" is a correct invalid month string. 38 PASS "invalid" is a correct valid month string when disabled. 38 39 PASS successfullyParsed is true 39 40 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-number-expected.txt
r67164 r73999 32 32 PASS "1." is a valid number. 33 33 PASS "1.2e10" is a valid number. 34 PASS "invalid" is a valid number when disabled. 34 35 PASS successfullyParsed is true 35 36 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt
r51163 r73999 34 34 PASS "23:45:06.abc" is a correct invalid time string. 35 35 PASS "23:45:06.789abc" is a correct invalid time string. 36 PASS "invalid" is a correct valid time string when disabled. 36 37 PASS successfullyParsed is true 37 38 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-url-expected.txt
r51799 r73999 43 43 PASS http://host+ is a correct invalid url. 44 44 PASS http://myurl! is a correct invalid url. 45 PASS invalid is a correct valid url when disabled. 45 46 PASS successfullyParsed is true 46 47 -
trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-week-expected.txt
r66355 r73999 32 32 PASS "2009-Wxx" is a correct invalid week string. 33 33 PASS "2009" is a correct invalid week string. 34 PASS "invalid" is a correct valid week string when disabled. 34 35 PASS successfullyParsed is true 35 36 -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js
r66355 r73999 3 3 var input = document.createElement('input'); 4 4 5 function checkOverflow(value, max )5 function checkOverflow(value, max, disabled) 6 6 { 7 7 input.value = value; 8 8 input.max = max; 9 input.disabled = !!disabled; 9 10 var overflow = input.validity.rangeOverflow; 10 11 var resultText = 'The value "' + input.value + '" ' + 11 12 (overflow ? 'overflows' : 'doesn\'t overflow') + 12 ' the maximum value "' + input.max + '" .';13 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); 13 14 if (overflow) 14 15 testPassed(resultText); … … 17 18 } 18 19 19 function checkNotOverflow(value, max )20 function checkNotOverflow(value, max, disabled) 20 21 { 21 22 input.value = value; 22 23 input.max = max; 24 input.disabled = !!disabled; 23 25 var overflow = input.validity.rangeOverflow; 24 26 var resultText = 'The value "' + input.value + '" ' + 25 27 (overflow ? 'overflows' : 'doesn\'t overflow') + 26 ' the maximum value "' + input.max + '" .';28 ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.'); 27 29 if (overflow) 28 30 testFailed(resultText); … … 57 59 checkOverflow('2010-01-27', '2010-01-26'); 58 60 61 // Disabled 62 checkNotOverflow('9999-01-01', '2010-12-31', true); 63 59 64 // ---------------------------------------------------------------- 60 65 debug(''); … … 78 83 checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:34Z'); 79 84 85 // Disabled 86 checkNotOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z', true); 87 80 88 // ---------------------------------------------------------------- 81 89 debug(''); … … 99 107 checkOverflow('2010-01-27T12:34', '2010-01-26T12:34'); 100 108 109 // Disabled 110 checkNotOverflow('9999-01-01T23:59', '2010-12-31T00:00', true); 111 101 112 // ---------------------------------------------------------------- 102 113 debug(''); … … 119 130 input.min = '2010-02'; // value < min && value > max 120 131 checkOverflow('2010-01', '2009-12'); 132 133 // Disabled 134 checkNotOverflow('9999-01', '2010-12', true); 121 135 122 136 // ---------------------------------------------------------------- … … 143 157 checkOverflow('101', '100'); 144 158 159 // Disabled 160 checkNotOverflow('101', '1E+2', true); 161 145 162 // ---------------------------------------------------------------- 146 163 debug(''); … … 162 179 input.min = '14:00'; // value < min && value > max 163 180 checkOverflow('13:16', '12:00'); 181 182 // Disabled 183 checkNotOverflow('23:59:59.999', '13:16', true); 164 184 165 185 // ---------------------------------------------------------------- … … 185 205 checkOverflow('2010-W01', '2009-W50'); 186 206 207 // Disabled 208 checkNotOverflow('9999-W01', '2010-W12', true); 209 187 210 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js
r56242 r73999 3 3 var input = document.createElement('input'); 4 4 5 function checkUnderflow(value, min )5 function checkUnderflow(value, min, disabled) 6 6 { 7 7 input.value = value; 8 8 input.min = min; 9 input.disabled = !!disabled; 9 10 var underflow = input.validity.rangeUnderflow; 10 11 var resultText = 'The value "' + input.value + '" ' + 11 12 (underflow ? 'undeflows' : 'doesn\'t underflow') + 12 ' the minimum value "' + input.min + '" .';13 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); 13 14 if (underflow) 14 15 testPassed(resultText); … … 17 18 } 18 19 19 function checkNotUnderflow(value, min )20 function checkNotUnderflow(value, min, disabled) 20 21 { 21 22 input.value = value; 22 23 input.min = min; 24 input.disabled = !!disabled; 23 25 var underflow = input.validity.rangeUnderflow; 24 26 var resultText = 'The value "' + input.value + '" ' + 25 27 (underflow ? 'underflows' : 'doesn\'t underflow') + 26 ' the minimum value "' + input.min + '" .';28 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.'); 27 29 if (underflow) 28 30 testFailed(resultText); … … 59 61 checkUnderflow('2010-01-27', '2010-02-01'); 60 62 63 // Disabled 64 checkNotUnderflow('9999-01-01', '10000-12-31', true); 65 61 66 // ---------------------------------------------------------------- 62 67 debug(''); … … 82 87 checkUnderflow('2010-01-27T12:00Z', '2010-02-01T12:00Z'); 83 88 89 // Disabled 90 checkNotUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z', true); 91 84 92 // ---------------------------------------------------------------- 85 93 debug(''); … … 105 113 checkUnderflow('2010-01-27T12:00', '2010-02-01T12:00'); 106 114 115 // Disabled 116 checkNotUnderflow('9999-01-01T12:00', '10000-12-31T12:00', true); 117 107 118 // ---------------------------------------------------------------- 108 119 debug(''); … … 127 138 input.max = '2009-12'; // value < min && value > max 128 139 checkUnderflow('2010-01', '2010-02'); 140 141 // Disabled 142 checkNotUnderflow('9999-01', '10000-12', true); 129 143 130 144 // ---------------------------------------------------------------- … … 153 167 checkUnderflow('101', '200'); 154 168 169 // Disabled 170 checkNotUnderflow('99', '1E+2', true); 171 155 172 // ---------------------------------------------------------------- 156 173 debug(''); … … 173 190 input.max = '11:00'; // value < min && value > max 174 191 checkUnderflow('13:16', '14:00'); 192 193 // Disabled 194 checkNotUnderflow('23:59', '23:59:30', true); 175 195 176 196 // ---------------------------------------------------------------- … … 197 217 checkUnderflow('2010-W01', '2010-W02'); 198 218 219 // Disabled 220 checkNotUnderflow('9999-W01', '10000-W12', true); 221 199 222 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
r70615 r73999 4 4 document.body.appendChild(input); 5 5 6 function stepMismatchFor(value, step, min ) {6 function stepMismatchFor(value, step, min, disabled) { 7 7 input.min = min; 8 8 input.step = step; 9 9 input.value = value; 10 input.disabled = !!disabled; 10 11 return input.validity.stepMismatch; 11 12 } … … 38 39 debug('Special step value'); 39 40 shouldBeFalse('stepMismatchFor("2010-02-10", "any", "2010-02-09")'); 41 debug('Disabled'); 42 shouldBeFalse('stepMismatchFor("2010-02-10", "2", "2010-02-09", true)'); 40 43 41 44 debug(''); … … 70 73 debug('Special step value'); 71 74 shouldBeFalse('stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z")'); 75 debug('Disabled'); 76 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true)'); 72 77 73 78 debug(''); … … 102 107 debug('Special step value'); 103 108 shouldBeFalse('stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34")'); 109 debug('Disabled'); 110 shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true)'); 104 111 105 112 debug(''); … … 131 138 debug('Special step value'); 132 139 shouldBeFalse('stepMismatchFor("2010-03", "any", "2010-02")'); 140 debug('Disabled'); 141 shouldBeFalse('stepMismatchFor("2010-03", "2", "2010-02", true)'); 133 142 134 143 debug(''); … … 162 171 debug('Rounding'); 163 172 shouldBe('stepMismatchFor("5.005", "0.005", "4")', 'false'); 173 debug('Disabled'); 174 shouldBe('stepMismatchFor("1", "2", "0", true)', 'false'); 164 175 165 176 debug(''); … … 193 204 shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false'); 194 205 shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false'); 206 debug('Disabled'); 207 shouldBe('stepMismatchFor("1", "2", "0", true)', 'false'); 195 208 196 209 debug(''); … … 223 236 debug('Special step value'); 224 237 shouldBeFalse('stepMismatchFor("12:35", "any", "12:34")'); 238 debug('Disabled'); 239 shouldBeFalse('stepMismatchFor("12:34:55.001", "1", "12:34:56", true)'); 225 240 226 241 debug(''); … … 254 269 debug('Special step value'); 255 270 shouldBeFalse('stepMismatchFor("2010-W03", "any", "2010-W02")'); 271 debug('Disabled'); 272 shouldBeFalse('stepMismatchFor("2010-W03", "2", "2010-W02", true)'); 256 273 257 274 debug(''); -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
r54695 r73999 40 40 41 41 debug(''); 42 debug('Disabled'); 43 input.disabled = true; 44 shouldBeFalse('input.validity.tooLong'); 45 input.disabled = false; 46 47 debug(''); 42 48 debug('Grapheme length is not greater than maxLength though character length is greater'); 43 49 // fancyX should be treated as 1 grapheme. -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
r54695 r73999 42 42 43 43 debug(''); 44 debug('Disabled'); 45 textarea.disabled = true; 46 shouldBeFalse('textarea.validity.tooLong'); 47 textarea.disabled = false; 48 49 debug(''); 44 50 debug('Grapheme length is not greater than maxLength though character length is greater'); 45 51 // fancyX should be treated as 1 grapheme. -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-color.js
r73139 r73999 3 3 i.type = 'color'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' color .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' color' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 45 46 check('transparent', true); 46 47 48 // Disabled 49 check('invalid', false, true); 50 47 51 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js
r66355 r73999 3 3 i.type = 'date'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' date string .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' date string' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 15 16 } 16 17 17 function shouldBeValid(value )18 function shouldBeValid(value, disabled) 18 19 { 19 check(value, false );20 check(value, false, disabled); 20 21 } 21 22 … … 82 83 shouldBeInvalid('2009'); 83 84 85 // Disabled 86 shouldBeValid('2009-09', true); 87 84 88 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js
r66355 r73999 3 3 i.type = 'datetime'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime string .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime string' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 15 16 } 16 17 17 function shouldBeValid(value )18 function shouldBeValid(value, disabled) 18 19 { 19 check(value, false );20 check(value, false, disabled); 20 21 } 21 22 … … 60 61 shouldBeInvalid('2147483648-01-01T00:00:00Z'); 61 62 63 // Disabled 64 shouldBeValid('invalid', true); 65 62 66 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js
r66355 r73999 3 3 i.type = 'datetime-local'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime-local string .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime-local string' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 15 16 } 16 17 17 function shouldBeValid(value )18 function shouldBeValid(value, disabled) 18 19 { 19 check(value, false );20 check(value, false, disabled); 20 21 } 21 22 … … 46 47 shouldBeInvalid('275760-09-13T00:00:00.001'); 47 48 49 // Disabled 50 shouldBeValid('invalid', true); 51 48 52 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-month.js
r66355 r73999 3 3 i.type = 'month'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' month string .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' month string' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 15 16 } 16 17 17 function shouldBeValid(value )18 function shouldBeValid(value, disabled) 18 19 { 19 check(value, false );20 check(value, false, disabled); 20 21 } 21 22 … … 61 62 shouldBeInvalid('2009'); 62 63 64 // Disabled 65 shouldBeValid('invalid', true); 66 63 67 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-number.js
r67164 r73999 4 4 i.type = 'number'; 5 5 6 function check(value )6 function check(value, disabled) 7 7 { 8 8 i.value = value; 9 i.disabled = !!disabled; 9 10 var mismatch = i.validity.typeMismatch; 10 var resultText = '"' + value + '" is ' + (mismatch ? 'an invalid' : 'a valid') + ' number .';11 var resultText = '"' + value + '" is ' + (mismatch ? 'an invalid' : 'a valid') + ' number' + (disabled ? ' when disabled.' : '.'); 11 12 if (!mismatch) 12 13 testPassed(resultText); … … 66 67 check('1.2e10'); 67 68 69 // Disabled 70 check('invalid', true); 71 68 72 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js
r51163 r73999 3 3 i.type = 'time'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' time string .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' time string' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 15 16 } 16 17 17 function shouldBeValid(value )18 function shouldBeValid(value, disabled) 18 19 { 19 check(value, false );20 check(value, false, disabled); 20 21 } 21 22 … … 59 60 shouldBeInvalid('23:45:06.789abc'); 60 61 62 // Disabled 63 shouldBeValid('invalid', true); 64 61 65 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js
r51799 r73999 1 1 description("Input type=url validation test"); 2 2 3 function check(value, mismatchExpected ) {3 function check(value, mismatchExpected, disabled) { 4 4 i.value = value; 5 i.disabled = !!disabled; 5 6 var actual = i.validity.typeMismatch; 6 7 var didPass = actual == mismatchExpected; 7 var resultText = value + ' is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' url .';8 var resultText = value + ' is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' url' + (disabled ? ' when disabled.' : '.'); 8 9 if (didPass) 9 10 testPassed(resultText); … … 12 13 } 13 14 14 function expectValid(value ) {15 check(value, false );15 function expectValid(value, disabled) { 16 check(value, false, disabled); 16 17 } 17 18 … … 78 79 } 79 80 81 // Disabled 82 expectValid('invalid', true); 83 80 84 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-week.js
r66355 r73999 3 3 i.type = 'week'; 4 4 5 function check(value, mismatchExpected )5 function check(value, mismatchExpected, disabled) 6 6 { 7 7 i.value = value; 8 i.disabled = !!disabled; 8 9 var actual = i.validity.typeMismatch; 9 10 var didPass = actual == mismatchExpected; 10 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' week string .';11 var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' week string' + (disabled ? ' when disabled.' : '.'); 11 12 if (didPass) 12 13 testPassed(resultText); … … 15 16 } 16 17 17 function shouldBeValid(value )18 function shouldBeValid(value, disabled) 18 19 { 19 check(value, false );20 check(value, false, disabled); 20 21 } 21 22 … … 57 58 shouldBeInvalid('2009'); 58 59 60 // Disabled 61 shouldBeValid('invalid', true); 62 59 63 var successfullyParsed = true; -
trunk/LayoutTests/fast/forms/script-tests/willvalidate.js
r73686 r73999 55 55 shouldBeTrue('input.willValidate'); 56 56 shouldBeFalse('input.type = "button"; input.willValidate'); 57 shouldBe False('input.type = "submit"; input.willValidate');57 shouldBeTrue('input.type = "submit"; input.willValidate'); 58 58 shouldBeFalse('input.type = "hidden"; input.willValidate'); 59 59 shouldBeFalse('input.type = "reset"; input.willValidate'); -
trunk/LayoutTests/fast/forms/willvalidate-expected.txt
r73686 r73999 31 31 PASS input.willValidate is true 32 32 PASS input.type = "button"; input.willValidate is false 33 PASS input.type = "submit"; input.willValidate is false33 PASS input.type = "submit"; input.willValidate is true 34 34 PASS input.type = "hidden"; input.willValidate is false 35 35 PASS input.type = "reset"; input.willValidate is false -
trunk/WebCore/ChangeLog
r73997 r73999 1 2010-12-13 Dai Mikurube <dmikurube@google.com> 2 3 Reviewed by Kent Tamura. 4 5 ValidityState's exposed functions should check if willValidate() is true before all 6 https://bugs.webkit.org/show_bug.cgi?id=50617 7 8 Added checking willValidate() to exposed functions. And modified willValidate() behavior 9 for <button type="submit"> and <input type="submit"> to return true if not disabled and 10 not readonly. 11 12 * html/HTMLButtonElement.cpp: 13 (WebCore::HTMLButtonElement::parseMappedAttribute): Added calling setNeedsWillValidateCheck() to refresh willValidate() after changing its type. 14 (WebCore::HTMLButtonElement::recalcWillValidate): Added to return true if not disabled and not readonly when type="submit". It's to be compliant to the spec. 15 * html/HTMLButtonElement.h: 16 * html/SubmitInputType.cpp: 17 (WebCore::SubmitInputType::supportsValidation): Removed it to enable willValidate() for <input> when type="submit". It's to be compliant to the spec. 18 (WebCore::SubmitInputType::supportsRequired): Added it to reject required attributes though validation is available. 19 * html/SubmitInputType.h: 20 * html/ValidityState.cpp: Added checking willValidate(). 21 (WebCore::ValidityState::typeMismatch): 22 (WebCore::ValidityState::patternMismatch): 23 (WebCore::ValidityState::tooLong): 24 (WebCore::ValidityState::rangeUnderflow): 25 (WebCore::ValidityState::rangeOverflow): 26 (WebCore::ValidityState::stepMismatch): 27 (WebCore::ValidityState::customError): 28 * html/ValidityState.h: 29 1 30 2010-12-13 Noel Gordon <noel.gordon@gmail.com> 2 31 -
trunk/WebCore/html/HTMLButtonElement.cpp
r72038 r73999 89 89 else 90 90 m_type = SUBMIT; 91 setNeedsWillValidateCheck(); 91 92 } else if (attr->name() == alignAttr) { 92 93 // Don't map 'align' attribute. This matches what Firefox and IE do, but not Opera. … … 181 182 } 182 183 184 bool HTMLButtonElement::recalcWillValidate() const 185 { 186 return m_type == SUBMIT && HTMLFormControlElement::recalcWillValidate(); 187 } 188 183 189 } // namespace -
trunk/WebCore/html/HTMLButtonElement.h
r72038 r73999 60 60 61 61 virtual bool isOptionalFormControl() const { return true; } 62 virtual bool recalcWillValidate() const { return false; }62 virtual bool recalcWillValidate() const; 63 63 64 64 Type m_type; -
trunk/WebCore/html/SubmitInputType.cpp
r72059 r73999 57 57 } 58 58 59 bool SubmitInputType::supports Validation() const59 bool SubmitInputType::supportsRequired() const 60 60 { 61 61 return false; -
trunk/WebCore/html/SubmitInputType.h
r72059 r73999 44 44 virtual const AtomicString& formControlType() const; 45 45 virtual bool appendFormData(FormDataList&, bool) const; 46 virtual bool supports Validation() const;46 virtual bool supportsRequired() const; 47 47 virtual bool handleDOMActivateEvent(Event*); 48 48 }; -
trunk/WebCore/html/ValidityState.cpp
r73606 r73999 127 127 bool ValidityState::typeMismatch() const 128 128 { 129 if (!toHTMLElement(m_control)->hasTagName(inputTag)) 130 return false; 131 return static_cast<HTMLInputElement*>(m_control)->typeMismatch(); 129 HTMLElement* element = toHTMLElement(m_control); 130 if (!element->willValidate()) 131 return false; 132 133 if (!element->hasTagName(inputTag)) 134 return false; 135 return static_cast<HTMLInputElement*>(element)->typeMismatch(); 132 136 } 133 137 134 138 bool ValidityState::patternMismatch() const 135 139 { 136 if (!toHTMLElement(m_control)->hasTagName(inputTag)) 137 return false; 138 HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control); 140 HTMLElement* element = toHTMLElement(m_control); 141 if (!element->willValidate()) 142 return false; 143 144 if (!element->hasTagName(inputTag)) 145 return false; 146 HTMLInputElement* input = static_cast<HTMLInputElement*>(element); 139 147 return input->patternMismatch(input->value()); 140 148 } … … 142 150 bool ValidityState::tooLong() const 143 151 { 144 if (toHTMLElement(m_control)->hasTagName(inputTag)) { 145 HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control); 152 HTMLElement* element = toHTMLElement(m_control); 153 if (!element->willValidate()) 154 return false; 155 156 if (element->hasTagName(inputTag)) { 157 HTMLInputElement* input = static_cast<HTMLInputElement*>(element); 146 158 return input->tooLong(input->value(), HTMLTextFormControlElement::CheckDirtyFlag); 147 159 } 148 if ( toHTMLElement(m_control)->hasTagName(textareaTag)) {149 HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>( m_control);160 if (element->hasTagName(textareaTag)) { 161 HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(element); 150 162 return textArea->tooLong(textArea->value(), HTMLTextFormControlElement::CheckDirtyFlag); 151 163 } … … 155 167 bool ValidityState::rangeUnderflow() const 156 168 { 157 if (!toHTMLElement(m_control)->hasTagName(inputTag)) 158 return false; 159 HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control); 169 HTMLElement* element = toHTMLElement(m_control); 170 if (!element->willValidate()) 171 return false; 172 173 if (!element->hasTagName(inputTag)) 174 return false; 175 HTMLInputElement* input = static_cast<HTMLInputElement*>(element); 160 176 return input->rangeUnderflow(input->value()); 161 177 } … … 163 179 bool ValidityState::rangeOverflow() const 164 180 { 165 if (!toHTMLElement(m_control)->hasTagName(inputTag)) 166 return false; 167 HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control); 181 HTMLElement* element = toHTMLElement(m_control); 182 if (!element->willValidate()) 183 return false; 184 185 if (!element->hasTagName(inputTag)) 186 return false; 187 HTMLInputElement* input = static_cast<HTMLInputElement*>(element); 168 188 return input->rangeOverflow(input->value()); 169 189 } … … 171 191 bool ValidityState::stepMismatch() const 172 192 { 173 if (!toHTMLElement(m_control)->hasTagName(inputTag)) 174 return false; 175 HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control); 193 HTMLElement* element = toHTMLElement(m_control); 194 if (!element->willValidate()) 195 return false; 196 197 if (!element->hasTagName(inputTag)) 198 return false; 199 HTMLInputElement* input = static_cast<HTMLInputElement*>(element); 176 200 return input->stepMismatch(input->value()); 201 } 202 203 bool ValidityState::customError() const 204 { 205 HTMLElement* element = toHTMLElement(m_control); 206 return element->willValidate() && !m_customErrorMessage.isEmpty(); 177 207 } 178 208 -
trunk/WebCore/html/ValidityState.h
r73430 r73999 51 51 bool rangeOverflow() const; 52 52 bool stepMismatch() const; 53 bool customError() const { return !m_customErrorMessage.isEmpty(); }53 bool customError() const; 54 54 bool valid() const; 55 55
Note: See TracChangeset
for help on using the changeset viewer.