summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-ui-invalid
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--layout/reftests/css-ui-invalid/button/button-button.html9
-rw-r--r--layout/reftests/css-ui-invalid/button/button-disabled-fieldset-1.html22
-rw-r--r--layout/reftests/css-ui-invalid/button/button-disabled-fieldset-2.html25
-rw-r--r--layout/reftests/css-ui-invalid/button/button-disabled-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/button/button-disabled.html9
-rw-r--r--layout/reftests/css-ui-invalid/button/button-dyn-disabled.html18
-rw-r--r--layout/reftests/css-ui-invalid/button/button-dyn-not-disabled.html19
-rw-r--r--layout/reftests/css-ui-invalid/button/button-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/button/button-fieldset-legend.html22
-rw-r--r--layout/reftests/css-ui-invalid/button/button-fieldset-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/button/button-invalid.html9
-rw-r--r--layout/reftests/css-ui-invalid/button/button-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/button/button-reset.html9
-rw-r--r--layout/reftests/css-ui-invalid/button/button-type-barred.html19
-rw-r--r--layout/reftests/css-ui-invalid/button/button-type-invalid.html19
-rw-r--r--layout/reftests/css-ui-invalid/button/button-valid.html9
-rw-r--r--layout/reftests/css-ui-invalid/button/reftest.list12
-rw-r--r--layout/reftests/css-ui-invalid/button/style.css18
-rw-r--r--layout/reftests/css-ui-invalid/default-style/button-focus-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/button-focus.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/button-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/button.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/fieldset-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/fieldset.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/input-focus-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/input-focus.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/input-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/input.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/output-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/output.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/reftest.list10
-rw-r--r--layout/reftests/css-ui-invalid/default-style/select-focus-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/select-focus.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/select-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/select.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/style.css11
-rw-r--r--layout/reftests/css-ui-invalid/default-style/textarea-focus-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/textarea-focus.html13
-rw-r--r--layout/reftests/css-ui-invalid/default-style/textarea-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/default-style/textarea.html13
-rw-r--r--layout/reftests/css-ui-invalid/input/input-button-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/input/input-button.html9
-rw-r--r--layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html16
-rw-r--r--layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html15
-rw-r--r--layout/reftests/css-ui-invalid/input/input-customerror.html18
-rw-r--r--layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-ui-invalid/input/input-disabled.html9
-rw-r--r--layout/reftests/css-ui-invalid/input/input-dyn-disabled.html18
-rw-r--r--layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html19
-rw-r--r--layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html9
-rw-r--r--layout/reftests/css-ui-invalid/input/input-dyn-readonly.html9
-rw-r--r--layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-email-invalid-default.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-email-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/input/input-email-valid.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-fieldset-legend.html13
-rw-r--r--layout/reftests/css-ui-invalid/input/input-fieldset-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-file-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html12
-rw-r--r--layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-pattern-valid.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-customerror.html18
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html17
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html18
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html13
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html13
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html16
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html15
-rw-r--r--layout/reftests/css-ui-invalid/input/input-radio-required.html18
-rw-r--r--layout/reftests/css-ui-invalid/input/input-readonly.html9
-rw-r--r--layout/reftests/css-ui-invalid/input/input-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-required-invalid-default.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-required-valid.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-reset.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-type-barred.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-type-invalid.html20
-rw-r--r--layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html12
-rw-r--r--layout/reftests/css-ui-invalid/input/input-url-invalid-default.html11
-rw-r--r--layout/reftests/css-ui-invalid/input/input-url-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/input/input-url-valid.html10
-rw-r--r--layout/reftests/css-ui-invalid/input/input-valid.html9
-rw-r--r--layout/reftests/css-ui-invalid/input/input-withtext-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/input/reftest.list41
-rw-r--r--layout/reftests/css-ui-invalid/input/style.css23
-rw-r--r--layout/reftests/css-ui-invalid/input/success-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/output/output-invalid.html9
-rw-r--r--layout/reftests/css-ui-invalid/output/output-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/output/output-valid.html9
-rw-r--r--layout/reftests/css-ui-invalid/output/reftest.list2
-rw-r--r--layout/reftests/css-ui-invalid/output/style.css22
-rw-r--r--layout/reftests/css-ui-invalid/reftest.list9
-rw-r--r--layout/reftests/css-ui-invalid/select/reftest.list17
-rw-r--r--layout/reftests/css-ui-invalid/select/select-disabled-fieldset-1.html22
-rw-r--r--layout/reftests/css-ui-invalid/select/select-disabled-fieldset-2.html25
-rw-r--r--layout/reftests/css-ui-invalid/select/select-disabled-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/select/select-disabled.html9
-rw-r--r--layout/reftests/css-ui-invalid/select/select-dyn-disabled.html18
-rw-r--r--layout/reftests/css-ui-invalid/select/select-dyn-not-disabled.html19
-rw-r--r--layout/reftests/css-ui-invalid/select/select-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/select/select-fieldset-legend.html22
-rw-r--r--layout/reftests/css-ui-invalid/select/select-fieldset-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/select/select-invalid-reset.html15
-rw-r--r--layout/reftests/css-ui-invalid/select/select-invalid.html10
-rw-r--r--layout/reftests/css-ui-invalid/select/select-ref.html6
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-invalid-1.html12
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-invalid-2.html12
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-invalid-changed-1.html13
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-invalid-changed-2.html13
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-multiple-invalid-changed.html15
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-multiple-invalid.html13
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-multiple-ref.html10
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-multiple-valid.html12
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-ref.html9
-rw-r--r--layout/reftests/css-ui-invalid/select/select-required-valid.html11
-rw-r--r--layout/reftests/css-ui-invalid/select/select-valid.html9
-rw-r--r--layout/reftests/css-ui-invalid/select/style.css18
-rw-r--r--layout/reftests/css-ui-invalid/textarea/reftest.list14
-rw-r--r--layout/reftests/css-ui-invalid/textarea/style.css26
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-customerror.html18
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-disabled.html9
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-dyn-disabled.html19
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-disabled.html20
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-changed.html19
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-not-changed.html18
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-dyn-readonly.html18
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend-ref.html11
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend.html14
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-fieldset-ref.html11
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-readonly.html9
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-ref.html7
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-required-invalid-changed.html19
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-required-invalid.html10
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-required-valid.html10
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-valid.html9
-rw-r--r--layout/reftests/css-ui-invalid/textarea/textarea-withtext-ref.html7
143 files changed, 1816 insertions, 0 deletions
diff --git a/layout/reftests/css-ui-invalid/button/button-button.html b/layout/reftests/css-ui-invalid/button/button-button.html
new file mode 100644
index 0000000000..b3a32a49b8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-button.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button is of the button type, it is barred from constraint
+ validation and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <button class='notinvalid' id='b' type='button'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-disabled-fieldset-1.html b/layout/reftests/css-ui-invalid/button/button-disabled-fieldset-1.html
new file mode 100644
index 0000000000..5cf40c93a9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-disabled-fieldset-1.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('b');
+ e.setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <fieldset disabled>
+ <fieldset>
+ <button class='notinvalid' id='b'></button>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-disabled-fieldset-2.html b/layout/reftests/css-ui-invalid/button/button-disabled-fieldset-2.html
new file mode 100644
index 0000000000..4ee147a707
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-disabled-fieldset-2.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onloadHandler()
+ {
+ var e = document.getElementById('b');
+ e.setCustomValidity('foo');
+ var fieldsets = document.getElementsByTagName("fieldset");
+ fieldsets[1].disabled = true;
+ fieldsets[0].disabled = false;
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <fieldset disabled>
+ <fieldset>
+ <button class='notinvalid' id='b'></button>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-disabled-ref.html b/layout/reftests/css-ui-invalid/button/button-disabled-ref.html
new file mode 100644
index 0000000000..7de1ba7c5c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-disabled-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <button style="background-color: green;" disabled></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-disabled.html b/layout/reftests/css-ui-invalid/button/button-disabled.html
new file mode 100644
index 0000000000..1607c2b645
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if button is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='notinvalid' disabled></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-dyn-disabled.html b/layout/reftests/css-ui-invalid/button/button-dyn-disabled.html
new file mode 100644
index 0000000000..1c7350d722
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-dyn-disabled.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button is disabled and invalid, it is barred from constraint
+ validation and should not be affected by :invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('b');
+ e.setCustomValidity('foo');
+ e.disabled = 'true';
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <button class='notinvalid' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-dyn-not-disabled.html b/layout/reftests/css-ui-invalid/button/button-dyn-not-disabled.html
new file mode 100644
index 0000000000..7ae667b8ec
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-dyn-not-disabled.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button is not disabled and invalid, it is candidate for
+ constraint validation and should be affected
+ by :invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('b');
+ e.setCustomValidity('foo');
+ e.removeAttribute('disabled');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <button class='invalid' id='b' disabled></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-fieldset-legend-ref.html b/layout/reftests/css-ui-invalid/button/button-fieldset-legend-ref.html
new file mode 100644
index 0000000000..22adc433cd
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-fieldset-legend-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <legend>
+ <button style="background-color: green;"></button>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-fieldset-legend.html b/layout/reftests/css-ui-invalid/button/button-fieldset-legend.html
new file mode 100644
index 0000000000..66b5ae585c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-fieldset-legend.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button has a disabled fieldset ancestor, but is in the first
+ legend, it is not barred from constraint validation and should be
+ affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('b');
+ e.setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <fieldset disabled>
+ <legend>
+ <button class='invalid' id='b'></button>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-fieldset-ref.html b/layout/reftests/css-ui-invalid/button/button-fieldset-ref.html
new file mode 100644
index 0000000000..60ab1a3ef0
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-fieldset-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <fieldset disabled>
+ <button style="background-color: green;"></button>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-invalid.html b/layout/reftests/css-ui-invalid/button/button-invalid.html
new file mode 100644
index 0000000000..2aeaea4e1e
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-invalid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button has a custom error, it should not be affected by :valid
+ pseudo-class -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <button class='invalid' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-ref.html b/layout/reftests/css-ui-invalid/button/button-ref.html
new file mode 100644
index 0000000000..422cc9315f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <button style="background-color: green;"></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-reset.html b/layout/reftests/css-ui-invalid/button/button-reset.html
new file mode 100644
index 0000000000..6e64908be8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-reset.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button is of the reset type, it is barred from constraint
+ validation and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <button class='notinvalid' id='b' type='reset'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-type-barred.html b/layout/reftests/css-ui-invalid/button/button-type-barred.html
new file mode 100644
index 0000000000..3748615427
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-type-barred.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if a button has is candidate for constraint validation then change
+ its type to be barred from constraint validation, it should not be
+ affected by :invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var b = document.getElementById('b');
+ b.setCustomValidity('foo');
+ b.type = 'button';
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="document.getElementById('b').type='button'; document.documentElement.className='';">
+ <button class='notinvalid' type='submit' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-type-invalid.html b/layout/reftests/css-ui-invalid/button/button-type-invalid.html
new file mode 100644
index 0000000000..a6e20d1a94
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-type-invalid.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if a button has a custom error when barred from constraint
+ validation then move a type candidate for constraint validation,
+ it should not be affected by :invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var b = document.getElementById('b');
+ b.setCustomValidity('foo');
+ b.type = 'submit';
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <button class='invalid' type='button' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/button-valid.html b/layout/reftests/css-ui-invalid/button/button-valid.html
new file mode 100644
index 0000000000..1f99c6331d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-valid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if button has no custom error and is not barred from constraint
+ validation, it should be affected by :invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='notinvalid'</button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/button/reftest.list b/layout/reftests/css-ui-invalid/button/reftest.list
new file mode 100644
index 0000000000..98db5f2c6c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/reftest.list
@@ -0,0 +1,12 @@
+== button-valid.html button-ref.html
+fuzzy(0-1,0-3) == button-invalid.html button-ref.html
+fuzzy(0-2,0-5) == button-disabled.html button-disabled-ref.html
+fuzzy(0-2,0-5) == button-dyn-disabled.html button-disabled-ref.html
+fuzzy(0-1,0-3) == button-dyn-not-disabled.html button-ref.html
+fuzzy(0-1,0-3) == button-button.html button-ref.html
+fuzzy(0-1,0-3) == button-reset.html button-ref.html
+fuzzy(0-1,0-3) == button-type-invalid.html button-ref.html
+fuzzy(0-1,0-3) == button-type-barred.html button-ref.html
+fuzzy(0-1,0-3) == button-disabled-fieldset-1.html button-fieldset-ref.html
+fuzzy(0-1,0-3) == button-disabled-fieldset-2.html button-fieldset-ref.html
+fuzzy(0-1,0-4) == button-fieldset-legend.html button-fieldset-legend-ref.html
diff --git a/layout/reftests/css-ui-invalid/button/style.css b/layout/reftests/css-ui-invalid/button/style.css
new file mode 100644
index 0000000000..83653cfb12
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+button:-moz-ui-invalid {
+ box-shadow: none;
+}
+
+button.notinvalid {
+ background-color: green;
+}
+button.notinvalid:-moz-ui-invalid {
+ background-color: red;
+}
+
+button.invalid {
+ background-color: red;
+}
+button.invalid:-moz-ui-invalid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-invalid/default-style/button-focus-ref.html b/layout/reftests/css-ui-invalid/default-style/button-focus-ref.html
new file mode 100644
index 0000000000..9046f5c74d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/button-focus-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('button')[0].focus();">
+ <button class='invalid-ref' onfocus="document.documentElement.className='';"></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/button-focus.html b/layout/reftests/css-ui-invalid/default-style/button-focus.html
new file mode 100644
index 0000000000..e34dad8465
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/button-focus.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.getElementById('e').focus();
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <button id='e' onfocus="document.documentElement.className='';"></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/button-ref.html b/layout/reftests/css-ui-invalid/default-style/button-ref.html
new file mode 100644
index 0000000000..71dbb9cf80
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/button-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='invalid-ref'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/button.html b/layout/reftests/css-ui-invalid/default-style/button.html
new file mode 100644
index 0000000000..3b240b7e41
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/button.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <button id='e'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/fieldset-ref.html b/layout/reftests/css-ui-invalid/default-style/fieldset-ref.html
new file mode 100644
index 0000000000..0289183246
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/fieldset-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset class='barred-ref'></fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/fieldset.html b/layout/reftests/css-ui-invalid/default-style/fieldset.html
new file mode 100644
index 0000000000..e2b3b1ac19
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/fieldset.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <fieldset id='e'></fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/input-focus-ref.html b/layout/reftests/css-ui-invalid/default-style/input-focus-ref.html
new file mode 100644
index 0000000000..1180844f60
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/input-focus-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('input')[0].focus();">
+ <input class='invalid-ref' onfocus="document.documentElement.className='';">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/input-focus.html b/layout/reftests/css-ui-invalid/default-style/input-focus.html
new file mode 100644
index 0000000000..ac9d554a42
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/input-focus.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.getElementById('e').focus();
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <input id='e' onfocus="document.documentElement.className='';">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/input-ref.html b/layout/reftests/css-ui-invalid/default-style/input-ref.html
new file mode 100644
index 0000000000..31f6e35f2c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/input-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='invalid-ref'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/input.html b/layout/reftests/css-ui-invalid/default-style/input.html
new file mode 100644
index 0000000000..e0d1bf6a3c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/input.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <input id='e'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/output-ref.html b/layout/reftests/css-ui-invalid/default-style/output-ref.html
new file mode 100644
index 0000000000..f1ab90bc64
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/output-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <output class='invalid-ref'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/output.html b/layout/reftests/css-ui-invalid/default-style/output.html
new file mode 100644
index 0000000000..6da555bbf1
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/output.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <output id='e'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/reftest.list b/layout/reftests/css-ui-invalid/default-style/reftest.list
new file mode 100644
index 0000000000..62486537a5
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/reftest.list
@@ -0,0 +1,10 @@
+== input.html input-ref.html
+fuzzy-if(isDebugBuild&&gtkWidget,0-1,0-1) fuzzy-if(cocoaWidget,0-2,0-32) == button.html button-ref.html
+== textarea.html textarea-ref.html
+fuzzy(0-112,0-6) == select.html select-ref.html
+== fieldset.html fieldset-ref.html
+== output.html output-ref.html
+random-if(winWidget) needs-focus == input-focus.html input-focus-ref.html # Intermittent failures, bug 660224
+needs-focus fuzzy-if(cocoaWidget,0-1,0-10) == button-focus.html button-focus-ref.html
+needs-focus fuzzy(0-32,0-1) == textarea-focus.html textarea-focus-ref.html
+random-if(winWidget) fuzzy(0-112,0-6) needs-focus == select-focus.html select-focus-ref.html # windows: Intermittent failures, bug 660224, non-native: shadow blur fuzziness
diff --git a/layout/reftests/css-ui-invalid/default-style/select-focus-ref.html b/layout/reftests/css-ui-invalid/default-style/select-focus-ref.html
new file mode 100644
index 0000000000..42b8da524a
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/select-focus-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('select')[0].focus();">
+ <select class='invalid-ref' onfocus="document.documentElement.className='';"></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/select-focus.html b/layout/reftests/css-ui-invalid/default-style/select-focus.html
new file mode 100644
index 0000000000..946e078152
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/select-focus.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.getElementById('e').focus();
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <select id='e' onfocus="document.documentElement.className='';"></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/select-ref.html b/layout/reftests/css-ui-invalid/default-style/select-ref.html
new file mode 100644
index 0000000000..3eed47082f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/select-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='invalid-ref'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/select.html b/layout/reftests/css-ui-invalid/default-style/select.html
new file mode 100644
index 0000000000..f05241f9e7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/select.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <select id='e'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/style.css b/layout/reftests/css-ui-invalid/default-style/style.css
new file mode 100644
index 0000000000..3db7d3dd18
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/style.css
@@ -0,0 +1,11 @@
+:not(output).invalid-ref {
+}
+
+:not(output):-moz-focusring.invalid-ref {
+}
+
+output.invalid-ref {
+}
+
+.barred-ref {
+}
diff --git a/layout/reftests/css-ui-invalid/default-style/textarea-focus-ref.html b/layout/reftests/css-ui-invalid/default-style/textarea-focus-ref.html
new file mode 100644
index 0000000000..942390f870
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/textarea-focus-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('textarea')[0].focus();">
+ <textarea class='invalid-ref' onfocus="document.documentElement.className='';"></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/textarea-focus.html b/layout/reftests/css-ui-invalid/default-style/textarea-focus.html
new file mode 100644
index 0000000000..0f9d790263
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/textarea-focus.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.getElementById('e').focus();
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <textarea id='e' onfocus="document.documentElement.className='';"></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/textarea-ref.html b/layout/reftests/css-ui-invalid/default-style/textarea-ref.html
new file mode 100644
index 0000000000..c7037764f6
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/textarea-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='invalid-ref'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/default-style/textarea.html b/layout/reftests/css-ui-invalid/default-style/textarea.html
new file mode 100644
index 0000000000..73ff14c2ae
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/textarea.html
@@ -0,0 +1,13 @@
+<!DOCTYPE>
+<html class="reftest-wait">
+ <script>
+ function onloadHandler()
+ {
+ document.getElementById('e').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <textarea id='e'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-button-ref.html b/layout/reftests/css-ui-invalid/input/input-button-ref.html
new file mode 100644
index 0000000000..3b828533e3
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-button-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type='button' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-button.html b/layout/reftests/css-ui-invalid/input/input-button.html
new file mode 100644
index 0000000000..1ec43cc1e7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-button.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is of button type, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' type='button'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html
new file mode 100644
index 0000000000..1ad7860629
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its checkedness has changed,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').checked = false;
+ if (!document.getElementById('i').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='checkbox' required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html
new file mode 100644
index 0000000000..ee01e0d381
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its checkedness hasn't changed,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (document.getElementById('i').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='checkbox' required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-customerror.html b/layout/reftests/css-ui-invalid/input/input-customerror.html
new file mode 100644
index 0000000000..55b58ace60
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-customerror.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ </head>
+ <!-- Test: if input has a custom error, it should be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='invalid' id='t'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html
new file mode 100644
index 0000000000..7fbc040c90
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <fieldset>
+ <input class='notinvalid' required>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html
new file mode 100644
index 0000000000..4cda694575
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onloadHandler()
+ {
+ var fieldsets = document.getElementsByTagName("fieldset");
+ fieldsets[1].disabled = true;
+ fieldsets[0].disabled = false;
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <fieldset disabled>
+ <fieldset>
+ <input class='notinvalid' required>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-disabled.html b/layout/reftests/css-ui-invalid/input/input-disabled.html
new file mode 100644
index 0000000000..6757fb0963
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' disabled>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-disabled.html b/layout/reftests/css-ui-invalid/input/input-dyn-disabled.html
new file mode 100644
index 0000000000..f2094b48bb
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-dyn-disabled.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is disabled and invalid, it is barred from constraint
+ validation and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('i');
+ e.setCustomValidity('foo');
+ e.disabled = 'true';
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <input class='notinvalid' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html b/layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html
new file mode 100644
index 0000000000..cff1501a46
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is not disabled and invalid, it is candidate for
+ constraint validation and should be affected
+ by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('i');
+ e.setCustomValidity('foo');
+ e.removeAttribute('disabled');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <input class='invalid' id='i' disabled>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html
new file mode 100644
index 0000000000..e9686e98f7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is no longer readonly, invalid and has it's value changed,
+ it's affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').removeAttribute('readonly');
+ document.getElementById('i').value = '';
+ document.documentElement.className='';">
+ <input class='invalid' id='i' readonly required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html
new file mode 100644
index 0000000000..b697b4200d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is no longer readonly and invalid but it's value hasn't
+ changed, it's affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').removeAttribute('readonly'); document.documentElement.className='';">
+ <input class='notinvalid' id='i' readonly required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-readonly.html b/layout/reftests/css-ui-invalid/input/input-dyn-readonly.html
new file mode 100644
index 0000000000..474e8ff4b8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-dyn-readonly.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is readonly, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').readOnly='ro'; document.documentElement.className='';">
+ <input class='notinvalid' id='i' required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html
new file mode 100644
index 0000000000..87f4568eaa
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its value has changed,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value = 'foo';
+ document.documentElement.className='';">
+ <input id='i' class='invalid' type='email' value='bar'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-email-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-email-invalid-default.html
new file mode 100644
index 0000000000..d4a1c99bb5
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-email-invalid-default.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ but its default value hasn't been changed,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' type='email' value='foo'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-email-ref.html b/layout/reftests/css-ui-invalid/input/input-email-ref.html
new file mode 100644
index 0000000000..ecec613c26
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-email-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input value='foo@bar.com' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-email-valid.html b/layout/reftests/css-ui-invalid/input/input-email-valid.html
new file mode 100644
index 0000000000..8e3fbd349e
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-email-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' type='email' value='foo@bar.com'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html b/layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html
new file mode 100644
index 0000000000..763c383bda
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <legend>
+ <input style="background-color: green;">
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-fieldset-legend.html b/layout/reftests/css-ui-invalid/input/input-fieldset-legend.html
new file mode 100644
index 0000000000..6f85637b4a
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-fieldset-legend.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is invalid but it's value hasn't changed, it's not
+ affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <input class='notinvalid' required>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-fieldset-ref.html b/layout/reftests/css-ui-invalid/input/input-fieldset-ref.html
new file mode 100644
index 0000000000..a9e1239125
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-fieldset-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <fieldset>
+ <input style="background-color: green;">
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-file-ref.html b/layout/reftests/css-ui-invalid/input/input-file-ref.html
new file mode 100644
index 0000000000..73a4fc64cc
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-file-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type='file' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html
new file mode 100644
index 0000000000..960b01b422
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ but its default value hasn't been changed,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value='';
+ document.documentElement.className='';">
+ <input id='i' class='invalid' type='file' required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html
new file mode 100644
index 0000000000..aa1d862d40
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ but its default value hasn't been changed,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' type='file' required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html
new file mode 100644
index 0000000000..9973157700
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its value isn't the default value,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value='foo';
+ document.documentElement.className='';">
+ <input id='i' class='invalid' pattern='bar' value='f'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html
new file mode 100644
index 0000000000..0a1a676a8c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ but its value is stil lthe default value,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' pattern='bar' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-pattern-valid.html b/layout/reftests/css-ui-invalid/input/input-pattern-valid.html
new file mode 100644
index 0000000000..7def28f819
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-pattern-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' pattern='foo' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-customerror.html b/layout/reftests/css-ui-invalid/input/input-radio-customerror.html
new file mode 100644
index 0000000000..c797243a24
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-customerror.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if one radio in a group is suffering from a custom error, the other
+ radio should not be invalid. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i1').checked = false;
+ document.getElementById('i1').setCustomValidity('foo');
+ if (!document.getElementById('i1').matches(':-moz-ui-invalid') ||
+ document.getElementById('i2').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i1' name='foo' type='radio'>
+ <input id='i2' name='foo' type='radio'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html
new file mode 100644
index 0000000000..d2fd008e15
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: when there are no radio suffering from being missing in the radio
+ group, all radio should not suffer from being missing. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i1').checked = true;
+ if (document.getElementById('i1').matches(':-moz-ui-invalid') ||
+ document.getElementById('i2').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i1' name='foo' type='radio' required>
+ <input id='i2' name='foo' type='radio'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html
new file mode 100644
index 0000000000..f4ee5d171c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: when there are no radio suffering from being missing in the radio
+ group, all radio should not suffer from being missing. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i1').checked = true;
+ document.getElementById('i1').required = false;
+ if (document.getElementById('i1').matches(':-moz-ui-invalid') ||
+ document.getElementById('i2').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i1' name='foo' type='radio' required>
+ <input id='i2' name='foo' type='radio'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html
new file mode 100644
index 0000000000..e17e92a958
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').checked = true;
+ if (document.getElementById('i').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio' required name='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html
new file mode 100644
index 0000000000..a3a173d0ab
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').checked = false;
+ if (!document.getElementById('i').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio' required name='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html
new file mode 100644
index 0000000000..b58950c68c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its checkedness has changed,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').checked = false;
+ if (!document.getElementById('i').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio' required name='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html
new file mode 100644
index 0000000000..cb2456533f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its checkedness hasn't changed,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (document.getElementById('i').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio' required>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-radio-required.html b/layout/reftests/css-ui-invalid/input/input-radio-required.html
new file mode 100644
index 0000000000..04b94997e8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-radio-required.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if one radio in a group has the required attribute and no radio is
+ checked, all radio in the group should have :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i1').checked = false;
+ if (!document.getElementById('i1').matches(':-moz-ui-invalid') ||
+ !document.getElementById('i2').matches(':-moz-ui-invalid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i1' name='foo' type='radio' required>
+ <input id='i2' name='foo' type='radio'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-readonly.html b/layout/reftests/css-ui-invalid/input/input-readonly.html
new file mode 100644
index 0000000000..8f5ab0c3c9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-readonly.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is readonly, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' readonly>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-ref.html b/layout/reftests/css-ui-invalid/input/input-ref.html
new file mode 100644
index 0000000000..65b4b97078
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html
new file mode 100644
index 0000000000..64927141f7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value='';
+ document.documentElement.className='';">
+ <input id='i' class='invalid' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-required-invalid-default.html
new file mode 100644
index 0000000000..3d4e17aea9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-required-invalid-default.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ but its value is still the default value,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-required-valid.html b/layout/reftests/css-ui-invalid/input/input-required-valid.html
new file mode 100644
index 0000000000..34dca4585b
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-required-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' value='foo' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-reset.html b/layout/reftests/css-ui-invalid/input/input-reset.html
new file mode 100644
index 0000000000..06092d45cf
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-reset.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is of reset type, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <!-- Setting value to the empty string let us check against input-button-ref.html -->
+ <input class='notinvalid' type='reset' value=''>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-type-barred.html b/layout/reftests/css-ui-invalid/input/input-type-barred.html
new file mode 100644
index 0000000000..145b114d6f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-type-barred.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if an input has is candidate for constraint validation then change
+ its type to be barred from constraint validation, it should not be
+ affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').type='button'; document.documentElement.className='';">
+ <input class='notinvalid' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-type-invalid.html b/layout/reftests/css-ui-invalid/input/input-type-invalid.html
new file mode 100644
index 0000000000..537c877c06
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-type-invalid.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if an input has a custom error when barred from constraint
+ validation then move a type candidate for constraint validation,
+ it should not be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function doTest()
+ {
+ var i = document.getElementById('i');
+ i.setCustomValidity('foo');
+ i.type = 'text';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ <body>
+ <input class='invalid' type='button' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html
new file mode 100644
index 0000000000..f00b5acbd7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ and its value is not the default value,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value='foo';
+ document.documentElement.className='';">
+ <input id='i' class='invalid' type='url'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-url-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-url-invalid-default.html
new file mode 100644
index 0000000000..2ce04568a1
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-url-invalid-default.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ but its value is the default value,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' type='url' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-url-ref.html b/layout/reftests/css-ui-invalid/input/input-url-ref.html
new file mode 100644
index 0000000000..e95cdbca2e
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-url-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input value='http://mozilla.org/' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-url-valid.html b/layout/reftests/css-ui-invalid/input/input-url-valid.html
new file mode 100644
index 0000000000..8b615a7709
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-url-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid' type='url' value='http://mozilla.org/'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/input/input-valid.html b/layout/reftests/css-ui-invalid/input/input-valid.html
new file mode 100644
index 0000000000..a8b4157a80
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-valid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and is not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notinvalid'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/input-withtext-ref.html b/layout/reftests/css-ui-invalid/input/input-withtext-ref.html
new file mode 100644
index 0000000000..d54d052157
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-withtext-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input value='foo' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/input/reftest.list b/layout/reftests/css-ui-invalid/input/reftest.list
new file mode 100644
index 0000000000..43e3495433
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/reftest.list
@@ -0,0 +1,41 @@
+== input-valid.html input-ref.html
+fuzzy(0-64,0-4) == input-customerror.html input-ref.html
+fuzzy(0-1,0-3) == input-disabled.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-disabled.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-not-disabled.html input-ref.html
+fuzzy(0-1,0-3) == input-readonly.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-readonly.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-not-readonly-not-changed.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-not-readonly-changed.html input-ref.html
+== input-required-valid.html input-withtext-ref.html
+fuzzy(0-1,0-3) == input-required-invalid-default.html input-ref.html
+fuzzy(0-1,0-3) == input-required-invalid-changed.html input-ref.html
+fuzzy(0-2,0-5) == input-button.html input-button-ref.html
+fuzzy(0-2,0-5) == input-reset.html input-button-ref.html
+== input-email-invalid-default.html input-withtext-ref.html
+== input-email-invalid-changed.html input-withtext-ref.html
+fuzzy(0-2,0-5) == input-email-valid.html input-email-ref.html
+== input-url-invalid-changed.html input-withtext-ref.html
+== input-url-invalid-default.html input-withtext-ref.html
+== input-url-valid.html input-url-ref.html
+== input-pattern-valid.html input-withtext-ref.html
+== input-pattern-invalid-default.html input-withtext-ref.html
+== input-pattern-invalid-changed.html input-withtext-ref.html
+fuzzy(0-2,0-5) == input-type-barred.html input-button-ref.html
+fuzzy(0-64,0-4) == input-type-invalid.html input-ref.html
+== input-disabled-fieldset-1.html input-fieldset-ref.html
+fuzzy(0-1,0-3) == input-disabled-fieldset-2.html input-fieldset-ref.html
+fuzzy(0-1,0-3) == input-fieldset-legend.html input-fieldset-legend-ref.html
+== input-checkbox-required-invalid-changed.html success-ref.html
+== input-checkbox-required-invalid-default.html success-ref.html
+== input-radio-required-invalid-changed.html success-ref.html
+== input-radio-required-invalid-default.html success-ref.html
+== input-file-required-invalid-changed.html input-file-ref.html
+== input-file-required-invalid-default.html input-file-ref.html
+== input-radio-required.html success-ref.html
+== input-radio-customerror.html success-ref.html
+== input-radio-dyn-valid-1.html success-ref.html
+== input-radio-dyn-valid-2.html success-ref.html
+== input-radio-nogroup-required-valid.html success-ref.html
+== input-radio-nogroup-required-invalid.html success-ref.html
+# input type='hidden' shouldn't show
diff --git a/layout/reftests/css-ui-invalid/input/style.css b/layout/reftests/css-ui-invalid/input/style.css
new file mode 100644
index 0000000000..93a61a020d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/style.css
@@ -0,0 +1,23 @@
+/* Override default style */
+input:-moz-ui-invalid {
+ box-shadow: none;
+}
+
+input.notinvalid {
+ background-color: green;
+}
+input.notinvalid:-moz-ui-invalid {
+ background-color: red;
+}
+
+input.invalid {
+ background-color: red;
+}
+input.invalid:-moz-ui-invalid {
+ background-color: green;
+}
+
+input[type=checkbox],
+input[type=radio] {
+ display: none;
+}
diff --git a/layout/reftests/css-ui-invalid/input/success-ref.html b/layout/reftests/css-ui-invalid/input/success-ref.html
new file mode 100644
index 0000000000..bfa8e0a12c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/success-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ SUCCESS
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/output/output-invalid.html b/layout/reftests/css-ui-invalid/output/output-invalid.html
new file mode 100644
index 0000000000..aa6830c753
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/output-invalid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if output has a custom error, it should not be affected by
+ :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <output class='invalid' id='b'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/output/output-ref.html b/layout/reftests/css-ui-invalid/output/output-ref.html
new file mode 100644
index 0000000000..0db2c440c7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/output-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <output class='ref'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/output/output-valid.html b/layout/reftests/css-ui-invalid/output/output-valid.html
new file mode 100644
index 0000000000..984eea20ae
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/output-valid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if output has no custom error, it should not affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <output class='notinvalid'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/output/reftest.list b/layout/reftests/css-ui-invalid/output/reftest.list
new file mode 100644
index 0000000000..74468e394a
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/reftest.list
@@ -0,0 +1,2 @@
+== output-valid.html output-ref.html
+== output-invalid.html output-ref.html
diff --git a/layout/reftests/css-ui-invalid/output/style.css b/layout/reftests/css-ui-invalid/output/style.css
new file mode 100644
index 0000000000..99d5be9107
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/style.css
@@ -0,0 +1,22 @@
+/* Override default style */
+output {
+ color: black;
+}
+
+output.notinvalid {
+ color: green;
+}
+output.notinvalid:-moz-ui-invalid {
+ color: red;
+}
+
+output.invalid {
+ color: green;
+}
+output.invalid:-moz-ui-invalid {
+ color: red;
+}
+
+output.ref {
+ color: green;
+}
diff --git a/layout/reftests/css-ui-invalid/reftest.list b/layout/reftests/css-ui-invalid/reftest.list
new file mode 100644
index 0000000000..4563deee70
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/reftest.list
@@ -0,0 +1,9 @@
+# :-moz-ui-invalid should apply on the following elements
+include button/reftest.list
+include input/reftest.list
+include select/reftest.list
+include textarea/reftest.list
+include output/reftest.list
+
+# default :-moz-ui-invalid style
+include default-style/reftest.list
diff --git a/layout/reftests/css-ui-invalid/select/reftest.list b/layout/reftests/css-ui-invalid/select/reftest.list
new file mode 100644
index 0000000000..87a045189d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/reftest.list
@@ -0,0 +1,17 @@
+needs-focus fuzzy-if(geckoview,0-8,0-1) == select-valid.html select-ref.html
+fuzzy(0-1,0-3) needs-focus == select-invalid.html select-ref.html
+fuzzy(0-2,0-5) needs-focus == select-invalid-reset.html select-required-ref.html
+needs-focus == select-disabled.html select-disabled-ref.html
+needs-focus == select-dyn-disabled.html select-disabled-ref.html
+fuzzy(0-1,0-3) needs-focus == select-dyn-not-disabled.html select-ref.html
+fuzzy(0-2,0-5) needs-focus == select-required-invalid-1.html select-required-ref.html
+fuzzy(0-2,0-5) needs-focus == select-required-invalid-2.html select-required-ref.html
+fuzzy(0-2,0-5) needs-focus == select-required-invalid-changed-1.html select-required-ref.html
+fuzzy(0-2,0-5) needs-focus == select-required-invalid-changed-2.html select-required-ref.html
+fuzzy(0-2,0-5) needs-focus == select-required-valid.html select-required-ref.html
+needs-focus == select-required-multiple-invalid.html select-required-multiple-ref.html
+fuzzy(0-1,0-1000) needs-focus == select-required-multiple-invalid-changed.html select-required-multiple-ref.html
+needs-focus == select-required-multiple-valid.html select-required-multiple-ref.html
+fuzzy-if(!Android,0-2,0-10) fuzzy-if(Android,0-9,0-1) needs-focus == select-disabled-fieldset-1.html select-fieldset-ref.html
+fuzzy-if(!Android,0-2,0-10) fuzzy-if(Android,0-9,0-1) needs-focus == select-disabled-fieldset-2.html select-fieldset-ref.html
+fuzzy(0-2,0-10) needs-focus == select-fieldset-legend.html select-fieldset-legend-ref.html
diff --git a/layout/reftests/css-ui-invalid/select/select-disabled-fieldset-1.html b/layout/reftests/css-ui-invalid/select/select-disabled-fieldset-1.html
new file mode 100644
index 0000000000..a1c8303716
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-disabled-fieldset-1.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('s');
+ e.setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <fieldset disabled>
+ <fieldset>
+ <select class='notinvalid' id='s'></select>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-disabled-fieldset-2.html b/layout/reftests/css-ui-invalid/select/select-disabled-fieldset-2.html
new file mode 100644
index 0000000000..e466e03050
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-disabled-fieldset-2.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onloadHandler()
+ {
+ var e = document.getElementById('s');
+ e.setCustomValidity('foo');
+ var fieldsets = document.getElementsByTagName("fieldset");
+ fieldsets[1].disabled = true;
+ fieldsets[0].disabled = false;
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <fieldset disabled>
+ <fieldset>
+ <select class='notinvalid' id='s'></select>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-disabled-ref.html b/layout/reftests/css-ui-invalid/select/select-disabled-ref.html
new file mode 100644
index 0000000000..e3a228a897
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-disabled-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <select disabled style="background-color: green;"></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-disabled.html b/layout/reftests/css-ui-invalid/select/select-disabled.html
new file mode 100644
index 0000000000..a38d8bca3c
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').setCustomValidity('foo'); document.documentElement.className='';">
+ <select class='notinvalid' id='s' disabled></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-dyn-disabled.html b/layout/reftests/css-ui-invalid/select/select-dyn-disabled.html
new file mode 100644
index 0000000000..5fed3005d8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-dyn-disabled.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select is disabled and invalid, it is barred from constraint
+ validation and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('s');
+ e.setCustomValidity('foo');
+ e.disabled = 'true';
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <select class='notinvalid' id='s'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-dyn-not-disabled.html b/layout/reftests/css-ui-invalid/select/select-dyn-not-disabled.html
new file mode 100644
index 0000000000..bab99531b6
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-dyn-not-disabled.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select is not disabled and invalid, it is candidate for
+ constraint validation and should be affected
+ by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('s');
+ e.setCustomValidity('foo');
+ e.removeAttribute('disabled');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <select class='invalid' id='s' disabled></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-fieldset-legend-ref.html b/layout/reftests/css-ui-invalid/select/select-fieldset-legend-ref.html
new file mode 100644
index 0000000000..5083cea90d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-fieldset-legend-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <legend>
+ <select style="background-color: green;"></select>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-fieldset-legend.html b/layout/reftests/css-ui-invalid/select/select-fieldset-legend.html
new file mode 100644
index 0000000000..3e76408ec5
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-fieldset-legend.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select has a disabled fieldset ancestor, but is in the first
+ legend, it is not barred from constraint validation and should be
+ affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onLoadHandler()
+ {
+ var e = document.getElementById('b');
+ e.setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onLoadHandler();">
+ <fieldset disabled>
+ <legend>
+ <select class='invalid' id='b'></select>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-fieldset-ref.html b/layout/reftests/css-ui-invalid/select/select-fieldset-ref.html
new file mode 100644
index 0000000000..ca82a8022d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-fieldset-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <fieldset>
+ <select disabled style="background-color: green;"></select>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-invalid-reset.html b/layout/reftests/css-ui-invalid/select/select-invalid-reset.html
new file mode 100644
index 0000000000..8b8e7c6fda
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-invalid-reset.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select has a custom error, it should be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').selectedIndex = 0;
+ document.forms[0].reset();
+ document.documentElement.className='';">
+ <form>
+ <select id='s' class='notinvalid' id='s' required>
+ <option value="">foo</option>
+ </select>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-invalid.html b/layout/reftests/css-ui-invalid/select/select-invalid.html
new file mode 100644
index 0000000000..df3526dfce
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select has a custom error, it should be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').setCustomValidity('foo');
+ document.documentElement.className='';">
+ <select class='invalid' id='s'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-ref.html b/layout/reftests/css-ui-invalid/select/select-ref.html
new file mode 100644
index 0000000000..a28668557f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <select style="background-color: green;"></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-invalid-1.html b/layout/reftests/css-ui-invalid/select/select-required-invalid-1.html
new file mode 100644
index 0000000000..064695c52f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-invalid-1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and the selected option has an empty
+ string value and the selection didn't changed,
+ :-moz-ui-invalid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notinvalid' required>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-invalid-2.html b/layout/reftests/css-ui-invalid/select/select-required-invalid-2.html
new file mode 100644
index 0000000000..7a32805c95
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-invalid-2.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and the selected option has an empty
+ string value and the selection didn't changed,
+ :-moz-ui-invalid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notinvalid' required>
+ <option value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-invalid-changed-1.html b/layout/reftests/css-ui-invalid/select/select-required-invalid-changed-1.html
new file mode 100644
index 0000000000..e8f3142fcd
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-invalid-changed-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if select is required and the selected option has an empty
+ string value and the selection did changed,
+ :-moz-ui-invalid should apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').selectedIndex = 0;
+ document.documentElement.className = '';">
+ <select id='s' class='invalid' required>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-invalid-changed-2.html b/layout/reftests/css-ui-invalid/select/select-required-invalid-changed-2.html
new file mode 100644
index 0000000000..c57e38206f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-invalid-changed-2.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if select is required and the selected option has an empty
+ string value and the selection did changed,
+ :-moz-ui-invalid should apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').selectedIndex = 0;
+ document.documentElement.className = '';">
+ <select id='s' class='invalid' required>
+ <option value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-multiple-invalid-changed.html b/layout/reftests/css-ui-invalid/select/select-required-multiple-invalid-changed.html
new file mode 100644
index 0000000000..547acaea6a
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-multiple-invalid-changed.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if select is required, has all selected option value set to the
+ empty string, and the selection did changed,
+ :-moz-ui-invalid should apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').options[0].selected = true;
+ document.getElementById('s').options[1].selected = true;
+ document.documentElement.className = '';">
+ <select id='s' class='notinvalid' required multiple>
+ <option selected></option>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-multiple-invalid.html b/layout/reftests/css-ui-invalid/select/select-required-multiple-invalid.html
new file mode 100644
index 0000000000..d59ee7ee62
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-multiple-invalid.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required, has all selected option value set to the
+ empty string, and the selection did not changed,
+ :-moz-ui-invalid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notinvalid' required multiple>
+ <option selected></option>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-multiple-ref.html b/layout/reftests/css-ui-invalid/select/select-required-multiple-ref.html
new file mode 100644
index 0000000000..a9477333f8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-multiple-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select multiple style="background-color: green;">
+ <option selected></option>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-multiple-valid.html b/layout/reftests/css-ui-invalid/select/select-required-multiple-valid.html
new file mode 100644
index 0000000000..8ae8b89b07
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-multiple-valid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a selected option which has value
+ different from the empty string, :-moz-ui-invalid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notinvalid' required multiple>
+ <option selected></option>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-ref.html b/layout/reftests/css-ui-invalid/select/select-required-ref.html
new file mode 100644
index 0000000000..3c2bde80a0
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select style="background-color: green;">
+ <option selected value="">foo</option>
+ </selecT>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-required-valid.html b/layout/reftests/css-ui-invalid/select/select-required-valid.html
new file mode 100644
index 0000000000..9fb309b19f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-required-valid.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a select option which has value
+ different from the empty string, :-moz-ui-invalid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notinvalid' required>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/select-valid.html b/layout/reftests/css-ui-invalid/select/select-valid.html
new file mode 100644
index 0000000000..268157b6eb
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-valid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select has no custom error and is not barred from constraint
+ validation, it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notinvalid'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/select/style.css b/layout/reftests/css-ui-invalid/select/style.css
new file mode 100644
index 0000000000..e8561a2bd3
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+select:-moz-ui-invalid {
+ box-shadow: none;
+}
+
+select.notinvalid {
+ background-color: green;
+}
+select.notinvalid:-moz-ui-invalid {
+ background-color: red;
+}
+
+select.invalid {
+ background-color: red;
+}
+select.invalid:-moz-ui-invalid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-invalid/textarea/reftest.list b/layout/reftests/css-ui-invalid/textarea/reftest.list
new file mode 100644
index 0000000000..f074c8a999
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/reftest.list
@@ -0,0 +1,14 @@
+== textarea-valid.html textarea-ref.html
+== textarea-customerror.html textarea-ref.html
+== textarea-disabled.html textarea-ref.html
+== textarea-dyn-disabled.html textarea-ref.html
+== textarea-dyn-not-disabled.html textarea-ref.html
+== textarea-readonly.html textarea-ref.html
+== textarea-dyn-readonly.html textarea-ref.html
+== textarea-dyn-not-readonly-not-changed.html textarea-ref.html
+== textarea-dyn-not-readonly-changed.html textarea-ref.html
+== textarea-required-valid.html textarea-withtext-ref.html
+== textarea-required-invalid.html textarea-ref.html
+== textarea-required-invalid-changed.html textarea-ref.html
+== textarea-disabled-fieldset-1.html textarea-fieldset-ref.html
+== textarea-disabled-fieldset-2.html textarea-fieldset-ref.html
diff --git a/layout/reftests/css-ui-invalid/textarea/style.css b/layout/reftests/css-ui-invalid/textarea/style.css
new file mode 100644
index 0000000000..5d78b21de6
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/style.css
@@ -0,0 +1,26 @@
+/* Override default style */
+textarea {
+ border: 0px;
+}
+
+textarea.ref {
+ background-color: green;
+}
+
+textarea:-moz-ui-invalid {
+ box-shadow: none;
+}
+
+textarea.notinvalid {
+ background-color: green;
+}
+textarea.notinvalid:-moz-ui-invalid {
+ background-color: red;
+}
+
+textarea.invalid {
+ background-color: red;
+}
+textarea.invalid:-moz-ui-invalid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-customerror.html b/layout/reftests/css-ui-invalid/textarea/textarea-customerror.html
new file mode 100644
index 0000000000..bfb8bf491a
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-customerror.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').setCustomValidity('foo');
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ </head>
+ <!-- Test: if textarea has a custom error, it should be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='invalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-1.html b/layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-1.html
new file mode 100644
index 0000000000..7745264a37
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <fieldset>
+ <textarea class='notinvalid' required></textarea>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-2.html b/layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-2.html
new file mode 100644
index 0000000000..9835295ba1
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-disabled-fieldset-2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if textarea has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-invalid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function onloadHandler()
+ {
+ var fieldsets = document.getElementsByTagName("fieldset");
+ fieldsets[1].disabled = true;
+ fieldsets[0].disabled = false;
+ document.documentElement.className='';
+ }
+ </script>
+ <body onload="onloadHandler();">
+ <fieldset disabled>
+ <fieldset>
+ <textarea class='notinvalid' required></textarea>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-disabled.html b/layout/reftests/css-ui-invalid/textarea/textarea-disabled.html
new file mode 100644
index 0000000000..702c97132d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid' disabled></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-dyn-disabled.html b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-disabled.html
new file mode 100644
index 0000000000..87a8c38d1e
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-disabled.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if textarea is disabled and invalid, it is barred from constraint
+ validation and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function doTest()
+ {
+ var e = document.getElementById('t');
+ e.setCustomValidity('foo');
+ e.disabled = 'true';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ <body>
+ <textarea class='notinvalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-disabled.html b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-disabled.html
new file mode 100644
index 0000000000..22d6dea460
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-disabled.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if textarea is not disabled and invalid, it is candidate for
+ constraint validation and should be affected
+ by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function doTest()
+ {
+ var e = document.getElementById('t');
+ e.setCustomValidity('foo');
+ e.removeAttribute('disabled');
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ <body>
+ <textarea class='invalid' id='t' disabled></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-changed.html b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-changed.html
new file mode 100644
index 0000000000..326b181422
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-changed.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').removeAttribute('readonly');
+ document.getElementById('t').value = '';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ </head>
+ <!-- Test: if textarea is no longer readonly and has it's value changed,
+ it's affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='invalid' id='t' readonly required></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-not-changed.html b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-not-changed.html
new file mode 100644
index 0000000000..92544d9cbd
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-not-readonly-not-changed.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').removeAttribute('readonly');
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ </head>
+ <!-- Test: if textarea is no longer readonly, but doesn't have it's value changed,
+ it's not affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid' id='t' readonly required></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-dyn-readonly.html b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-readonly.html
new file mode 100644
index 0000000000..2b2d930ba1
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-dyn-readonly.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').readOnly='ro';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ </head>
+ <!-- Test: if textarea is readonly, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid' id='t' required></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend-ref.html b/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend-ref.html
new file mode 100644
index 0000000000..8e81d23f1f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset>
+ <legend>
+ <textarea class="ref"></textarea>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend.html b/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend.html
new file mode 100644
index 0000000000..8e734af290
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-legend.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea has a disabled fieldset ancestor, is in the first
+ legend but has its value not changed, it should not be
+ affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <textarea class='notinvalid' required></textarea>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-ref.html b/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-ref.html
new file mode 100644
index 0000000000..1d01eb0438
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-fieldset-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset>
+ <fieldset>
+ <textarea class="ref"></textarea>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-readonly.html b/layout/reftests/css-ui-invalid/textarea/textarea-readonly.html
new file mode 100644
index 0000000000..0921c62fbf
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-readonly.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea is readonly, it is barred from constraint validation
+ and should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid' readonly></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-ref.html b/layout/reftests/css-ui-invalid/textarea/textarea-ref.html
new file mode 100644
index 0000000000..b370a02a0f
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class="ref"></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-required-invalid-changed.html b/layout/reftests/css-ui-invalid/textarea/textarea-required-invalid-changed.html
new file mode 100644
index 0000000000..00622b1c76
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-required-invalid-changed.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').value = '';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ </head>
+ <!-- Test: if textarea isn't valid and it's value has been changed,
+ it should be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea id='t' class='invalid' required></textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-required-invalid.html b/layout/reftests/css-ui-invalid/textarea/textarea-required-invalid.html
new file mode 100644
index 0000000000..26144cecf9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-required-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea isn't valid but it's value hasn't been changed,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid' required></textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-required-valid.html b/layout/reftests/css-ui-invalid/textarea/textarea-required-valid.html
new file mode 100644
index 0000000000..be0e95e4c6
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-required-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea is valid and not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid' required>foo</textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-valid.html b/layout/reftests/css-ui-invalid/textarea/textarea-valid.html
new file mode 100644
index 0000000000..58fe81dce9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-valid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea is valid and is not barred from constraint validation,
+ it should not be affected by :-moz-ui-invalid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notinvalid'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-invalid/textarea/textarea-withtext-ref.html b/layout/reftests/css-ui-invalid/textarea/textarea-withtext-ref.html
new file mode 100644
index 0000000000..a6a2b79cfa
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-withtext-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class="ref">foo</textarea>
+ </body>
+</html>