[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 18:35:11 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e661a00ec5e28ae4443a389f35660a05b2a5975a
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 14 05:19:30 2010 +0000
2010-12-13 Dai Mikurube <dmikurube at 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 at 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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 685b718..3c6010d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,80 @@
+2010-12-13 Dai Mikurube <dmikurube at 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 Brian Weinstein <bweinstein at apple.com>
Rebaseline Windows test results after r73993. All of these results were updated on the Mac with this
diff --git a/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt b/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt
index 13f364c..f887260 100644
--- a/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt
+++ b/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt
@@ -1,8 +1,14 @@
-All controls should have a green background.
+This test checks the CSS pseudoclasses for input types.
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS isOptional("range") is true
+PASS isOptional("submit") is true
+PASS isOptional("image") is true
+PASS isOptional("reset") is true
+PASS isOptional("button") is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
-SUCCESS
-SUCCESS
-SUCCESS
-SUCCESS
-SUCCESS
diff --git a/LayoutTests/fast/css/pseudo-required-optional-005.html b/LayoutTests/fast/css/pseudo-required-optional-005.html
index 25ab445..2c2018f 100644
--- a/LayoutTests/fast/css/pseudo-required-optional-005.html
+++ b/LayoutTests/fast/css/pseudo-required-optional-005.html
@@ -1,38 +1,34 @@
<html>
<head>
<title>required/optional CSS pseudoclasses part 5</title>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
<style>
input:optional { background: lime; }
input { background: red; }
input:required { background: red; }
</style>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<input id="range" type="range" required/>
+<input id="submit" type="submit" required/>
+<input id="image" type="image" required/>
+<input id="reset" type="reset" required/>
+<input id="button" type="button" required/>
<script language="JavaScript" type="text/javascript">
- function log(message) {
- document.getElementById("console").innerHTML += "<li>"+message+"</li>";
- }
-
- function test() {
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
-
- v = document.getElementsByName("victim");
-
- for (i = 0; i < v.length; i++)
- if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == "rgb(0, 255, 0)")
- log("SUCCESS");
- else
- log("FAILURE");
- }
+function isOptional(id) {
+ return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('background-color') == "rgb(0, 255, 0)"
+}
+description('This test checks the CSS pseudoclasses for input types.');
+shouldBeTrue('isOptional("range")');
+shouldBeTrue('isOptional("submit")');
+shouldBeTrue('isOptional("image")');
+shouldBeTrue('isOptional("reset")');
+shouldBeTrue('isOptional("button")');
+var successfullyParsed = true;
</script>
-</head>
-<body onload="test()">
-<p>All controls should have a green background.</p>
-<input type="range" name="victim" required/>
-<input type="submit" name="victim" required/>
-<input type="image" name="victim" required/>
-<input type="reset" name="victim" required/>
-<input type="button" name="victim" required/>
-<hr>
-<ol id="console"></ol>
+<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
diff --git a/LayoutTests/fast/css/pseudo-valid-001-expected.txt b/LayoutTests/fast/css/pseudo-valid-001-expected.txt
index f3d8c0d..f514d9e 100644
--- a/LayoutTests/fast/css/pseudo-valid-001-expected.txt
+++ b/LayoutTests/fast/css/pseudo-valid-001-expected.txt
@@ -1,9 +1,11 @@
-This test performs a check for the :valid CSS selector on various input elements.
+This test performs a check for the :valid CSS selector on various input and button elements.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
+
+PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
+PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
PASS document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
diff --git a/LayoutTests/fast/css/pseudo-valid-001.html b/LayoutTests/fast/css/pseudo-valid-001.html
index a1392d7..a3008fb 100644
--- a/LayoutTests/fast/css/pseudo-valid-001.html
+++ b/LayoutTests/fast/css/pseudo-valid-001.html
@@ -15,10 +15,12 @@
<input name="victim" type="text" value="Lorem ipsum"/>
<input name="victim" type="text" value="Lorem ipsum" required/>
<input name="victim" type="text" value="Lorem ipsum" pattern="Lorem ipsum"/>
+<input name="victim" type="submit">
+<button name="victim"></button>
</form>
<div id="console"></div>
<script>
-description("This test performs a check for the :valid CSS selector on various input elements.");
+description("This test performs a check for the :valid CSS selector on various input and button elements.");
v = document.getElementsByName("victim");
for (i = 0; i < v.length; i++)
diff --git a/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt b/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt
index 6723665..0e658e9 100644
--- a/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt
+++ b/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt
@@ -8,11 +8,11 @@ PASS getBackgroundColor('input-text-disabled') is normalColor
PASS getBackgroundColor('input-button') is normalColor
PASS getBackgroundColor('input-reset') is normalColor
PASS getBackgroundColor('input-hidden') is normalColor
-PASS getBackgroundColor('input-submit') is normalColor
PASS getBackgroundColor('input-image') is normalColor
PASS getBackgroundColor('fieldset') is normalColor
PASS getBackgroundColor('object') is normalColor
-PASS getBackgroundColor('button') is normalColor
+PASS getBackgroundColor('button-button') is normalColor
+PASS getBackgroundColor('button-reset') is normalColor
PASS getBackgroundColor('progress') is normalColor
PASS getBackgroundColor('meter') is normalColor
PASS successfullyParsed is true
diff --git a/LayoutTests/fast/css/pseudo-valid-unapplied.html b/LayoutTests/fast/css/pseudo-valid-unapplied.html
index 18dae81..13098db 100644
--- a/LayoutTests/fast/css/pseudo-valid-unapplied.html
+++ b/LayoutTests/fast/css/pseudo-valid-unapplied.html
@@ -22,11 +22,11 @@
<input name="input-button" type="button" value="Lorem ipsum">
<input name="input-reset" type="reset" value="Lorem ipsum"/>
<input name="input-hidden" type="hidden" value="Lorem ipsum"/>
-<input name="input-submit" type="submit">
<input name="input-image" type="image">
<fieldset name="fieldset"></fieldset>
<object name="object"></object>
-<button name="button">Lorem ipsum</button>
+<button name="button-button" type="button">Lorem ipsum</button>
+<button name="button-reset" type="reset">Lorem ipsum</button>
<progress id="progress" value=50 max=100>50</progress>
<meter id="meter" value=50 max=100>50</meter>
</form>
@@ -46,11 +46,11 @@ var names = [
"input-button",
"input-reset",
"input-hidden",
- "input-submit",
"input-image",
"fieldset",
"object",
- "button",
+ "button-button",
+ "button-reset",
"progress",
"meter",
];
diff --git a/LayoutTests/fast/forms/ValidityState-customError-expected.txt b/LayoutTests/fast/forms/ValidityState-customError-expected.txt
index 940a3b7..f8d04bc 100644
--- a/LayoutTests/fast/forms/ValidityState-customError-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-customError-expected.txt
@@ -4,10 +4,10 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Set some value for customError.
-PASS customErrorFor("fieldset-set") is true
+PASS customErrorFor("fieldset-set") is false
PASS customErrorFor("button-set") is true
-PASS customErrorFor("button-button-set") is true
-PASS customErrorFor("button-reset-set") is true
+PASS customErrorFor("button-button-set") is false
+PASS customErrorFor("button-reset-set") is false
PASS customErrorFor("select-set") is true
PASS customErrorFor("textarea-set") is true
PASS customErrorFor("input-set") is true
@@ -44,10 +44,10 @@ PASS customErrorFor("textarea-many-changes") is false
PASS customErrorFor("input-many-changes") is false
PASS customErrorFor("input-submit-many-changes") is false
Set with three arguments.
-PASS customErrorFor("fieldset-many-changes") is true
+PASS customErrorFor("fieldset-many-changes") is false
PASS customErrorFor("button-many-changes") is true
-PASS customErrorFor("button-button-many-changes") is true
-PASS customErrorFor("button-reset-many-changes") is true
+PASS customErrorFor("button-button-many-changes") is false
+PASS customErrorFor("button-reset-many-changes") is false
PASS customErrorFor("select-many-changes") is true
PASS customErrorFor("textarea-many-changes") is true
PASS customErrorFor("input-many-changes") is true
diff --git a/LayoutTests/fast/forms/ValidityState-customError.html b/LayoutTests/fast/forms/ValidityState-customError.html
index 6de7a3c..e873f98 100644
--- a/LayoutTests/fast/forms/ValidityState-customError.html
+++ b/LayoutTests/fast/forms/ValidityState-customError.html
@@ -55,10 +55,10 @@ debug('Set some value for customError.');
v = document.getElementsByName("set");
for (i = 0; i < v.length; i++)
v[i].setCustomValidity("Custom validation message");
-shouldBeTrue('customErrorFor("fieldset-set")');
+shouldBeFalse('customErrorFor("fieldset-set")');
shouldBeTrue('customErrorFor("button-set")');
-shouldBeTrue('customErrorFor("button-button-set")');
-shouldBeTrue('customErrorFor("button-reset-set")');
+shouldBeFalse('customErrorFor("button-button-set")');
+shouldBeFalse('customErrorFor("button-reset-set")');
shouldBeTrue('customErrorFor("select-set")');
shouldBeTrue('customErrorFor("textarea-set")');
shouldBeTrue('customErrorFor("input-set")');
@@ -111,10 +111,10 @@ shouldBeFalse('customErrorFor("input-submit-many-changes")');
debug('Set with three arguments.');
for (i = 0; i < v.length; i++)
v[i].setCustomValidity("one", "two", "three");
-shouldBeTrue('customErrorFor("fieldset-many-changes")');
+shouldBeFalse('customErrorFor("fieldset-many-changes")');
shouldBeTrue('customErrorFor("button-many-changes")');
-shouldBeTrue('customErrorFor("button-button-many-changes")');
-shouldBeTrue('customErrorFor("button-reset-many-changes")');
+shouldBeFalse('customErrorFor("button-button-many-changes")');
+shouldBeFalse('customErrorFor("button-reset-many-changes")');
shouldBeTrue('customErrorFor("select-many-changes")');
shouldBeTrue('customErrorFor("textarea-many-changes")');
shouldBeTrue('customErrorFor("input-many-changes")');
diff --git a/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt b/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt
index 9e9f3da..90e849f 100644
--- a/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt
@@ -50,7 +50,7 @@ PASS patternMismatchFor("mismatch-18") is true
PASS patternMismatchFor("mismatch-19") is true
PASS patternMismatchFor("mismatch-20") is true
PASS patternMismatchFor("empty-pattern") is false
-PASS patternMismatchFor("disabled") is true
+PASS patternMismatchFor("disabled") is false
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-patternMismatch.html b/LayoutTests/fast/forms/ValidityState-patternMismatch.html
index 5a7bf3d..0372e10 100644
--- a/LayoutTests/fast/forms/ValidityState-patternMismatch.html
+++ b/LayoutTests/fast/forms/ValidityState-patternMismatch.html
@@ -114,7 +114,7 @@ shouldBeTrue('patternMismatchFor("mismatch-20")');
shouldBeFalse('patternMismatchFor("empty-pattern")');
-shouldBeTrue('patternMismatchFor("disabled")');
+shouldBeFalse('patternMismatchFor("disabled")');
var successfullyParsed = true;
</script>
diff --git a/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt b/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt
index 57fc3c2..89cdd84 100644
--- a/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-rangeOverflow-expected.txt
@@ -18,6 +18,7 @@ PASS The value "2010-01-27" doesn't overflow the maximum value "0000-01-01".
PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
PASS The value "9999-01-01" overflows the maximum value "2010-12-31".
PASS The value "2010-01-27" overflows the maximum value "2010-01-26".
+PASS The value "9999-01-01" doesn't overflow the maximum value "2010-12-31" when disabled.
Type=datetime
PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "".
@@ -31,6 +32,7 @@ PASS The value "2010-01-27T12:34Z" doesn't overflow the maximum value "0000-01-0
PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:33:59.999Z".
PASS The value "9999-01-01T23:59Z" overflows the maximum value "2010-12-31T00:00Z".
PASS The value "2010-01-27T12:34Z" overflows the maximum value "2010-01-26T12:34Z".
+PASS The value "9999-01-01T23:59Z" doesn't overflow the maximum value "2010-12-31T00:00Z" when disabled.
Type=datetime-local
PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "".
@@ -44,6 +46,7 @@ PASS The value "2010-01-27T12:34" doesn't overflow the maximum value "0000-01-01
PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:33:59.999".
PASS The value "9999-01-01T23:59" overflows the maximum value "2010-12-31T00:00".
PASS The value "2010-01-27T12:34" overflows the maximum value "2010-01-26T12:34".
+PASS The value "9999-01-01T23:59" doesn't overflow the maximum value "2010-12-31T00:00" when disabled.
Type=month
PASS The value "2010-01" doesn't overflow the maximum value "".
@@ -57,6 +60,7 @@ PASS The value "2010-01" doesn't overflow the maximum value "0000-01".
PASS The value "2010-01" overflows the maximum value "2009-12".
PASS The value "9999-01" overflows the maximum value "2010-12".
PASS The value "2010-01" overflows the maximum value "2009-12".
+PASS The value "9999-01" doesn't overflow the maximum value "2010-12" when disabled.
Type=number
PASS The value "99" doesn't overflow the maximum value "100".
@@ -72,6 +76,7 @@ PASS The value "101" overflows the maximum value "100".
PASS The value "-99" overflows the maximum value "-100".
PASS The value "101" overflows the maximum value "1E+2".
PASS The value "101" overflows the maximum value "100".
+PASS The value "101" doesn't overflow the maximum value "1E+2" when disabled.
Type=time
PASS The value "13:16" doesn't overflow the maximum value "".
@@ -84,6 +89,7 @@ PASS The value "foo" doesn't overflow the maximum value "13:16".
PASS The value "13:16" overflows the maximum value "13:15".
PASS The value "23:59:59.999" overflows the maximum value "13:16".
PASS The value "13:16" overflows the maximum value "12:00".
+PASS The value "23:59:59.999" doesn't overflow the maximum value "13:16" when disabled.
Type=week
PASS The value "2010-W01" doesn't overflow the maximum value "".
@@ -98,6 +104,7 @@ PASS The value "2010-W01" overflows the maximum value "1582-W01".
PASS The value "2010-W01" overflows the maximum value "2009-W12".
PASS The value "9999-W01" overflows the maximum value "2010-W12".
PASS The value "2010-W01" overflows the maximum value "2009-W50".
+PASS The value "9999-W01" doesn't overflow the maximum value "2010-W12" when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt b/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt
index 64d9d8c..0af7920 100644
--- a/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-rangeUnderflow-expected.txt
@@ -18,6 +18,7 @@ PASS The value "foo" doesn't underflow the minimum value "2011-01-26".
PASS The value "2010-01-27" undeflows the minimum value "2010-01-28".
PASS The value "9999-01-01" undeflows the minimum value "10000-12-31".
PASS The value "2010-01-27" undeflows the minimum value "2010-02-01".
+PASS The value "9999-01-01" doesn't underflow the minimum value "10000-12-31" when disabled.
Type=datetime
PASS The value "2010-01-27T12:34Z" doesn't underflow the minimum value "".
@@ -31,6 +32,7 @@ PASS The value "foo" doesn't underflow the minimum value "2011-01-26T00:00Z".
PASS The value "2010-01-27T12:34Z" undeflows the minimum value "2010-01-27T13:00Z".
PASS The value "9999-01-01T12:00Z" undeflows the minimum value "10000-12-31T12:00Z".
PASS The value "2010-01-27T12:00Z" undeflows the minimum value "2010-02-01T12:00Z".
+PASS The value "9999-01-01T12:00Z" doesn't underflow the minimum value "10000-12-31T12:00Z" when disabled.
Type=datetime-local
PASS The value "2010-01-27T12:34" doesn't underflow the minimum value "".
@@ -44,6 +46,7 @@ PASS The value "foo" doesn't underflow the minimum value "2011-01-26T00:00".
PASS The value "2010-01-27T12:34" undeflows the minimum value "2010-01-27T13:00".
PASS The value "9999-01-01T12:00" undeflows the minimum value "10000-12-31T12:00".
PASS The value "2010-01-27T12:00" undeflows the minimum value "2010-02-01T12:00".
+PASS The value "9999-01-01T12:00" doesn't underflow the minimum value "10000-12-31T12:00" when disabled.
Type=month
PASS The value "2010-01" doesn't underflow the minimum value "".
@@ -57,6 +60,7 @@ PASS The value "foo" doesn't underflow the minimum value "2011-01".
PASS The value "2010-01" undeflows the minimum value "2010-02".
PASS The value "9999-01" undeflows the minimum value "10000-12".
PASS The value "2010-01" undeflows the minimum value "2010-02".
+PASS The value "9999-01" doesn't underflow the minimum value "10000-12" when disabled.
Type=number
PASS The value "101" doesn't underflow the minimum value "100".
@@ -72,6 +76,7 @@ PASS The value "99" undeflows the minimum value "100".
PASS The value "-101" undeflows the minimum value "-100".
PASS The value "99" undeflows the minimum value "1E+2".
PASS The value "101" undeflows the minimum value "200".
+PASS The value "99" doesn't underflow the minimum value "1E+2" when disabled.
Type=time
PASS The value "13:16" doesn't underflow the minimum value "".
@@ -85,6 +90,7 @@ PASS The value "foo" doesn't underflow the minimum value "11:00".
PASS The value "13:16" undeflows the minimum value "13:17".
PASS The value "23:59" undeflows the minimum value "23:59:30".
PASS The value "13:16" undeflows the minimum value "14:00".
+PASS The value "23:59" doesn't underflow the minimum value "23:59:30" when disabled.
Type=week
PASS The value "2010-W01" doesn't underflow the minimum value "".
@@ -98,6 +104,7 @@ PASS The value "foo" doesn't underflow the minimum value "2011-W01".
PASS The value "2010-W01" undeflows the minimum value "2010-W02".
PASS The value "9999-W01" undeflows the minimum value "10000-W12".
PASS The value "2010-W01" undeflows the minimum value "2010-W02".
+PASS The value "9999-W01" doesn't underflow the minimum value "10000-W12" when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt b/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
index aa129a6..466fec7 100644
--- a/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
@@ -29,6 +29,8 @@ PASS stepMismatchFor("2010-02-10", "-1", "2010-02-09") is false
PASS stepMismatchFor("2010-02-10", "foo", "2010-02-09") is false
Special step value
PASS stepMismatchFor("2010-02-10", "any", "2010-02-09") is false
+Disabled
+PASS stepMismatchFor("2010-02-10", "2", "2010-02-09", true) is false
Datetime type
Empty values
@@ -59,6 +61,8 @@ PASS stepMismatchFor("2010-02-10T12:34Z", "-1", "2010-02-09T12:34Z") is false
PASS stepMismatchFor("2010-02-10T12:34Z", "foo", "2010-02-09T12:34Z") is false
Special step value
PASS stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z") is false
+Disabled
+PASS stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true) is false
Datetime-local type
Empty values
@@ -89,6 +93,8 @@ PASS stepMismatchFor("2010-02-10T12:34", "-1", "2010-02-09T12:34") is false
PASS stepMismatchFor("2010-02-10T12:34", "foo", "2010-02-09T12:34") is false
Special step value
PASS stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34") is false
+Disabled
+PASS stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true) is false
Month type
Empty values
@@ -116,6 +122,8 @@ PASS stepMismatchFor("2010-03", "-1", "2010-02") is false
PASS stepMismatchFor("2010-03", "foo", "2010-02") is false
Special step value
PASS stepMismatchFor("2010-03", "any", "2010-02") is false
+Disabled
+PASS stepMismatchFor("2010-03", "2", "2010-02", true) is false
Number type
Empty values
@@ -144,6 +152,8 @@ PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false
PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false
Rounding
PASS stepMismatchFor("5.005", "0.005", "4") is false
+Disabled
+PASS stepMismatchFor("1", "2", "0", true) is false
Range type
Empty values
@@ -170,6 +180,8 @@ PASS stepMismatchFor("0.9", "0.1", "") is false
PASS stepMismatchFor("0.9", "0.1000001", "") is false
PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false
PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false
+Disabled
+PASS stepMismatchFor("1", "2", "0", true) is false
Time type
Empty values
@@ -198,6 +210,8 @@ PASS stepMismatchFor("12:34", "-1", "12:34") is false
PASS stepMismatchFor("12:34", "foo", "12:34") is false
Special step value
PASS stepMismatchFor("12:35", "any", "12:34") is false
+Disabled
+PASS stepMismatchFor("12:34:55.001", "1", "12:34:56", true) is false
Week type
Empty values
@@ -227,6 +241,8 @@ PASS stepMismatchFor("2010-W03", "-1", "2010-W02") is false
PASS stepMismatchFor("2010-W03", "foo", "2010-W02") is false
Special step value
PASS stepMismatchFor("2010-W03", "any", "2010-W02") is false
+Disabled
+PASS stepMismatchFor("2010-W03", "2", "2010-W02", true) is false
Unsupported types
PASS input.type = "text"; input.step = "3"; input.min = ""; input.value = "2"; input.validity.stepMismatch is false
diff --git a/LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt b/LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt
index e81db3a..395cde5 100644
--- a/LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt
@@ -20,6 +20,9 @@ PASS input.validity.tooLong is false
Sets a value via DOM property
PASS input.validity.tooLong is true
+Disabled
+PASS input.validity.tooLong is false
+
Grapheme length is not greater than maxLength though character length is greater
PASS input.validity.tooLong is false
diff --git a/LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt b/LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt
index 947d428..e5e2b0b 100644
--- a/LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt
@@ -20,6 +20,9 @@ PASS textarea.validity.tooLong is false
Sets a value via DOM property
PASS textarea.validity.tooLong is true
+Disabled
+PASS textarea.validity.tooLong is false
+
Grapheme length is not greater than maxLength though character length is greater
PASS textarea.validity.tooLong is false
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-color-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-color-expected.txt
index 1db07f5..cd70505 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-color-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-color-expected.txt
@@ -27,6 +27,7 @@ PASS "#00112233" is a correct invalid color.
PASS "rgb(0,0,0)" is a correct invalid color.
PASS "xxx-non-existent-color-name" is a correct invalid color.
PASS "transparent" is a correct invalid color.
+PASS "invalid" is a correct valid color when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt
index 46febff..7470ebf 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt
@@ -56,6 +56,7 @@ PASS "2009-09-001" is a correct invalid date string.
PASS "2009-09-xx" is a correct invalid date string.
PASS "2009-09" is a correct invalid date string.
PASS "2009" is a correct invalid date string.
+PASS "2009-09" is a correct valid date string when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-datetime-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-datetime-expected.txt
index 67a4866..9f099b4 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-datetime-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-datetime-expected.txt
@@ -34,6 +34,7 @@ PASS "2009-09-07T16:49-23:60" is a correct invalid datetime string.
PASS "0000-12-31T23:59:59Z" is a correct invalid datetime string.
PASS "2147483647-12-31T23:59-00:01" is a correct invalid datetime string.
PASS "2147483648-01-01T00:00:00Z" is a correct invalid datetime string.
+PASS "invalid" is a correct valid datetime string when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt
index 5472469..7bd4347 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-datetimelocal-expected.txt
@@ -20,6 +20,7 @@ PASS "a" is a correct invalid datetime-local string.
PASS "-1-09-07T16:49" is a correct invalid datetime-local string.
PASS "0000-12-31T23:59:59.999" is a correct invalid datetime-local string.
PASS "275760-09-13T00:00:00.001" is a correct invalid datetime-local string.
+PASS "invalid" is a correct valid datetime-local string when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-month-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-month-expected.txt
index 2f01b93..e0aa3c2 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-month-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-month-expected.txt
@@ -35,6 +35,7 @@ PASS "2009-9" is a correct invalid month string.
PASS "2009-009" is a correct invalid month string.
PASS "2009-xx" is a correct invalid month string.
PASS "2009" is a correct invalid month string.
+PASS "invalid" is a correct valid month string when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-number-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-number-expected.txt
index af3cf5e..f56183a 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-number-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-number-expected.txt
@@ -31,6 +31,7 @@ PASS "" is a valid number.
PASS "1.2E65535" was sanitized to "".
PASS "1." is a valid number.
PASS "1.2e10" is a valid number.
+PASS "invalid" is a valid number when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt
index 8f5b388..6b57282 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-time-expected.txt
@@ -33,6 +33,7 @@ PASS "23:45:zz" is a correct invalid time string.
PASS "23:45:06." is a correct invalid time string.
PASS "23:45:06.abc" is a correct invalid time string.
PASS "23:45:06.789abc" is a correct invalid time string.
+PASS "invalid" is a correct valid time string when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-url-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-url-expected.txt
index 56fde01..690a192 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-url-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-url-expected.txt
@@ -42,6 +42,7 @@ PASS http://www .google.com is a correct invalid url.
PASS http://www. google. com is a correct invalid url.
PASS http://host+ is a correct invalid url.
PASS http://myurl! is a correct invalid url.
+PASS invalid is a correct valid url when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/ValidityState-typeMismatch-week-expected.txt b/LayoutTests/fast/forms/ValidityState-typeMismatch-week-expected.txt
index 2ff27dc..eece715 100644
--- a/LayoutTests/fast/forms/ValidityState-typeMismatch-week-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-typeMismatch-week-expected.txt
@@ -31,6 +31,7 @@ PASS "2009/09" is a correct invalid week string.
PASS "200909" is a correct invalid week string.
PASS "2009-Wxx" is a correct invalid week string.
PASS "2009" is a correct invalid week string.
+PASS "invalid" is a correct valid week string when disabled.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js b/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js
index a059d02..a21233a 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-rangeOverflow.js
@@ -2,28 +2,30 @@ description('This test aims to check for rangeOverflow flag with input fields');
var input = document.createElement('input');
-function checkOverflow(value, max)
+function checkOverflow(value, max, disabled)
{
input.value = value;
input.max = max;
+ input.disabled = !!disabled;
var overflow = input.validity.rangeOverflow;
var resultText = 'The value "' + input.value + '" ' +
(overflow ? 'overflows' : 'doesn\'t overflow') +
- ' the maximum value "' + input.max + '".';
+ ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
if (overflow)
testPassed(resultText);
else
testFailed(resultText);
}
-function checkNotOverflow(value, max)
+function checkNotOverflow(value, max, disabled)
{
input.value = value;
input.max = max;
+ input.disabled = !!disabled;
var overflow = input.validity.rangeOverflow;
var resultText = 'The value "' + input.value + '" ' +
(overflow ? 'overflows' : 'doesn\'t overflow') +
- ' the maximum value "' + input.max + '".';
+ ' the maximum value "' + input.max + '"' + (disabled ? ' when disabled.' : '.');
if (overflow)
testFailed(resultText);
else
@@ -56,6 +58,9 @@ checkOverflow('9999-01-01', '2010-12-31');
input.min = '2010-01-28'; // value < min && value > max
checkOverflow('2010-01-27', '2010-01-26');
+// Disabled
+checkNotOverflow('9999-01-01', '2010-12-31', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=datetime');
@@ -77,6 +82,9 @@ checkOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z');
input.min = '2010-01-28T12:00Z'; // value < min && value > max
checkOverflow('2010-01-27T12:34Z', '2010-01-26T12:34Z');
+// Disabled
+checkNotOverflow('9999-01-01T23:59Z', '2010-12-31T00:00Z', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=datetime-local');
@@ -98,6 +106,9 @@ checkOverflow('9999-01-01T23:59', '2010-12-31T00:00');
input.min = '2010-01-28T12:00'; // value < min && value > max
checkOverflow('2010-01-27T12:34', '2010-01-26T12:34');
+// Disabled
+checkNotOverflow('9999-01-01T23:59', '2010-12-31T00:00', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=month');
@@ -119,6 +130,9 @@ checkOverflow('9999-01', '2010-12');
input.min = '2010-02'; // value < min && value > max
checkOverflow('2010-01', '2009-12');
+// Disabled
+checkNotOverflow('9999-01', '2010-12', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=number');
@@ -142,6 +156,9 @@ checkOverflow('101', '1E+2');
input.min = '200'; // value < min && value > max
checkOverflow('101', '100');
+// Disabled
+checkNotOverflow('101', '1E+2', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=time');
@@ -162,6 +179,9 @@ checkOverflow('23:59:59.999', '13:16');
input.min = '14:00'; // value < min && value > max
checkOverflow('13:16', '12:00');
+// Disabled
+checkNotOverflow('23:59:59.999', '13:16', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=week');
@@ -184,4 +204,7 @@ checkOverflow('9999-W01', '2010-W12');
input.min = '2010-W02'; // value < min && value > max
checkOverflow('2010-W01', '2009-W50');
+// Disabled
+checkNotOverflow('9999-W01', '2010-W12', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js b/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js
index 9e1d4a9..a3225b2 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-rangeUnderflow.js
@@ -2,28 +2,30 @@ description('This test aims to check for rangeUnderflow flag with input fields')
var input = document.createElement('input');
-function checkUnderflow(value, min)
+function checkUnderflow(value, min, disabled)
{
input.value = value;
input.min = min;
+ input.disabled = !!disabled;
var underflow = input.validity.rangeUnderflow;
var resultText = 'The value "' + input.value + '" ' +
(underflow ? 'undeflows' : 'doesn\'t underflow') +
- ' the minimum value "' + input.min + '".';
+ ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
if (underflow)
testPassed(resultText);
else
testFailed(resultText);
}
-function checkNotUnderflow(value, min)
+function checkNotUnderflow(value, min, disabled)
{
input.value = value;
input.min = min;
+ input.disabled = !!disabled;
var underflow = input.validity.rangeUnderflow;
var resultText = 'The value "' + input.value + '" ' +
(underflow ? 'underflows' : 'doesn\'t underflow') +
- ' the minimum value "' + input.min + '".';
+ ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
if (underflow)
testFailed(resultText);
else
@@ -58,6 +60,9 @@ checkUnderflow('9999-01-01', '10000-12-31');
input.max = '2010-01-01'; // value < min && value > max
checkUnderflow('2010-01-27', '2010-02-01');
+// Disabled
+checkNotUnderflow('9999-01-01', '10000-12-31', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=datetime');
@@ -81,6 +86,9 @@ checkUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z');
input.max = '2010-01-01T12:00Z'; // value < min && value > max
checkUnderflow('2010-01-27T12:00Z', '2010-02-01T12:00Z');
+// Disabled
+checkNotUnderflow('9999-01-01T12:00Z', '10000-12-31T12:00Z', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=datetime-local');
@@ -104,6 +112,9 @@ checkUnderflow('9999-01-01T12:00', '10000-12-31T12:00');
input.max = '2010-01-01T12:00'; // value < min && value > max
checkUnderflow('2010-01-27T12:00', '2010-02-01T12:00');
+// Disabled
+checkNotUnderflow('9999-01-01T12:00', '10000-12-31T12:00', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=month');
@@ -127,6 +138,9 @@ checkUnderflow('9999-01', '10000-12');
input.max = '2009-12'; // value < min && value > max
checkUnderflow('2010-01', '2010-02');
+// Disabled
+checkNotUnderflow('9999-01', '10000-12', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=number');
@@ -152,6 +166,9 @@ checkUnderflow('99', '1E+2');
input.max = '100'; // value < min && value > max
checkUnderflow('101', '200');
+// Disabled
+checkNotUnderflow('99', '1E+2', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=time');
@@ -173,6 +190,9 @@ checkUnderflow('23:59', '23:59:30');
input.max = '11:00'; // value < min && value > max
checkUnderflow('13:16', '14:00');
+// Disabled
+checkNotUnderflow('23:59', '23:59:30', true);
+
// ----------------------------------------------------------------
debug('');
debug('Type=week');
@@ -196,4 +216,7 @@ checkUnderflow('9999-W01', '10000-W12');
input.max = '2009-W52'; // value < min && value > max
checkUnderflow('2010-W01', '2010-W02');
+// Disabled
+checkNotUnderflow('9999-W01', '10000-W12', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js b/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
index 7fc5ef5..028a76e 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
@@ -3,10 +3,11 @@ description('Check stepMismatch results for type=date, datetime, datetime-local,
var input = document.createElement('input');
document.body.appendChild(input);
-function stepMismatchFor(value, step, min) {
+function stepMismatchFor(value, step, min, disabled) {
input.min = min;
input.step = step;
input.value = value;
+ input.disabled = !!disabled;
return input.validity.stepMismatch;
}
@@ -37,6 +38,8 @@ shouldBeFalse('stepMismatchFor("2010-02-10", "-1", "2010-02-09")');
shouldBeFalse('stepMismatchFor("2010-02-10", "foo", "2010-02-09")');
debug('Special step value');
shouldBeFalse('stepMismatchFor("2010-02-10", "any", "2010-02-09")');
+debug('Disabled');
+shouldBeFalse('stepMismatchFor("2010-02-10", "2", "2010-02-09", true)');
debug('');
debug('Datetime type');
@@ -69,6 +72,8 @@ shouldBeFalse('stepMismatchFor("2010-02-10T12:34Z", "-1", "2010-02-09T12:34Z")')
shouldBeFalse('stepMismatchFor("2010-02-10T12:34Z", "foo", "2010-02-09T12:34Z")');
debug('Special step value');
shouldBeFalse('stepMismatchFor("2010-02-09T12:34Z", "any", "2010-02-09T12:34Z")');
+debug('Disabled');
+shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001Z", "1", "2010-02-09T12:34:56Z", true)');
debug('');
debug('Datetime-local type');
@@ -101,6 +106,8 @@ shouldBeFalse('stepMismatchFor("2010-02-10T12:34", "-1", "2010-02-09T12:34")');
shouldBeFalse('stepMismatchFor("2010-02-10T12:34", "foo", "2010-02-09T12:34")');
debug('Special step value');
shouldBeFalse('stepMismatchFor("2010-02-09T12:34", "any", "2010-02-09T12:34")');
+debug('Disabled');
+shouldBeFalse('stepMismatchFor("2010-02-09T12:34:55.001", "1", "2010-02-09T12:34:56", true)');
debug('');
debug('Month type');
@@ -130,6 +137,8 @@ shouldBeFalse('stepMismatchFor("2010-03", "-1", "2010-02")');
shouldBeFalse('stepMismatchFor("2010-03", "foo", "2010-02")');
debug('Special step value');
shouldBeFalse('stepMismatchFor("2010-03", "any", "2010-02")');
+debug('Disabled');
+shouldBeFalse('stepMismatchFor("2010-03", "2", "2010-02", true)');
debug('');
debug('Number type');
@@ -161,6 +170,8 @@ shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false');
shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false');
debug('Rounding');
shouldBe('stepMismatchFor("5.005", "0.005", "4")', 'false');
+debug('Disabled');
+shouldBe('stepMismatchFor("1", "2", "0", true)', 'false');
debug('');
debug('Range type');
@@ -192,6 +203,8 @@ shouldBe('stepMismatchFor("0.9", "0.1", "")', 'false');
shouldBe('stepMismatchFor("0.9", "0.1000001", "")', 'false');
shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false');
shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false');
+debug('Disabled');
+shouldBe('stepMismatchFor("1", "2", "0", true)', 'false');
debug('');
debug('Time type');
@@ -222,6 +235,8 @@ shouldBeFalse('stepMismatchFor("12:34", "-1", "12:34")');
shouldBeFalse('stepMismatchFor("12:34", "foo", "12:34")');
debug('Special step value');
shouldBeFalse('stepMismatchFor("12:35", "any", "12:34")');
+debug('Disabled');
+shouldBeFalse('stepMismatchFor("12:34:55.001", "1", "12:34:56", true)');
debug('');
debug('Week type');
@@ -253,6 +268,8 @@ shouldBeFalse('stepMismatchFor("2010-W03", "-1", "2010-W02")');
shouldBeFalse('stepMismatchFor("2010-W03", "foo", "2010-W02")');
debug('Special step value');
shouldBeFalse('stepMismatchFor("2010-W03", "any", "2010-W02")');
+debug('Disabled');
+shouldBeFalse('stepMismatchFor("2010-W03", "2", "2010-W02", true)');
debug('');
debug('Unsupported types');
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js b/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
index ae00ac9..fbb67e6 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
@@ -39,6 +39,12 @@ input.value = 'abcde';
shouldBeTrue('input.validity.tooLong');
debug('');
+debug('Disabled');
+input.disabled = true;
+shouldBeFalse('input.validity.tooLong');
+input.disabled = false;
+
+debug('');
debug('Grapheme length is not greater than maxLength though character length is greater');
// fancyX should be treated as 1 grapheme.
// U+0305 COMBINING OVERLINE
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js b/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
index a748d88..e3b8461 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
@@ -41,6 +41,12 @@ textarea.value = 'abcde';
shouldBeTrue('textarea.validity.tooLong');
debug('');
+debug('Disabled');
+textarea.disabled = true;
+shouldBeFalse('textarea.validity.tooLong');
+textarea.disabled = false;
+
+debug('');
debug('Grapheme length is not greater than maxLength though character length is greater');
// fancyX should be treated as 1 grapheme.
// U+0305 COMBINING OVERLINE
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-color.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-color.js
index bfda501..9293692 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-color.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-color.js
@@ -2,12 +2,13 @@ description('This test aims to check for typeMismatch flag with type=color input
var i = document.createElement('input');
i.type = 'color';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' color.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' color' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
@@ -44,4 +45,7 @@ check('rgb(0,0,0)', true);
check('xxx-non-existent-color-name', true);
check('transparent', true);
+// Disabled
+check('invalid', false, true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js
index c416473..95306e0 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-date.js
@@ -2,21 +2,22 @@ description('This test aims to check for typeMismatch flag with type=date input
var i = document.createElement('input');
i.type = 'date';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' date string.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' date string' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function shouldBeValid(value)
+function shouldBeValid(value, disabled)
{
- check(value, false);
+ check(value, false, disabled);
}
function shouldBeInvalid(value)
@@ -81,4 +82,7 @@ shouldBeInvalid('2009-09-xx');
shouldBeInvalid('2009-09');
shouldBeInvalid('2009');
+// Disabled
+shouldBeValid('2009-09', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js
index 70b088b..2a7d390 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js
@@ -2,21 +2,22 @@ description('This test aims to check for typeMismatch flag with type=datetime in
var i = document.createElement('input');
i.type = 'datetime';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime string.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime string' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function shouldBeValid(value)
+function shouldBeValid(value, disabled)
{
- check(value, false);
+ check(value, false, disabled);
}
function shouldBeInvalid(value)
@@ -59,4 +60,7 @@ shouldBeInvalid('0000-12-31T23:59:59Z');
shouldBeInvalid('2147483647-12-31T23:59-00:01');
shouldBeInvalid('2147483648-01-01T00:00:00Z');
+// Disabled
+shouldBeValid('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js
index 70b6014..a06bd53 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetimelocal.js
@@ -2,21 +2,22 @@ description('This test aims to check for typeMismatch flag with type=datetime-lo
var i = document.createElement('input');
i.type = 'datetime-local';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime-local string.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' datetime-local string' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function shouldBeValid(value)
+function shouldBeValid(value, disabled)
{
- check(value, false);
+ check(value, false, disabled);
}
function shouldBeInvalid(value)
@@ -45,4 +46,7 @@ shouldBeInvalid('-1-09-07T16:49');
shouldBeInvalid('0000-12-31T23:59:59.999');
shouldBeInvalid('275760-09-13T00:00:00.001');
+// Disabled
+shouldBeValid('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-month.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-month.js
index 3a3826a..ce0ac3d 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-month.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-month.js
@@ -2,21 +2,22 @@ description('This test aims to check for typeMismatch flag with type=month input
var i = document.createElement('input');
i.type = 'month';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' month string.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' month string' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function shouldBeValid(value)
+function shouldBeValid(value, disabled)
{
- check(value, false);
+ check(value, false, disabled);
}
function shouldBeInvalid(value)
@@ -60,4 +61,7 @@ shouldBeInvalid('2009-009');
shouldBeInvalid('2009-xx');
shouldBeInvalid('2009');
+// Disabled
+shouldBeValid('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-number.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-number.js
index 8b80c0c..682e37e 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-number.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-number.js
@@ -3,11 +3,12 @@ description('This test aims to check for typeMismatch flag with type=number inpu
var i = document.createElement('input');
i.type = 'number';
-function check(value)
+function check(value, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var mismatch = i.validity.typeMismatch;
- var resultText = '"' + value + '" is ' + (mismatch ? 'an invalid' : 'a valid') + ' number.';
+ var resultText = '"' + value + '" is ' + (mismatch ? 'an invalid' : 'a valid') + ' number' + (disabled ? ' when disabled.' : '.');
if (!mismatch)
testPassed(resultText);
else
@@ -65,4 +66,7 @@ checkSanitization('1.2E65535', '');
check('1.');
check('1.2e10');
+// Disabled
+check('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js
index 4aaded4..b99b3fe 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-time.js
@@ -2,21 +2,22 @@ description('This test aims to check for typeMismatch flag with type=time input
var i = document.createElement('input');
i.type = 'time';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' time string.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' time string' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function shouldBeValid(value)
+function shouldBeValid(value, disabled)
{
- check(value, false);
+ check(value, false, disabled);
}
function shouldBeInvalid(value)
@@ -58,4 +59,7 @@ shouldBeInvalid('23:45:06.');
shouldBeInvalid('23:45:06.abc');
shouldBeInvalid('23:45:06.789abc');
+// Disabled
+shouldBeValid('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js
index 040cd4f..74bd48f 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-url.js
@@ -1,18 +1,19 @@
description("Input type=url validation test");
-function check(value, mismatchExpected) {
+function check(value, mismatchExpected, disabled) {
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = value + ' is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' url.';
+ var resultText = value + ' is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' url' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function expectValid(value) {
- check(value, false);
+function expectValid(value, disabled) {
+ check(value, false, disabled);
}
function expectInvalid(value) {
@@ -77,4 +78,7 @@ if (strictHost) {
expectValid('http://myurl!');
}
+// Disabled
+expectValid('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-week.js b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-week.js
index 4fe0086..e35fa81 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-week.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-week.js
@@ -2,21 +2,22 @@ description('This test aims to check for typeMismatch flag with type=week input
var i = document.createElement('input');
i.type = 'week';
-function check(value, mismatchExpected)
+function check(value, mismatchExpected, disabled)
{
i.value = value;
+ i.disabled = !!disabled;
var actual = i.validity.typeMismatch;
var didPass = actual == mismatchExpected;
- var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' week string.';
+ var resultText = '"' + value + '" is ' + (didPass ? 'a correct ' : 'an incorrect ') + (actual ? 'invalid' : 'valid') + ' week string' + (disabled ? ' when disabled.' : '.');
if (didPass)
testPassed(resultText);
else
testFailed(resultText);
}
-function shouldBeValid(value)
+function shouldBeValid(value, disabled)
{
- check(value, false);
+ check(value, false, disabled);
}
function shouldBeInvalid(value)
@@ -56,4 +57,7 @@ shouldBeInvalid('200909');
shouldBeInvalid('2009-Wxx');
shouldBeInvalid('2009');
+// Disabled
+shouldBeValid('invalid', true);
+
var successfullyParsed = true;
diff --git a/LayoutTests/fast/forms/script-tests/willvalidate.js b/LayoutTests/fast/forms/script-tests/willvalidate.js
index 6f12652..4b2cd98 100644
--- a/LayoutTests/fast/forms/script-tests/willvalidate.js
+++ b/LayoutTests/fast/forms/script-tests/willvalidate.js
@@ -54,7 +54,7 @@ parent.innerHTML = '<form><input name="test"></form>';
input = document.getElementsByTagName("input")[0];
shouldBeTrue('input.willValidate');
shouldBeFalse('input.type = "button"; input.willValidate');
-shouldBeFalse('input.type = "submit"; input.willValidate');
+shouldBeTrue('input.type = "submit"; input.willValidate');
shouldBeFalse('input.type = "hidden"; input.willValidate');
shouldBeFalse('input.type = "reset"; input.willValidate');
diff --git a/LayoutTests/fast/forms/willvalidate-expected.txt b/LayoutTests/fast/forms/willvalidate-expected.txt
index 7a1c392..6a1a969 100644
--- a/LayoutTests/fast/forms/willvalidate-expected.txt
+++ b/LayoutTests/fast/forms/willvalidate-expected.txt
@@ -30,7 +30,7 @@ PASS input.willValidate is false
Input types
PASS input.willValidate is true
PASS input.type = "button"; input.willValidate is false
-PASS input.type = "submit"; input.willValidate is false
+PASS input.type = "submit"; input.willValidate is true
PASS input.type = "hidden"; input.willValidate is false
PASS input.type = "reset"; input.willValidate is false
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9f13306..5728064 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-12-13 Dai Mikurube <dmikurube at 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:
+
2010-12-13 Noel Gordon <noel.gordon at gmail.com>
Reviewed by David Levin.
diff --git a/WebCore/html/HTMLButtonElement.cpp b/WebCore/html/HTMLButtonElement.cpp
index 92fdde5..f9cab4c 100644
--- a/WebCore/html/HTMLButtonElement.cpp
+++ b/WebCore/html/HTMLButtonElement.cpp
@@ -88,6 +88,7 @@ void HTMLButtonElement::parseMappedAttribute(Attribute* attr)
m_type = BUTTON;
else
m_type = SUBMIT;
+ setNeedsWillValidateCheck();
} else if (attr->name() == alignAttr) {
// Don't map 'align' attribute. This matches what Firefox and IE do, but not Opera.
// See http://bugs.webkit.org/show_bug.cgi?id=12071
@@ -180,4 +181,9 @@ String HTMLButtonElement::value() const
return getAttribute(valueAttr);
}
+bool HTMLButtonElement::recalcWillValidate() const
+{
+ return m_type == SUBMIT && HTMLFormControlElement::recalcWillValidate();
+}
+
} // namespace
diff --git a/WebCore/html/HTMLButtonElement.h b/WebCore/html/HTMLButtonElement.h
index 97a0204..2ed5136 100644
--- a/WebCore/html/HTMLButtonElement.h
+++ b/WebCore/html/HTMLButtonElement.h
@@ -59,7 +59,7 @@ private:
virtual bool canStartSelection() const { return false; }
virtual bool isOptionalFormControl() const { return true; }
- virtual bool recalcWillValidate() const { return false; }
+ virtual bool recalcWillValidate() const;
Type m_type;
bool m_activeSubmit;
diff --git a/WebCore/html/SubmitInputType.cpp b/WebCore/html/SubmitInputType.cpp
index 2f7d97e..bad51cf 100644
--- a/WebCore/html/SubmitInputType.cpp
+++ b/WebCore/html/SubmitInputType.cpp
@@ -56,7 +56,7 @@ bool SubmitInputType::appendFormData(FormDataList& encoding, bool) const
return true;
}
-bool SubmitInputType::supportsValidation() const
+bool SubmitInputType::supportsRequired() const
{
return false;
}
diff --git a/WebCore/html/SubmitInputType.h b/WebCore/html/SubmitInputType.h
index d03219c..48642dc 100644
--- a/WebCore/html/SubmitInputType.h
+++ b/WebCore/html/SubmitInputType.h
@@ -43,7 +43,7 @@ private:
SubmitInputType(HTMLInputElement* element) : BaseButtonInputType(element) { }
virtual const AtomicString& formControlType() const;
virtual bool appendFormData(FormDataList&, bool) const;
- virtual bool supportsValidation() const;
+ virtual bool supportsRequired() const;
virtual bool handleDOMActivateEvent(Event*);
};
diff --git a/WebCore/html/ValidityState.cpp b/WebCore/html/ValidityState.cpp
index 0565035..2e65327 100644
--- a/WebCore/html/ValidityState.cpp
+++ b/WebCore/html/ValidityState.cpp
@@ -126,27 +126,39 @@ bool ValidityState::valueMissing() const
bool ValidityState::typeMismatch() const
{
- if (!toHTMLElement(m_control)->hasTagName(inputTag))
+ HTMLElement* element = toHTMLElement(m_control);
+ if (!element->willValidate())
+ return false;
+
+ if (!element->hasTagName(inputTag))
return false;
- return static_cast<HTMLInputElement*>(m_control)->typeMismatch();
+ return static_cast<HTMLInputElement*>(element)->typeMismatch();
}
bool ValidityState::patternMismatch() const
{
- if (!toHTMLElement(m_control)->hasTagName(inputTag))
+ HTMLElement* element = toHTMLElement(m_control);
+ if (!element->willValidate())
+ return false;
+
+ if (!element->hasTagName(inputTag))
return false;
- HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control);
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(element);
return input->patternMismatch(input->value());
}
bool ValidityState::tooLong() const
{
- if (toHTMLElement(m_control)->hasTagName(inputTag)) {
- HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control);
+ HTMLElement* element = toHTMLElement(m_control);
+ if (!element->willValidate())
+ return false;
+
+ if (element->hasTagName(inputTag)) {
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(element);
return input->tooLong(input->value(), HTMLTextFormControlElement::CheckDirtyFlag);
}
- if (toHTMLElement(m_control)->hasTagName(textareaTag)) {
- HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(m_control);
+ if (element->hasTagName(textareaTag)) {
+ HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(element);
return textArea->tooLong(textArea->value(), HTMLTextFormControlElement::CheckDirtyFlag);
}
return false;
@@ -154,28 +166,46 @@ bool ValidityState::tooLong() const
bool ValidityState::rangeUnderflow() const
{
- if (!toHTMLElement(m_control)->hasTagName(inputTag))
+ HTMLElement* element = toHTMLElement(m_control);
+ if (!element->willValidate())
+ return false;
+
+ if (!element->hasTagName(inputTag))
return false;
- HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control);
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(element);
return input->rangeUnderflow(input->value());
}
bool ValidityState::rangeOverflow() const
{
- if (!toHTMLElement(m_control)->hasTagName(inputTag))
+ HTMLElement* element = toHTMLElement(m_control);
+ if (!element->willValidate())
+ return false;
+
+ if (!element->hasTagName(inputTag))
return false;
- HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control);
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(element);
return input->rangeOverflow(input->value());
}
bool ValidityState::stepMismatch() const
{
- if (!toHTMLElement(m_control)->hasTagName(inputTag))
+ HTMLElement* element = toHTMLElement(m_control);
+ if (!element->willValidate())
+ return false;
+
+ if (!element->hasTagName(inputTag))
return false;
- HTMLInputElement* input = static_cast<HTMLInputElement*>(m_control);
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(element);
return input->stepMismatch(input->value());
}
+bool ValidityState::customError() const
+{
+ HTMLElement* element = toHTMLElement(m_control);
+ return element->willValidate() && !m_customErrorMessage.isEmpty();
+}
+
bool ValidityState::valid() const
{
bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow()
diff --git a/WebCore/html/ValidityState.h b/WebCore/html/ValidityState.h
index 01c26d1..e140c49 100644
--- a/WebCore/html/ValidityState.h
+++ b/WebCore/html/ValidityState.h
@@ -50,7 +50,7 @@ public:
bool rangeUnderflow() const;
bool rangeOverflow() const;
bool stepMismatch() const;
- bool customError() const { return !m_customErrorMessage.isEmpty(); }
+ bool customError() const;
bool valid() const;
private:
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list