summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-ui-invalid
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/css-ui-invalid')
-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-novalidate.html10
-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-stylo.list14
-rw-r--r--layout/reftests/css-ui-invalid/button/reftest.list13
-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-stylo.list13
-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.css14
-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-novalidate.html11
-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-stylo.list48
-rw-r--r--layout/reftests/css-ui-invalid/input/reftest.list42
-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-novalidate.html10
-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-stylo.list4
-rw-r--r--layout/reftests/css-ui-invalid/output/reftest.list3
-rw-r--r--layout/reftests/css-ui-invalid/output/style.css22
-rw-r--r--layout/reftests/css-ui-invalid/reftest-stylo.list10
-rw-r--r--layout/reftests/css-ui-invalid/reftest.list9
-rw-r--r--layout/reftests/css-ui-invalid/select/reftest-stylo.list22
-rw-r--r--layout/reftests/css-ui-invalid/select/reftest.list18
-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-novalidate.html11
-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-stylo.list19
-rw-r--r--layout/reftests/css-ui-invalid/textarea/reftest.list15
-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-novalidate.html10
-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
155 files changed, 2006 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 000000000..b3a32a49b
--- /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 000000000..5cf40c93a
--- /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 000000000..4ee147a70
--- /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 000000000..7de1ba7c5
--- /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 000000000..1607c2b64
--- /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 000000000..1c7350d72
--- /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 000000000..7ae667b8e
--- /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 000000000..22adc433c
--- /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 000000000..66b5ae585
--- /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 000000000..60ab1a3ef
--- /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 000000000..2aeaea4e1
--- /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-novalidate.html b/layout/reftests/css-ui-invalid/button/button-novalidate.html
new file mode 100644
index 000000000..5288415a8
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/button-novalidate.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo');
+ document.documentElement.className = '';">
+ <form novalidate>
+ <button id='b' class='notinvalid'></button>
+ </form>
+ </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 000000000..422cc9315
--- /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 000000000..6e64908be
--- /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 000000000..374861542
--- /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 000000000..a6e20d1a9
--- /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 000000000..1f99c6331
--- /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-stylo.list b/layout/reftests/css-ui-invalid/button/reftest-stylo.list
new file mode 100644
index 000000000..b4097b45d
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/reftest-stylo.list
@@ -0,0 +1,14 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== button-valid.html button-valid.html
+fails fuzzy-if(skiaContent,1,3) == button-invalid.html button-invalid.html
+fuzzy-if(skiaContent,2,5) == button-disabled.html button-disabled.html
+fuzzy-if(skiaContent,2,5) == button-dyn-disabled.html button-dyn-disabled.html
+fails fuzzy-if(skiaContent,1,3) == button-dyn-not-disabled.html button-dyn-not-disabled.html
+fuzzy-if(skiaContent,1,3) == button-button.html button-button.html
+fails fuzzy-if(skiaContent,1,3) == button-reset.html button-reset.html
+fails fuzzy-if(skiaContent,1,3) == button-type-invalid.html button-type-invalid.html
+fails fuzzy-if(skiaContent,1,3) == button-type-barred.html button-type-barred.html
+fuzzy-if(skiaContent,1,3) == button-disabled-fieldset-1.html button-disabled-fieldset-1.html
+fuzzy-if(skiaContent,1,3) == button-disabled-fieldset-2.html button-disabled-fieldset-2.html
+fuzzy-if(skiaContent,1,4) == button-fieldset-legend.html button-fieldset-legend.html
+fails fuzzy-if(skiaContent,1,3) == button-novalidate.html button-novalidate.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 000000000..46745e3ac
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/button/reftest.list
@@ -0,0 +1,13 @@
+== button-valid.html button-ref.html
+fuzzy-if(skiaContent,1,3) == button-invalid.html button-ref.html
+fuzzy-if(skiaContent,2,5) == button-disabled.html button-disabled-ref.html
+fuzzy-if(skiaContent,2,5) == button-dyn-disabled.html button-disabled-ref.html
+fuzzy-if(skiaContent,1,3) == button-dyn-not-disabled.html button-ref.html
+fuzzy-if(skiaContent,1,3) == button-button.html button-ref.html
+fuzzy-if(skiaContent,1,3) == button-reset.html button-ref.html
+fuzzy-if(skiaContent,1,3) == button-type-invalid.html button-ref.html
+fuzzy-if(skiaContent,1,3) == button-type-barred.html button-ref.html
+fuzzy-if(skiaContent,1,3) == button-disabled-fieldset-1.html button-fieldset-ref.html
+fuzzy-if(skiaContent,1,3) == button-disabled-fieldset-2.html button-fieldset-ref.html
+fuzzy-if(skiaContent,1,4) == button-fieldset-legend.html button-fieldset-legend-ref.html
+fuzzy-if(skiaContent,1,3) == button-novalidate.html button-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 000000000..83653cfb1
--- /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 000000000..9046f5c74
--- /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 000000000..e34dad846
--- /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 000000000..71dbb9cf8
--- /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 000000000..3b240b7e4
--- /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 000000000..028918324
--- /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 000000000..e2b3b1ac1
--- /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 000000000..1180844f6
--- /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 000000000..ac9d554a4
--- /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 000000000..31f6e35f2
--- /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 000000000..e0d1bf6a3
--- /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 000000000..f1ab90bc6
--- /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 000000000..6da555bbf
--- /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-stylo.list b/layout/reftests/css-ui-invalid/default-style/reftest-stylo.list
new file mode 100644
index 000000000..b2a2c35d9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/reftest-stylo.list
@@ -0,0 +1,13 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== input.html input.html
+== button.html button.html
+== textarea.html textarea.html
+== select.html select.html
+== fieldset.html fieldset.html
+== output.html output.html
+random-if(winWidget) needs-focus == input-focus.html input-focus.html
+# Intermittent failures, bug 660224
+needs-focus == button-focus.html button-focus.html
+needs-focus == textarea-focus.html textarea-focus.html
+random-if(winWidget) needs-focus == select-focus.html select-focus.html
+# Intermittent failures, bug 660224
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 000000000..d647b0f74
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/reftest.list
@@ -0,0 +1,10 @@
+== input.html input-ref.html
+== button.html button-ref.html
+== textarea.html textarea-ref.html
+== 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 == button-focus.html button-focus-ref.html
+needs-focus == textarea-focus.html textarea-focus-ref.html
+random-if(winWidget) needs-focus == select-focus.html select-focus-ref.html # Intermittent failures, bug 660224
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 000000000..42b8da524
--- /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 000000000..946e07815
--- /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 000000000..3eed47082
--- /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 000000000..f05241f9e
--- /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 000000000..3f2f29df7
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/default-style/style.css
@@ -0,0 +1,14 @@
+:not(output).invalid-ref {
+ box-shadow: 0 0 1.5px 1px red;
+}
+
+:not(output):-moz-focusring.invalid-ref {
+ box-shadow: 0 0 2px 2px rgba(255,0,0,0.4);
+}
+
+output.invalid-ref {
+ color: red;
+}
+
+.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 000000000..942390f87
--- /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 000000000..0f9d79026
--- /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 000000000..c7037764f
--- /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 000000000..73ff14c2a
--- /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 000000000..3b828533e
--- /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 000000000..1ec43cc1e
--- /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 000000000..1ad786062
--- /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 000000000..ee01e0d38
--- /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 000000000..676b4bd48
--- /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, false);
+ </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 000000000..7fbc040c9
--- /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 000000000..4cda69457
--- /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 000000000..6757fb096
--- /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 000000000..f2094b48b
--- /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 000000000..cff1501a4
--- /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 000000000..e9686e98f
--- /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 000000000..b697b4200
--- /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 000000000..474e8ff4b
--- /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 000000000..87f4568ea
--- /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 000000000..d4a1c99bb
--- /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 000000000..ecec613c2
--- /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 000000000..8e3fbd349
--- /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 000000000..763c383bd
--- /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 000000000..6f85637b4
--- /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 000000000..a9e123912
--- /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 000000000..73a4fc64c
--- /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 000000000..960b01b42
--- /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 000000000..aa1d862d4
--- /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-novalidate.html b/layout/reftests/css-ui-invalid/input/input-novalidate.html
new file mode 100644
index 000000000..3f786dc7e
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/input-novalidate.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- When the form has @novalidate, :-moz-ui-invalid doesn't apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value = '';
+ document.documentElement.className = '';">
+ <form novalidate>
+ <input id='i' class='notinvalid' required>
+ </form>
+ </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 000000000..997315770
--- /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 000000000..0a1a676a8
--- /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 000000000..7def28f81
--- /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 000000000..c797243a2
--- /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 000000000..d2fd008e1
--- /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 000000000..f4ee5d171
--- /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 000000000..dcad63f31
--- /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>
+ </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 000000000..fede2c1a7
--- /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>
+ </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 000000000..5b9cd80ac
--- /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>
+ </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 000000000..cb2456533
--- /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 000000000..04b94997e
--- /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 000000000..8f5ab0c3c
--- /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 000000000..65b4b9707
--- /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 000000000..64927141f
--- /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 000000000..3d4e17aea
--- /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 000000000..34dca4585
--- /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 000000000..06092d45c
--- /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 000000000..145b114d6
--- /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 000000000..e37173ede
--- /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, false);
+ </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 000000000..f00b5acbd
--- /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 000000000..2ce04568a
--- /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 000000000..e95cdbca2
--- /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 000000000..8b615a770
--- /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 000000000..a8b4157a8
--- /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 000000000..d54d05215
--- /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-stylo.list b/layout/reftests/css-ui-invalid/input/reftest-stylo.list
new file mode 100644
index 000000000..993d7c245
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/reftest-stylo.list
@@ -0,0 +1,48 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== input-valid.html input-valid.html
+== input-customerror.html input-customerror.html
+skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) == input-disabled.html input-disabled.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) == input-dyn-disabled.html input-dyn-disabled.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+fuzzy-if(skiaContent,1,3) == input-dyn-not-disabled.html input-dyn-not-disabled.html
+fuzzy-if(skiaContent,1,3) == input-readonly.html input-readonly.html
+fuzzy-if(skiaContent,1,3) == input-dyn-readonly.html input-dyn-readonly.html
+fails fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-not-changed.html input-dyn-not-readonly-not-changed.html
+fails fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-changed.html input-dyn-not-readonly-changed.html
+skip == input-maxlength-valid.html input-maxlength-valid.html
+skip == input-maxlength-invalid-changed.html input-maxlength-invalid-changed.html
+skip == input-maxlength-invalid-default.html input-maxlength-invalid-default.html
+== input-required-valid.html input-required-valid.html
+fuzzy-if(skiaContent,1,3) == input-required-invalid-default.html input-required-invalid-default.html
+fails fuzzy-if(skiaContent,1,3) == input-required-invalid-changed.html input-required-invalid-changed.html
+fuzzy-if(skiaContent,2,5) == input-button.html input-button.html
+skip fuzzy-if(skiaContent,2,5) == input-reset.html input-reset.html
+== input-email-invalid-default.html input-email-invalid-default.html
+== input-email-invalid-changed.html input-email-invalid-changed.html
+fuzzy-if(skiaContent,2,5) == input-email-valid.html input-email-valid.html
+== input-url-invalid-changed.html input-url-invalid-changed.html
+== input-url-invalid-default.html input-url-invalid-default.html
+== input-url-valid.html input-url-valid.html
+== input-pattern-valid.html input-pattern-valid.html
+== input-pattern-invalid-default.html input-pattern-invalid-default.html
+== input-pattern-invalid-changed.html input-pattern-invalid-changed.html
+fuzzy-if(skiaContent,2,5) == input-type-barred.html input-type-barred.html
+== input-type-invalid.html input-type-invalid.html
+== input-disabled-fieldset-1.html input-disabled-fieldset-1.html
+fuzzy-if(skiaContent,1,3) == input-disabled-fieldset-2.html input-disabled-fieldset-2.html
+skip fuzzy-if(skiaContent,1,3) == input-fieldset-legend.html input-fieldset-legend.html
+== input-checkbox-required-invalid-changed.html input-checkbox-required-invalid-changed.html
+== input-checkbox-required-invalid-default.html input-checkbox-required-invalid-default.html
+== input-radio-required-invalid-changed.html input-radio-required-invalid-changed.html
+== input-radio-required-invalid-default.html input-radio-required-invalid-default.html
+== input-file-required-invalid-changed.html input-file-required-invalid-changed.html
+== input-file-required-invalid-default.html input-file-required-invalid-default.html
+== input-radio-required.html input-radio-required.html
+== input-radio-customerror.html input-radio-customerror.html
+== input-radio-dyn-valid-1.html input-radio-dyn-valid-1.html
+== input-radio-dyn-valid-2.html input-radio-dyn-valid-2.html
+== input-radio-nogroup-required-valid.html input-radio-nogroup-required-valid.html
+== input-radio-nogroup-required-invalid.html input-radio-nogroup-required-invalid.html
+fails fuzzy-if(skiaContent,1,3) == input-novalidate.html input-novalidate.html
+# input type='hidden' shouldn't show
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 000000000..53198ee42
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/input/reftest.list
@@ -0,0 +1,42 @@
+== input-valid.html input-ref.html
+fuzzy(64,4) == input-customerror.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-disabled.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-dyn-disabled.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-dyn-not-disabled.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-readonly.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-dyn-readonly.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-not-changed.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-changed.html input-ref.html
+== input-required-valid.html input-withtext-ref.html
+fuzzy-if(skiaContent,1,3) == input-required-invalid-default.html input-ref.html
+fuzzy-if(skiaContent,1,3) == input-required-invalid-changed.html input-ref.html
+fuzzy-if(skiaContent,2,5) == input-button.html input-button-ref.html
+fuzzy-if(skiaContent,2,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-if(skiaContent,2,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-if(skiaContent,2,5) == input-type-barred.html input-button-ref.html
+fuzzy(64,4) == input-type-invalid.html input-ref.html
+== input-disabled-fieldset-1.html input-fieldset-ref.html
+fuzzy-if(skiaContent,1,3) == input-disabled-fieldset-2.html input-fieldset-ref.html
+fuzzy-if(skiaContent,1,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
+fuzzy-if(skiaContent,1,3) == input-novalidate.html input-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 000000000..93a61a020
--- /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 000000000..bfa8e0a12
--- /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 000000000..1a5dd9357
--- /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 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-novalidate.html b/layout/reftests/css-ui-invalid/output/output-novalidate.html
new file mode 100644
index 000000000..a124b9a64
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/output-novalidate.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('o').setCustomValidity('foo');
+ document.documentElement.className = '';">
+ <form novalidate>
+ <output id='o' class='notinvalid'>foo</output>
+ </form>
+ </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 000000000..0db2c440c
--- /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 000000000..feb564da9
--- /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 and is not barred from constraint
+ validation, 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-stylo.list b/layout/reftests/css-ui-invalid/output/reftest-stylo.list
new file mode 100644
index 000000000..06d928065
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/reftest-stylo.list
@@ -0,0 +1,4 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== output-valid.html output-valid.html
+== output-invalid.html output-invalid.html
+== output-novalidate.html output-novalidate.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 000000000..2a31473a9
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/output/reftest.list
@@ -0,0 +1,3 @@
+== output-valid.html output-ref.html
+== output-invalid.html output-ref.html
+== output-novalidate.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 000000000..e600dda9a
--- /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: red;
+}
+output.invalid:-moz-ui-invalid {
+ color: green;
+}
+
+output.ref {
+ color: green;
+}
diff --git a/layout/reftests/css-ui-invalid/reftest-stylo.list b/layout/reftests/css-ui-invalid/reftest-stylo.list
new file mode 100644
index 000000000..a0db8feb5
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/reftest-stylo.list
@@ -0,0 +1,10 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+# :-moz-ui-invalid should apply on the following elements
+include button/reftest-stylo.list
+include input/reftest-stylo.list
+include select/reftest-stylo.list
+include textarea/reftest-stylo.list
+include output/reftest-stylo.list
+
+# default :-moz-ui-invalid style
+include default-style/reftest-stylo.list
diff --git a/layout/reftests/css-ui-invalid/reftest.list b/layout/reftests/css-ui-invalid/reftest.list
new file mode 100644
index 000000000..4563deee7
--- /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-stylo.list b/layout/reftests/css-ui-invalid/select/reftest-stylo.list
new file mode 100644
index 000000000..666fa6ad5
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/reftest-stylo.list
@@ -0,0 +1,22 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+needs-focus == select-valid.html select-valid.html
+fails fuzzy-if(skiaContent,1,3) needs-focus == select-invalid.html select-invalid.html
+fails fuzzy-if(skiaContent,2,5) needs-focus == select-invalid-reset.html select-invalid-reset.html
+needs-focus == select-disabled.html select-disabled.html
+skip-if(B2G||Mulet) needs-focus == select-dyn-disabled.html select-dyn-disabled.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+fails fuzzy-if(skiaContent,1,3) needs-focus == select-dyn-not-disabled.html select-dyn-not-disabled.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-1.html select-required-invalid-1.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-2.html select-required-invalid-2.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-changed-1.html select-required-invalid-changed-1.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-changed-2.html select-required-invalid-changed-2.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid.html select-required-valid.html
+needs-focus == select-required-multiple-invalid.html select-required-multiple-invalid.html
+fails fuzzy-if(asyncPan&&!layersGPUAccelerated,84,77) fuzzy-if(skiaContent,1,1000) needs-focus == select-required-multiple-invalid-changed.html select-required-multiple-invalid-changed.html
+needs-focus == select-required-multiple-valid.html select-required-multiple-valid.html
+skip-if(B2G||Mulet) fails-if(Android) fuzzy-if(skiaContent,2,10) needs-focus == select-disabled-fieldset-1.html select-disabled-fieldset-1.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+skip-if(B2G||Mulet) fails-if(Android) fuzzy-if(skiaContent,2,10) needs-focus == select-disabled-fieldset-2.html select-disabled-fieldset-2.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+fuzzy-if(skiaContent,2,10) needs-focus == select-fieldset-legend.html select-fieldset-legend.html
+fails fuzzy-if(skiaContent,1,5) needs-focus == select-novalidate.html select-novalidate.html
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 000000000..1fd197793
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/reftest.list
@@ -0,0 +1,18 @@
+needs-focus == select-valid.html select-ref.html
+fuzzy-if(skiaContent,1,3) needs-focus == select-invalid.html select-ref.html
+fuzzy-if(skiaContent,2,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-if(skiaContent,1,3) needs-focus == select-dyn-not-disabled.html select-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-1.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-2.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-changed-1.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-invalid-changed-2.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid.html select-required-ref.html
+needs-focus == select-required-multiple-invalid.html select-required-multiple-ref.html
+fuzzy-if(asyncPan&&!layersGPUAccelerated,84,77) fuzzy-if(skiaContent,1,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
+fails-if(Android) fuzzy-if(skiaContent&&!Android,2,10) needs-focus == select-disabled-fieldset-1.html select-fieldset-ref.html
+fails-if(Android) fuzzy-if(skiaContent&&!Android,2,10) needs-focus == select-disabled-fieldset-2.html select-fieldset-ref.html
+fuzzy-if(skiaContent,2,10) needs-focus == select-fieldset-legend.html select-fieldset-legend-ref.html
+fuzzy-if(skiaContent,1,5) needs-focus == select-novalidate.html select-required-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 000000000..a1c830371
--- /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 000000000..e466e0305
--- /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 000000000..e3a228a89
--- /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 000000000..a38d8bca3
--- /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 000000000..5fed3005d
--- /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 000000000..bab99531b
--- /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 000000000..5083cea90
--- /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 000000000..3e76408ec
--- /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 000000000..ca82a8022
--- /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 000000000..8b8e7c6fd
--- /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 000000000..df3526dfc
--- /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-novalidate.html b/layout/reftests/css-ui-invalid/select/select-novalidate.html
new file mode 100644
index 000000000..cccd39b80
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/select/select-novalidate.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <form novalidate>
+ <select required id='s' class='notinvalid'>
+ <option selected value="">foo</option>
+ </select>
+ </form>
+ </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 000000000..a28668557
--- /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 000000000..064695c52
--- /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 000000000..7a32805c9
--- /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 000000000..e8f3142fc
--- /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 000000000..c57e38206
--- /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 000000000..547acaea6
--- /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 000000000..d59ee7ee6
--- /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 000000000..a9477333f
--- /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 000000000..8ae8b89b0
--- /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 000000000..3c2bde80a
--- /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 000000000..9fb309b19
--- /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 000000000..268157b6e
--- /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 000000000..e8561a2bd
--- /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-stylo.list b/layout/reftests/css-ui-invalid/textarea/reftest-stylo.list
new file mode 100644
index 000000000..7ef5790a4
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/reftest-stylo.list
@@ -0,0 +1,19 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+== textarea-valid.html textarea-valid.html
+== textarea-customerror.html textarea-customerror.html
+== textarea-disabled.html textarea-disabled.html
+== textarea-dyn-disabled.html textarea-dyn-disabled.html
+== textarea-dyn-not-disabled.html textarea-dyn-not-disabled.html
+== textarea-readonly.html textarea-readonly.html
+== textarea-dyn-readonly.html textarea-dyn-readonly.html
+== textarea-dyn-not-readonly-not-changed.html textarea-dyn-not-readonly-not-changed.html
+== textarea-dyn-not-readonly-changed.html textarea-dyn-not-readonly-changed.html
+skip == textarea-maxlength-valid.html textarea-maxlength-valid.html
+skip == textarea-maxlength-invalid.html textarea-maxlength-invalid.html
+skip == textarea-maxlength-default-value-invalid.html textarea-maxlength-default-value-invalid.html
+== textarea-required-valid.html textarea-required-valid.html
+== textarea-required-invalid.html textarea-required-invalid.html
+== textarea-required-invalid-changed.html textarea-required-invalid-changed.html
+== textarea-disabled-fieldset-1.html textarea-disabled-fieldset-1.html
+== textarea-disabled-fieldset-2.html textarea-disabled-fieldset-2.html
+== textarea-novalidate.html textarea-novalidate.html
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 000000000..3d37890d6
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/reftest.list
@@ -0,0 +1,15 @@
+== 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
+== textarea-novalidate.html textarea-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 000000000..5d78b21de
--- /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 000000000..ebe0fd968
--- /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, false);
+ </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 000000000..7745264a3
--- /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 000000000..9835295ba
--- /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 000000000..702c97132
--- /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 000000000..6a3fa36aa
--- /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, false);
+ </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 000000000..954cfa5a4
--- /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, false);
+ </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 000000000..2e47cfc13
--- /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, false);
+ </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 000000000..3f93d55e3
--- /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, false);
+ </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 000000000..fb54a2b14
--- /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, false);
+ </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 000000000..8e81d23f1
--- /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 000000000..8e734af29
--- /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 000000000..1d01eb043
--- /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-novalidate.html b/layout/reftests/css-ui-invalid/textarea/textarea-novalidate.html
new file mode 100644
index 000000000..66f476ef2
--- /dev/null
+++ b/layout/reftests/css-ui-invalid/textarea/textarea-novalidate.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('t').value = '';
+ document.documentElement.className = '';">
+ <form novalidate>
+ <textarea id='t' required class='notinvalid'></textarea>
+ </form>
+ </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 000000000..0921c62fb
--- /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 000000000..b370a02a0
--- /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 000000000..6fa004393
--- /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, false);
+ </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 000000000..26144cecf
--- /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 000000000..be0e95e4c
--- /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 000000000..58fe81dce
--- /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 000000000..a6a2b79cf
--- /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>