Changeset 73999 in webkit


Ignore:
Timestamp:
Dec 13, 2010 9:19:30 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-13 Dai Mikurube <dmikurube@google.com>

Reviewed by Kent Tamura.

ValidityState's exposed functions should check if willValidate() is true before all
https://bugs.webkit.org/show_bug.cgi?id=50617

  • fast/css/pseudo-required-optional-005-expected.txt:
  • fast/css/pseudo-required-optional-005.html:
  • fast/css/pseudo-valid-001-expected.txt:
  • fast/css/pseudo-valid-001.html:
  • fast/css/pseudo-valid-unapplied-expected.txt:
  • fast/css/pseudo-valid-unapplied.html:
  • fast/forms/ValidityState-customError.html:
  • fast/forms/ValidityState-customError-expected.txt:
  • fast/forms/ValidityState-customError.html:
  • fast/forms/ValidityState-patternMismatch-expected.txt:
  • fast/forms/ValidityState-patternMismatch.html:
  • fast/forms/ValidityState-rangeOverflow-expected.txt:
  • fast/forms/ValidityState-rangeUnderflow-expected.txt:
  • fast/forms/ValidityState-stepMismatch-expected.txt:
  • fast/forms/ValidityState-tooLong-input-expected.txt:
  • fast/forms/ValidityState-tooLong-textarea-expected.txt:
  • fast/forms/ValidityState-typeMismatch-color-expected.txt:
  • fast/forms/ValidityState-typeMismatch-date-expected.txt:
  • fast/forms/ValidityState-typeMismatch-datetime-expected.txt:
  • fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt:
  • fast/forms/ValidityState-typeMismatch-month-expected.txt:
  • fast/forms/ValidityState-typeMismatch-number-expected.txt:
  • fast/forms/ValidityState-typeMismatch-time-expected.txt:
  • fast/forms/ValidityState-typeMismatch-url-expected.txt:
  • fast/forms/ValidityState-typeMismatch-week-expected.txt:
  • fast/forms/script-tests/ValidityState-rangeOverflow.js: (checkOverflow): (checkNotOverflow):
  • fast/forms/script-tests/ValidityState-rangeUnderflow.js: (checkUnderflow): (checkNotUnderflow):
  • fast/forms/script-tests/ValidityState-stepMismatch.js: (stepMismatchFor):
  • fast/forms/script-tests/ValidityState-tooLong-input.js:
  • fast/forms/script-tests/ValidityState-tooLong-textarea.js:
  • fast/forms/script-tests/ValidityState-typeMismatch-color.js: ():
  • fast/forms/script-tests/ValidityState-typeMismatch-date.js: (): (shouldBeValid): (shouldBeInvalid):
  • fast/forms/script-tests/ValidityState-typeMismatch-datetime.js: (): (shouldBeValid): (shouldBeInvalid):
  • fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js: (): (shouldBeValid): (shouldBeInvalid):
  • fast/forms/script-tests/ValidityState-typeMismatch-month.js: (): (shouldBeValid): (shouldBeInvalid):
  • fast/forms/script-tests/ValidityState-typeMismatch-number.js: ():
  • fast/forms/script-tests/ValidityState-typeMismatch-time.js: (): (shouldBeValid): (shouldBeInvalid):
  • fast/forms/script-tests/ValidityState-typeMismatch-url.js: (check): (expectValid): (expectInvalid):
  • fast/forms/script-tests/ValidityState-typeMismatch-week.js: (): (shouldBeValid): (shouldBeInvalid):
  • fast/forms/script-tests/willvalidate.js:
  • fast/forms/willvalidate-expected.txt:

2010-12-13 Dai Mikurube <dmikurube@google.com>

Reviewed by Kent Tamura.

ValidityState's exposed functions should check if willValidate() is true before all
https://bugs.webkit.org/show_bug.cgi?id=50617

Added checking willValidate() to exposed functions. And modified willValidate() behavior
for <button type="submit"> and <input type="submit"> to return true if not disabled and
not readonly.

  • html/HTMLButtonElement.cpp: (WebCore::HTMLButtonElement::parseMappedAttribute): Added calling setNeedsWillValidateCheck() to refresh willValidate() after changing its type. (WebCore::HTMLButtonElement::recalcWillValidate): Added to return true if not disabled and not readonly when type="submit". It's to be compliant to the spec.
  • html/HTMLButtonElement.h:
  • html/SubmitInputType.cpp: (WebCore::SubmitInputType::supportsValidation): Removed it to enable willValidate() for <input> when type="submit". It's to be compliant to the spec. (WebCore::SubmitInputType::supportsRequired): Added it to reject required attributes though validation is available.
  • html/SubmitInputType.h:
  • html/ValidityState.cpp: Added checking willValidate(). (WebCore::ValidityState::typeMismatch): (WebCore::ValidityState::patternMismatch): (WebCore::ValidityState::tooLong): (WebCore::ValidityState::rangeUnderflow): (WebCore::ValidityState::rangeOverflow): (WebCore::ValidityState::stepMismatch): (WebCore::ValidityState::customError):
  • html/ValidityState.h:
Location:
trunk
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r73998 r73999  
     12010-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
    1782010-12-13  Brian Weinstein  <bweinstein@apple.com>
    279
  • trunk/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt

    r46062 r73999  
    1 All controls should have a green background.
     1This test checks the CSS pseudoclasses for input types.
    22
     3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     4
     5
     6PASS isOptional("range") is true
     7PASS isOptional("submit") is true
     8PASS isOptional("image") is true
     9PASS isOptional("reset") is true
     10PASS isOptional("button") is true
     11PASS successfullyParsed is true
     12
     13TEST COMPLETE
    314   
    4 SUCCESS
    5 SUCCESS
    6 SUCCESS
    7 SUCCESS
    8 SUCCESS
  • trunk/LayoutTests/fast/css/pseudo-required-optional-005.html

    r46062 r73999  
    22<head>
    33<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>
    46<style>
    57 input:optional { background: lime; }
     
    79 input:required { background: red; }
    810</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/>
    920<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     }
     21function isOptional(id) {
     22    return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('background-color') == "rgb(0, 255, 0)"
     23}
     24description('This test checks the CSS pseudoclasses for input types.');
     25shouldBeTrue('isOptional("range")');
     26shouldBeTrue('isOptional("submit")');
     27shouldBeTrue('isOptional("image")');
     28shouldBeTrue('isOptional("reset")');
     29shouldBeTrue('isOptional("button")');
     30var successfullyParsed = true;
    2631</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>
    3733</body>
    3834</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.
     1This test performs a check for the :valid CSS selector on various input and button elements.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6  
     6   
     7PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
     8PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
    79PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
    810PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
  • trunk/LayoutTests/fast/css/pseudo-valid-001.html

    r47444 r73999  
    1616<input name="victim" type="text" value="Lorem ipsum" required/>
    1717<input name="victim" type="text" value="Lorem ipsum" pattern="Lorem ipsum"/>
     18<input name="victim" type="submit">
     19<button name="victim"></button>
    1820</form>
    1921<div id="console"></div>
    2022<script>
    21 description("This test performs a check for the :valid CSS selector on various input elements.");
     23description("This test performs a check for the :valid CSS selector on various input and button elements.");
    2224
    2325v = document.getElementsByName("victim");
  • trunk/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt

    r59645 r73999  
    99PASS getBackgroundColor('input-reset') is normalColor
    1010PASS getBackgroundColor('input-hidden') is normalColor
    11 PASS getBackgroundColor('input-submit') is normalColor
    1211PASS getBackgroundColor('input-image') is normalColor
    1312PASS getBackgroundColor('fieldset') is normalColor
    1413PASS getBackgroundColor('object') is normalColor
    15 PASS getBackgroundColor('button') is normalColor
     14PASS getBackgroundColor('button-button') is normalColor
     15PASS getBackgroundColor('button-reset') is normalColor
    1616PASS getBackgroundColor('progress') is normalColor
    1717PASS getBackgroundColor('meter') is normalColor
  • trunk/LayoutTests/fast/css/pseudo-valid-unapplied.html

    r59645 r73999  
    2323<input name="input-reset" type="reset" value="Lorem ipsum"/>
    2424<input name="input-hidden" type="hidden" value="Lorem ipsum"/>
    25 <input name="input-submit" type="submit">
    2625<input name="input-image" type="image">
    2726<fieldset name="fieldset"></fieldset>
    2827<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>
    3030<progress id="progress" value=50 max=100>50</progress>
    3131<meter id="meter" value=50 max=100>50</meter>
     
    4747    "input-reset",
    4848    "input-hidden",
    49     "input-submit",
    5049    "input-image",
    5150    "fieldset",
    5251    "object",
    53     "button",
     52    "button-button",
     53    "button-reset",
    5454    "progress",
    5555    "meter",
  • trunk/LayoutTests/fast/forms/ValidityState-customError-expected.txt

    r73715 r73999  
    55
    66Set some value for customError.
    7 PASS customErrorFor("fieldset-set") is true
     7PASS customErrorFor("fieldset-set") is false
    88PASS customErrorFor("button-set") is true
    9 PASS customErrorFor("button-button-set") is true
    10 PASS customErrorFor("button-reset-set") is true
     9PASS customErrorFor("button-button-set") is false
     10PASS customErrorFor("button-reset-set") is false
    1111PASS customErrorFor("select-set") is true
    1212PASS customErrorFor("textarea-set") is true
     
    4545PASS customErrorFor("input-submit-many-changes") is false
    4646Set with three arguments.
    47 PASS customErrorFor("fieldset-many-changes") is true
     47PASS customErrorFor("fieldset-many-changes") is false
    4848PASS customErrorFor("button-many-changes") is true
    49 PASS customErrorFor("button-button-many-changes") is true
    50 PASS customErrorFor("button-reset-many-changes") is true
     49PASS customErrorFor("button-button-many-changes") is false
     50PASS customErrorFor("button-reset-many-changes") is false
    5151PASS customErrorFor("select-many-changes") is true
    5252PASS customErrorFor("textarea-many-changes") is true
  • trunk/LayoutTests/fast/forms/ValidityState-customError.html

    r73715 r73999  
    5656for (i = 0; i < v.length; i++)
    5757    v[i].setCustomValidity("Custom validation message");
    58 shouldBeTrue('customErrorFor("fieldset-set")');
     58shouldBeFalse('customErrorFor("fieldset-set")');
    5959shouldBeTrue('customErrorFor("button-set")');
    60 shouldBeTrue('customErrorFor("button-button-set")');
    61 shouldBeTrue('customErrorFor("button-reset-set")');
     60shouldBeFalse('customErrorFor("button-button-set")');
     61shouldBeFalse('customErrorFor("button-reset-set")');
    6262shouldBeTrue('customErrorFor("select-set")');
    6363shouldBeTrue('customErrorFor("textarea-set")');
     
    112112for (i = 0; i < v.length; i++)
    113113    v[i].setCustomValidity("one", "two", "three");
    114 shouldBeTrue('customErrorFor("fieldset-many-changes")');
     114shouldBeFalse('customErrorFor("fieldset-many-changes")');
    115115shouldBeTrue('customErrorFor("button-many-changes")');
    116 shouldBeTrue('customErrorFor("button-button-many-changes")');
    117 shouldBeTrue('customErrorFor("button-reset-many-changes")');
     116shouldBeFalse('customErrorFor("button-button-many-changes")');
     117shouldBeFalse('customErrorFor("button-reset-many-changes")');
    118118shouldBeTrue('customErrorFor("select-many-changes")');
    119119shouldBeTrue('customErrorFor("textarea-many-changes")');
  • trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt

    r73720 r73999  
    5151PASS patternMismatchFor("mismatch-20") is true
    5252PASS patternMismatchFor("empty-pattern") is false
    53 PASS patternMismatchFor("disabled") is true
     53PASS patternMismatchFor("disabled") is false
    5454PASS successfullyParsed is true
    5555
  • trunk/LayoutTests/fast/forms/ValidityState-patternMismatch.html

    r73720 r73999  
    115115shouldBeFalse('patternMismatchFor("empty-pattern")');
    116116
    117 shouldBeTrue('patternMismatchFor("disabled")');
     117shouldBeFalse('patternMismatchFor("disabled")');
    118118
    119119var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt

    r67164 r73999  
    1919PASS The value "9999-01-01" overflows the maximum value "2010-12-31".
    2020PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
     21PASS The value "9999-01-01" doesn't overflow the maximum value "2010-12-31" when disabled.
    2122
    2223Type=datetime
     
    3233PASS The value "9999-01-01T23:59Z" overflows the maximum value "2010-12-31T00:00Z".
    3334PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:34Z".
     35PASS The value "9999-01-01T23:59Z" doesn't overflow the maximum value "2010-12-31T00:00Z" when disabled.
    3436
    3537Type=datetime-local
     
    4547PASS The value "9999-01-01T23:59" overflows the maximum value "2010-12-31T00:00".
    4648PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:34".
     49PASS The value "9999-01-01T23:59" doesn't overflow the maximum value "2010-12-31T00:00" when disabled.
    4750
    4851Type=month
     
    5861PASS The value "9999-01" overflows the maximum value "2010-12".
    5962PASS The value "2010-01" overflows the maximum value "2009-12".
     63PASS The value "9999-01" doesn't overflow the maximum value "2010-12" when disabled.
    6064
    6165Type=number
     
    7377PASS The value "101" overflows the maximum value "1E+2".
    7478PASS The value "101" overflows the maximum value "100".
     79PASS The value "101" doesn't overflow the maximum value "1E+2" when disabled.
    7580
    7681Type=time
     
    8590PASS The value "23:59:59.999" overflows the maximum value "13:16".
    8691PASS The value "13:16" overflows the maximum value "12:00".
     92PASS The value "23:59:59.999" doesn't overflow the maximum value "13:16" when disabled.
    8793
    8894Type=week
     
    99105PASS The value "9999-W01" overflows the maximum value "2010-W12".
    100106PASS The value "2010-W01" overflows the maximum value "2009-W50".
     107PASS The value "9999-W01" doesn't overflow the maximum value "2010-W12" when disabled.
    101108PASS successfullyParsed is true
    102109
  • trunk/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt

    r67164 r73999  
    1919PASS The value "9999-01-01" undeflows the minimum value "10000-12-31".
    2020PASS The value "2010-01-27" undeflows the minimum value "2010-02-01".
     21PASS The value "9999-01-01" doesn't underflow the minimum value "10000-12-31" when disabled.
    2122
    2223Type=datetime
     
    3233PASS The value "9999-01-01T12:00Z" undeflows the minimum value "10000-12-31T12:00Z".
    3334PASS The value "2010-01-27T12:00Z" undeflows the minimum value "2010-02-01T12:00Z".
     35PASS The value "9999-01-01T12:00Z" doesn't underflow the minimum value "10000-12-31T12:00Z" when disabled.
    3436
    3537Type=datetime-local
     
    4547PASS The value "9999-01-01T12:00" undeflows the minimum value "10000-12-31T12:00".
    4648PASS The value "2010-01-27T12:00" undeflows the minimum value "2010-02-01T12:00".
     49PASS The value "9999-01-01T12:00" doesn't underflow the minimum value "10000-12-31T12:00" when disabled.
    4750
    4851Type=month
     
    5861PASS The value "9999-01" undeflows the minimum value "10000-12".
    5962PASS The value "2010-01" undeflows the minimum value "2010-02".
     63PASS The value "9999-01" doesn't underflow the minimum value "10000-12" when disabled.
    6064
    6165Type=number
     
    7377PASS The value "99" undeflows the minimum value "1E+2".
    7478PASS The value "101" undeflows the minimum value "200".
     79PASS The value "99" doesn't underflow the minimum value "1E+2" when disabled.
    7580
    7681Type=time
     
    8691PASS The value "23:59" undeflows the minimum value "23:59:30".
    8792PASS The value "13:16" undeflows the minimum value "14:00".
     93PASS The value "23:59" doesn't underflow the minimum value "23:59:30" when disabled.
    8894
    8995Type=week
     
    99105PASS The value "9999-W01" undeflows the minimum value "10000-W12".
    100106PASS The value "2010-W01" undeflows the minimum value "2010-W02".
     107PASS The value "9999-W01" doesn't underflow the minimum value "10000-W12" when disabled.
    101108PASS successfullyParsed is true
    102109
  • trunk/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt

    r70615 r73999  
    3030Special step value
    3131PASS stepMismatchFor("2010-02-10", "any", "2010-02-09") is false
     32Disabled
     33PASS stepMismatchFor("2010-02-10", "2", "2010-02-09", true) is false
    3234
    3335Datetime type
     
    6062Special step value
    6163PASS stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z") is false
     64Disabled
     65PASS stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true) is false
    6266
    6367Datetime-local type
     
    9094Special step value
    9195PASS stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34") is false
     96Disabled
     97PASS stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true) is false
    9298
    9399Month type
     
    117123Special step value
    118124PASS stepMismatchFor("2010-03", "any", "2010-02") is false
     125Disabled
     126PASS stepMismatchFor("2010-03", "2", "2010-02", true) is false
    119127
    120128Number type
     
    145153Rounding
    146154PASS stepMismatchFor("5.005", "0.005", "4") is false
     155Disabled
     156PASS stepMismatchFor("1", "2", "0", true) is false
    147157
    148158Range type
     
    171181PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false
    172182PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false
     183Disabled
     184PASS stepMismatchFor("1", "2", "0", true) is false
    173185
    174186Time type
     
    199211Special step value
    200212PASS stepMismatchFor("12:35", "any", "12:34") is false
     213Disabled
     214PASS stepMismatchFor("12:34:55.001", "1", "12:34:56", true) is false
    201215
    202216Week type
     
    228242Special step value
    229243PASS stepMismatchFor("2010-W03", "any", "2010-W02") is false
     244Disabled
     245PASS stepMismatchFor("2010-W03", "2", "2010-W02", true) is false
    230246
    231247Unsupported types
  • trunk/LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt

    r54695 r73999  
    2121PASS input.validity.tooLong is true
    2222
     23Disabled
     24PASS input.validity.tooLong is false
     25
    2326Grapheme length is not greater than maxLength though character length is greater
    2427PASS input.validity.tooLong is false
  • trunk/LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt

    r54695 r73999  
    2121PASS textarea.validity.tooLong is true
    2222
     23Disabled
     24PASS textarea.validity.tooLong is false
     25
    2326Grapheme length is not greater than maxLength though character length is greater
    2427PASS textarea.validity.tooLong is false
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-color-expected.txt

    r73139 r73999  
    2828PASS "xxx-non-existent-color-name" is a correct invalid color.
    2929PASS "transparent" is a correct invalid color.
     30PASS "invalid" is a correct valid color when disabled.
    3031PASS successfullyParsed is true
    3132
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt

    r66355 r73999  
    5757PASS "2009-09" is a correct invalid date string.
    5858PASS "2009" is a correct invalid date string.
     59PASS "2009-09" is a correct valid date string when disabled.
    5960PASS successfullyParsed is true
    6061
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-datetime-expected.txt

    r66355 r73999  
    3535PASS "2147483647-12-31T23:59-00:01" is a correct invalid datetime string.
    3636PASS "2147483648-01-01T00:00:00Z" is a correct invalid datetime string.
     37PASS "invalid" is a correct valid datetime string when disabled.
    3738PASS successfullyParsed is true
    3839
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt

    r66355 r73999  
    2121PASS "0000-12-31T23:59:59.999" is a correct invalid datetime-local string.
    2222PASS "275760-09-13T00:00:00.001" is a correct invalid datetime-local string.
     23PASS "invalid" is a correct valid datetime-local string when disabled.
    2324PASS successfullyParsed is true
    2425
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-month-expected.txt

    r66355 r73999  
    3636PASS "2009-xx" is a correct invalid month string.
    3737PASS "2009" is a correct invalid month string.
     38PASS "invalid" is a correct valid month string when disabled.
    3839PASS successfullyParsed is true
    3940
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-number-expected.txt

    r67164 r73999  
    3232PASS "1." is a valid number.
    3333PASS "1.2e10" is a valid number.
     34PASS "invalid" is a valid number when disabled.
    3435PASS successfullyParsed is true
    3536
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt

    r51163 r73999  
    3434PASS "23:45:06.abc" is a correct invalid time string.
    3535PASS "23:45:06.789abc" is a correct invalid time string.
     36PASS "invalid" is a correct valid time string when disabled.
    3637PASS successfullyParsed is true
    3738
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-url-expected.txt

    r51799 r73999  
    4343PASS http://host+ is a correct invalid url.
    4444PASS http://myurl! is a correct invalid url.
     45PASS invalid is a correct valid url when disabled.
    4546PASS successfullyParsed is true
    4647
  • trunk/LayoutTests/fast/forms/ValidityState-typeMismatch-week-expected.txt

    r66355 r73999  
    3232PASS "2009-Wxx" is a correct invalid week string.
    3333PASS "2009" is a correct invalid week string.
     34PASS "invalid" is a correct valid week string when disabled.
    3435PASS successfullyParsed is true
    3536
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js

    r66355 r73999  
    33var input = document.createElement('input');
    44
    5 function checkOverflow(value, max)
     5function checkOverflow(value, max, disabled)
    66{
    77    input.value = value;
    88    input.max = max;
     9    input.disabled = !!disabled;
    910    var overflow = input.validity.rangeOverflow;
    1011    var resultText = 'The value "' + input.value + '" ' +
    1112        (overflow ? 'overflows' : 'doesn\'t overflow') +
    12         ' the maximum value "' + input.max + '".';
     13        ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
    1314    if (overflow)
    1415        testPassed(resultText);
     
    1718}
    1819
    19 function checkNotOverflow(value, max)
     20function checkNotOverflow(value, max, disabled)
    2021{
    2122    input.value = value;
    2223    input.max = max;
     24    input.disabled = !!disabled;
    2325    var overflow = input.validity.rangeOverflow;
    2426    var resultText = 'The value "' + input.value + '" ' +
    2527        (overflow ? 'overflows' : 'doesn\'t overflow') +
    26         ' the maximum value "' + input.max + '".';
     28        ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
    2729    if (overflow)
    2830        testFailed(resultText);
     
    5759checkOverflow('2010-01-27', '2010-01-26');
    5860
     61// Disabled
     62checkNotOverflow('9999-01-01', '2010-12-31', true);
     63
    5964// ----------------------------------------------------------------
    6065debug('');
     
    7883checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:34Z');
    7984
     85// Disabled
     86checkNotOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z', true);
     87
    8088// ----------------------------------------------------------------
    8189debug('');
     
    99107checkOverflow('2010-01-27T12:34', '2010-01-26T12:34');
    100108
     109// Disabled
     110checkNotOverflow('9999-01-01T23:59', '2010-12-31T00:00', true);
     111
    101112// ----------------------------------------------------------------
    102113debug('');
     
    119130input.min = '2010-02';  // value < min && value > max
    120131checkOverflow('2010-01', '2009-12');
     132
     133// Disabled
     134checkNotOverflow('9999-01', '2010-12', true);
    121135
    122136// ----------------------------------------------------------------
     
    143157checkOverflow('101', '100');
    144158
     159// Disabled
     160checkNotOverflow('101', '1E+2', true);
     161
    145162// ----------------------------------------------------------------
    146163debug('');
     
    162179input.min = '14:00';  // value < min && value > max
    163180checkOverflow('13:16', '12:00');
     181
     182// Disabled
     183checkNotOverflow('23:59:59.999', '13:16', true);
    164184
    165185// ----------------------------------------------------------------
     
    185205checkOverflow('2010-W01', '2009-W50');
    186206
     207// Disabled
     208checkNotOverflow('9999-W01', '2010-W12', true);
     209
    187210var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js

    r56242 r73999  
    33var input = document.createElement('input');
    44
    5 function checkUnderflow(value, min)
     5function checkUnderflow(value, min, disabled)
    66{
    77    input.value = value;
    88    input.min = min;
     9    input.disabled = !!disabled;
    910    var underflow = input.validity.rangeUnderflow;
    1011    var resultText = 'The value "' + input.value + '" ' +
    1112        (underflow ? 'undeflows' : 'doesn\'t underflow') +
    12         ' the minimum value "' + input.min + '".';
     13        ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
    1314    if (underflow)
    1415        testPassed(resultText);
     
    1718}
    1819
    19 function checkNotUnderflow(value, min)
     20function checkNotUnderflow(value, min, disabled)
    2021{
    2122    input.value = value;
    2223    input.min = min;
     24    input.disabled = !!disabled;
    2325    var underflow = input.validity.rangeUnderflow;
    2426    var resultText = 'The value "' + input.value + '" ' +
    2527        (underflow ? 'underflows' : 'doesn\'t underflow') +
    26         ' the minimum value "' + input.min + '".';
     28        ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
    2729    if (underflow)
    2830        testFailed(resultText);
     
    5961checkUnderflow('2010-01-27', '2010-02-01');
    6062
     63// Disabled
     64checkNotUnderflow('9999-01-01', '10000-12-31', true);
     65
    6166// ----------------------------------------------------------------
    6267debug('');
     
    8287checkUnderflow('2010-01-27T12:00Z', '2010-02-01T12:00Z');
    8388
     89// Disabled
     90checkNotUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z', true);
     91
    8492// ----------------------------------------------------------------
    8593debug('');
     
    105113checkUnderflow('2010-01-27T12:00', '2010-02-01T12:00');
    106114
     115// Disabled
     116checkNotUnderflow('9999-01-01T12:00', '10000-12-31T12:00', true);
     117
    107118// ----------------------------------------------------------------
    108119debug('');
     
    127138input.max = '2009-12';  // value < min && value > max
    128139checkUnderflow('2010-01', '2010-02');
     140
     141// Disabled
     142checkNotUnderflow('9999-01', '10000-12', true);
    129143
    130144// ----------------------------------------------------------------
     
    153167checkUnderflow('101', '200');
    154168
     169// Disabled
     170checkNotUnderflow('99', '1E+2', true);
     171
    155172// ----------------------------------------------------------------
    156173debug('');
     
    173190input.max = '11:00';  // value < min && value > max
    174191checkUnderflow('13:16', '14:00');
     192
     193// Disabled
     194checkNotUnderflow('23:59', '23:59:30', true);
    175195
    176196// ----------------------------------------------------------------
     
    197217checkUnderflow('2010-W01', '2010-W02');
    198218
     219// Disabled
     220checkNotUnderflow('9999-W01', '10000-W12', true);
     221
    199222var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js

    r70615 r73999  
    44document.body.appendChild(input);
    55
    6 function stepMismatchFor(value, step, min) {
     6function stepMismatchFor(value, step, min, disabled) {
    77    input.min = min;
    88    input.step = step;
    99    input.value = value;
     10    input.disabled = !!disabled;
    1011    return input.validity.stepMismatch;
    1112}
     
    3839debug('Special step value');
    3940shouldBeFalse('stepMismatchFor("2010-02-10", "any", "2010-02-09")');
     41debug('Disabled');
     42shouldBeFalse('stepMismatchFor("2010-02-10", "2", "2010-02-09", true)');
    4043
    4144debug('');
     
    7073debug('Special step value');
    7174shouldBeFalse('stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z")');
     75debug('Disabled');
     76shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true)');
    7277
    7378debug('');
     
    102107debug('Special step value');
    103108shouldBeFalse('stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34")');
     109debug('Disabled');
     110shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true)');
    104111
    105112debug('');
     
    131138debug('Special step value');
    132139shouldBeFalse('stepMismatchFor("2010-03", "any", "2010-02")');
     140debug('Disabled');
     141shouldBeFalse('stepMismatchFor("2010-03", "2", "2010-02", true)');
    133142
    134143debug('');
     
    162171debug('Rounding');
    163172shouldBe('stepMismatchFor("5.005", "0.005", "4")', 'false');
     173debug('Disabled');
     174shouldBe('stepMismatchFor("1", "2", "0", true)', 'false');
    164175
    165176debug('');
     
    193204shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false');
    194205shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false');
     206debug('Disabled');
     207shouldBe('stepMismatchFor("1", "2", "0", true)', 'false');
    195208
    196209debug('');
     
    223236debug('Special step value');
    224237shouldBeFalse('stepMismatchFor("12:35", "any", "12:34")');
     238debug('Disabled');
     239shouldBeFalse('stepMismatchFor("12:34:55.001", "1", "12:34:56", true)');
    225240
    226241debug('');
     
    254269debug('Special step value');
    255270shouldBeFalse('stepMismatchFor("2010-W03", "any", "2010-W02")');
     271debug('Disabled');
     272shouldBeFalse('stepMismatchFor("2010-W03", "2", "2010-W02", true)');
    256273
    257274debug('');
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js

    r54695 r73999  
    4040
    4141debug('');
     42debug('Disabled');
     43input.disabled = true;
     44shouldBeFalse('input.validity.tooLong');
     45input.disabled = false;
     46
     47debug('');
    4248debug('Grapheme length is not greater than maxLength though character length is greater');
    4349// fancyX should be treated as 1 grapheme.
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js

    r54695 r73999  
    4242
    4343debug('');
     44debug('Disabled');
     45textarea.disabled = true;
     46shouldBeFalse('textarea.validity.tooLong');
     47textarea.disabled = false;
     48
     49debug('');
    4450debug('Grapheme length is not greater than maxLength though character length is greater');
    4551// fancyX should be treated as 1 grapheme.
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-color.js

    r73139 r73999  
    33i.type = 'color';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    4546check('transparent', true);
    4647
     48// Disabled
     49check('invalid', false, true);
     50
    4751var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js

    r66355 r73999  
    33i.type = 'date';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    1516}
    1617
    17 function shouldBeValid(value)
     18function shouldBeValid(value, disabled)
    1819{
    19     check(value, false);
     20    check(value, false, disabled);
    2021}
    2122
     
    8283shouldBeInvalid('2009');
    8384
     85// Disabled
     86shouldBeValid('2009-09', true);
     87
    8488var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js

    r66355 r73999  
    33i.type = 'datetime';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    1516}
    1617
    17 function shouldBeValid(value)
     18function shouldBeValid(value, disabled)
    1819{
    19     check(value, false);
     20    check(value, false, disabled);
    2021}
    2122
     
    6061shouldBeInvalid('2147483648-01-01T00:00:00Z');
    6162
     63// Disabled
     64shouldBeValid('invalid', true);
     65
    6266var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js

    r66355 r73999  
    33i.type = 'datetime-local';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    1516}
    1617
    17 function shouldBeValid(value)
     18function shouldBeValid(value, disabled)
    1819{
    19     check(value, false);
     20    check(value, false, disabled);
    2021}
    2122
     
    4647shouldBeInvalid('275760-09-13T00:00:00.001');
    4748
     49// Disabled
     50shouldBeValid('invalid', true);
     51
    4852var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-month.js

    r66355 r73999  
    33i.type = 'month';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    1516}
    1617
    17 function shouldBeValid(value)
     18function shouldBeValid(value, disabled)
    1819{
    19     check(value, false);
     20    check(value, false, disabled);
    2021}
    2122
     
    6162shouldBeInvalid('2009');
    6263
     64// Disabled
     65shouldBeValid('invalid', true);
     66
    6367var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-number.js

    r67164 r73999  
    44i.type = 'number';
    55
    6 function check(value)
     6function check(value, disabled)
    77{
    88    i.value = value;
     9    i.disabled = !!disabled;
    910    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.' : '.');
    1112    if (!mismatch)
    1213        testPassed(resultText);
     
    6667check('1.2e10');
    6768
     69// Disabled
     70check('invalid', true);
     71
    6872var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js

    r51163 r73999  
    33i.type = 'time';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    1516}
    1617
    17 function shouldBeValid(value)
     18function shouldBeValid(value, disabled)
    1819{
    19     check(value, false);
     20    check(value, false, disabled);
    2021}
    2122
     
    5960shouldBeInvalid('23:45:06.789abc');
    6061
     62// Disabled
     63shouldBeValid('invalid', true);
     64
    6165var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js

    r51799 r73999  
    11description("Input type=url validation test");
    22
    3 function check(value, mismatchExpected) {
     3function check(value, mismatchExpected, disabled) {
    44    i.value = value;
     5    i.disabled = !!disabled;
    56    var actual = i.validity.typeMismatch;
    67    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.' : '.');
    89    if (didPass)
    910        testPassed(resultText);
     
    1213}
    1314
    14 function expectValid(value) {
    15     check(value, false);
     15function expectValid(value, disabled) {
     16    check(value, false, disabled);
    1617}
    1718
     
    7879}
    7980
     81// Disabled
     82expectValid('invalid', true);
     83
    8084var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-week.js

    r66355 r73999  
    33i.type = 'week';
    44
    5 function check(value, mismatchExpected)
     5function check(value, mismatchExpected, disabled)
    66{
    77    i.value = value;
     8    i.disabled = !!disabled;
    89    var actual = i.validity.typeMismatch;
    910    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.' : '.');
    1112    if (didPass)
    1213        testPassed(resultText);
     
    1516}
    1617
    17 function shouldBeValid(value)
     18function shouldBeValid(value, disabled)
    1819{
    19     check(value, false);
     20    check(value, false, disabled);
    2021}
    2122
     
    5758shouldBeInvalid('2009');
    5859
     60// Disabled
     61shouldBeValid('invalid', true);
     62
    5963var successfullyParsed = true;
  • trunk/LayoutTests/fast/forms/script-tests/willvalidate.js

    r73686 r73999  
    5555shouldBeTrue('input.willValidate');
    5656shouldBeFalse('input.type = "button"; input.willValidate');
    57 shouldBeFalse('input.type = "submit"; input.willValidate');
     57shouldBeTrue('input.type = "submit"; input.willValidate');
    5858shouldBeFalse('input.type = "hidden"; input.willValidate');
    5959shouldBeFalse('input.type = "reset"; input.willValidate');
  • trunk/LayoutTests/fast/forms/willvalidate-expected.txt

    r73686 r73999  
    3131PASS input.willValidate is true
    3232PASS input.type = "button"; input.willValidate is false
    33 PASS input.type = "submit"; input.willValidate is false
     33PASS input.type = "submit"; input.willValidate is true
    3434PASS input.type = "hidden"; input.willValidate is false
    3535PASS input.type = "reset"; input.willValidate is false
  • trunk/WebCore/ChangeLog

    r73997 r73999  
     12010-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
    1302010-12-13  Noel Gordon  <noel.gordon@gmail.com>
    231
  • trunk/WebCore/html/HTMLButtonElement.cpp

    r72038 r73999  
    8989        else
    9090            m_type = SUBMIT;
     91        setNeedsWillValidateCheck();
    9192    } else if (attr->name() == alignAttr) {
    9293        // Don't map 'align' attribute.  This matches what Firefox and IE do, but not Opera.
     
    181182}
    182183
     184bool HTMLButtonElement::recalcWillValidate() const
     185{
     186    return m_type == SUBMIT && HTMLFormControlElement::recalcWillValidate();
     187}
     188
    183189} // namespace
  • trunk/WebCore/html/HTMLButtonElement.h

    r72038 r73999  
    6060
    6161    virtual bool isOptionalFormControl() const { return true; }
    62     virtual bool recalcWillValidate() const { return false; }
     62    virtual bool recalcWillValidate() const;
    6363
    6464    Type m_type;
  • trunk/WebCore/html/SubmitInputType.cpp

    r72059 r73999  
    5757}
    5858
    59 bool SubmitInputType::supportsValidation() const
     59bool SubmitInputType::supportsRequired() const
    6060{
    6161    return false;
  • trunk/WebCore/html/SubmitInputType.h

    r72059 r73999  
    4444    virtual const AtomicString& formControlType() const;
    4545    virtual bool appendFormData(FormDataList&, bool) const;
    46     virtual bool supportsValidation() const;
     46    virtual bool supportsRequired() const;
    4747    virtual bool handleDOMActivateEvent(Event*);
    4848};
  • trunk/WebCore/html/ValidityState.cpp

    r73606 r73999  
    127127bool ValidityState::typeMismatch() const
    128128{
    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();
    132136}
    133137
    134138bool ValidityState::patternMismatch() const
    135139{
    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);
    139147    return input->patternMismatch(input->value());
    140148}
     
    142150bool ValidityState::tooLong() const
    143151{
    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);
    146158        return input->tooLong(input->value(), HTMLTextFormControlElement::CheckDirtyFlag);
    147159    }
    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);
    150162        return textArea->tooLong(textArea->value(), HTMLTextFormControlElement::CheckDirtyFlag);
    151163    }
     
    155167bool ValidityState::rangeUnderflow() const
    156168{
    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);
    160176    return input->rangeUnderflow(input->value());
    161177}
     
    163179bool ValidityState::rangeOverflow() const
    164180{
    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);
    168188    return input->rangeOverflow(input->value());
    169189}
     
    171191bool ValidityState::stepMismatch() const
    172192{
    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);
    176200    return input->stepMismatch(input->value());
     201}
     202
     203bool ValidityState::customError() const
     204{
     205    HTMLElement* element = toHTMLElement(m_control);
     206    return element->willValidate() && !m_customErrorMessage.isEmpty();
    177207}
    178208
  • trunk/WebCore/html/ValidityState.h

    r73430 r73999  
    5151    bool rangeOverflow() const;
    5252    bool stepMismatch() const;
    53     bool customError() const { return !m_customErrorMessage.isEmpty(); }
     53    bool customError() const;
    5454    bool valid() const;
    5555
Note: See TracChangeset for help on using the changeset viewer.