summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-ui-valid
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/css-ui-valid')
-rw-r--r--layout/reftests/css-ui-valid/button/button-button.html9
-rw-r--r--layout/reftests/css-ui-valid/button/button-disabled-fieldset-1.html15
-rw-r--r--layout/reftests/css-ui-valid/button/button-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-ui-valid/button/button-disabled-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/button/button-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/button/button-dyn-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/button/button-dyn-not-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/button/button-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/button/button-fieldset-legend.html14
-rw-r--r--layout/reftests/css-ui-valid/button/button-fieldset-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/button/button-invalid.html8
-rw-r--r--layout/reftests/css-ui-valid/button/button-novalidate.html9
-rw-r--r--layout/reftests/css-ui-valid/button/button-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/button/button-reset.html9
-rw-r--r--layout/reftests/css-ui-valid/button/button-type-barred.html10
-rw-r--r--layout/reftests/css-ui-valid/button/button-type-invalid.html19
-rw-r--r--layout/reftests/css-ui-valid/button/button-valid.html9
-rw-r--r--layout/reftests/css-ui-valid/button/reftest-stylo.list14
-rw-r--r--layout/reftests/css-ui-valid/button/reftest.list13
-rw-r--r--layout/reftests/css-ui-valid/button/style.css18
-rw-r--r--layout/reftests/css-ui-valid/input/input-button-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/input/input-button.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-checkbox-valid-changed.html15
-rw-r--r--layout/reftests/css-ui-valid/input/input-checkbox-valid-default.html14
-rw-r--r--layout/reftests/css-ui-valid/input/input-customerror.html18
-rw-r--r--layout/reftests/css-ui-valid/input/input-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-ui-valid/input/input-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-ui-valid/input/input-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-dyn-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-dyn-not-disabled-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-dyn-not-disabled.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-dyn-not-readonly-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-dyn-not-readonly.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-dyn-readonly.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-email-invalid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-email-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/input/input-email-valid-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-email-valid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-fieldset-legend.html14
-rw-r--r--layout/reftests/css-ui-valid/input/input-fieldset-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-file-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/input/input-file-valid-changed.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-file-valid-default.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-novalidate.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-pattern-invalid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-pattern-valid-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-pattern-valid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-customerror.html16
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-dyn-valid-1.html15
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-dyn-valid-2.html16
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-nogroup-required-invalid.html13
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-nogroup-required-valid.html13
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-required.html15
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-valid-changed.html15
-rw-r--r--layout/reftests/css-ui-valid/input/input-radio-valid-default.html14
-rw-r--r--layout/reftests/css-ui-valid/input/input-readonly.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/input/input-required-invalid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-required-valid-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-required-valid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-reset.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-type-barred.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-type-invalid.html20
-rw-r--r--layout/reftests/css-ui-valid/input/input-url-invalid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-url-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/input/input-url-valid-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/input/input-url-valid.html10
-rw-r--r--layout/reftests/css-ui-valid/input/input-valid.html9
-rw-r--r--layout/reftests/css-ui-valid/input/input-withtext-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/input/reftest-stylo.list47
-rw-r--r--layout/reftests/css-ui-valid/input/reftest.list41
-rw-r--r--layout/reftests/css-ui-valid/input/style.css18
-rw-r--r--layout/reftests/css-ui-valid/input/success-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/output/output-invalid.html9
-rw-r--r--layout/reftests/css-ui-valid/output/output-novalidate.html9
-rw-r--r--layout/reftests/css-ui-valid/output/output-ref.html7
-rw-r--r--layout/reftests/css-ui-valid/output/output-valid.html9
-rw-r--r--layout/reftests/css-ui-valid/output/reftest-stylo.list4
-rw-r--r--layout/reftests/css-ui-valid/output/reftest.list3
-rw-r--r--layout/reftests/css-ui-valid/output/style.css22
-rw-r--r--layout/reftests/css-ui-valid/reftest-stylo.list7
-rw-r--r--layout/reftests/css-ui-valid/reftest.list6
-rw-r--r--layout/reftests/css-ui-valid/select/reftest-stylo.list21
-rw-r--r--layout/reftests/css-ui-valid/select/reftest.list18
-rw-r--r--layout/reftests/css-ui-valid/select/select-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-ui-valid/select/select-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-ui-valid/select/select-disabled-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/select/select-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/select/select-dyn-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/select/select-dyn-not-disabled.html10
-rw-r--r--layout/reftests/css-ui-valid/select/select-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/select/select-fieldset-legend.html14
-rw-r--r--layout/reftests/css-ui-valid/select/select-fieldset-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/select/select-invalid.html9
-rw-r--r--layout/reftests/css-ui-valid/select/select-novalidate.html12
-rw-r--r--layout/reftests/css-ui-valid/select/select-ref.html6
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-invalid.html11
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-multiple-invalid.html12
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-multiple-ref.html10
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-multiple-valid-changed.html24
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-multiple-valid.html12
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-ref.html9
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-valid-1.html11
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-valid-2.html11
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-valid-changed-1.html12
-rw-r--r--layout/reftests/css-ui-valid/select/select-required-valid-changed-2.html12
-rw-r--r--layout/reftests/css-ui-valid/select/select-valid-reset.html15
-rw-r--r--layout/reftests/css-ui-valid/select/select-valid.html9
-rw-r--r--layout/reftests/css-ui-valid/select/style.css18
-rw-r--r--layout/reftests/css-ui-valid/textarea/reftest-stylo.list21
-rw-r--r--layout/reftests/css-ui-valid/textarea/reftest.list17
-rw-r--r--layout/reftests/css-ui-valid/textarea/style.css26
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-customerror.html18
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-disabled.html9
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-dyn-disabled.html18
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled-changed.html19
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled.html18
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly-changed.html19
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly.html18
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-dyn-readonly.html18
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-fieldset-legend-ref.html11
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-fieldset-legend.html14
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-fieldset-ref.html11
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-novalidate.html10
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-readonly.html9
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-ref.html7
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-required-invalid.html10
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-required-valid-changed.html11
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-required-valid.html10
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-valid.html9
-rw-r--r--layout/reftests/css-ui-valid/textarea/textarea-withtext-ref.html7
134 files changed, 1662 insertions, 0 deletions
diff --git a/layout/reftests/css-ui-valid/button/button-button.html b/layout/reftests/css-ui-valid/button/button-button.html
new file mode 100644
index 000000000..c58eab7ff
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-button.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if button is of the button type, it is barred from constraint
+ validation and should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='notvalid' type='button'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-disabled-fieldset-1.html b/layout/reftests/css-ui-valid/button/button-disabled-fieldset-1.html
new file mode 100644
index 000000000..1374cdfee
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-disabled-fieldset-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if button has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <fieldset>
+ <button class='notvalid'></button>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/button/button-disabled-fieldset-2.html b/layout/reftests/css-ui-valid/button/button-disabled-fieldset-2.html
new file mode 100644
index 000000000..4f18437d7
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-disabled-fieldset-2.html
@@ -0,0 +1,23 @@
+<!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 :valid
+ 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>
+ <button class='notvalid'></button>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-disabled-ref.html b/layout/reftests/css-ui-valid/button/button-disabled-ref.html
new file mode 100644
index 000000000..7de1ba7c5
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/button/button-disabled.html b/layout/reftests/css-ui-valid/button/button-disabled.html
new file mode 100644
index 000000000..d22a7d1df
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='notvalid' disabled></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-dyn-disabled.html b/layout/reftests/css-ui-valid/button/button-dyn-disabled.html
new file mode 100644
index 000000000..00c07034e
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-dyn-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').disabled='true'; document.documentElement.className='';">
+ <button class='notvalid' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-dyn-not-disabled.html b/layout/reftests/css-ui-valid/button/button-dyn-not-disabled.html
new file mode 100644
index 000000000..671573cc3
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-dyn-not-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button is not disabled, it is candidate for constraint validation
+ and should be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').removeAttribute('disabled'); document.documentElement.className='';">
+ <button class='valid' id='b' disabled></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-fieldset-legend-ref.html b/layout/reftests/css-ui-valid/button/button-fieldset-legend-ref.html
new file mode 100644
index 000000000..22adc433c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/button/button-fieldset-legend.html b/layout/reftests/css-ui-valid/button/button-fieldset-legend.html
new file mode 100644
index 000000000..34159d618
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-fieldset-legend.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- 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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <button class='valid'></button>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-fieldset-ref.html b/layout/reftests/css-ui-valid/button/button-fieldset-ref.html
new file mode 100644
index 000000000..60ab1a3ef
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/button/button-invalid.html b/layout/reftests/css-ui-valid/button/button-invalid.html
new file mode 100644
index 000000000..9b0524745
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-invalid.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: button element is never affected by :-moz-ui-valid. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <button class='notvalid' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-novalidate.html b/layout/reftests/css-ui-valid/button/button-novalidate.html
new file mode 100644
index 000000000..455021330
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-novalidate.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <form novalidate>
+ <button class='notvalid'></button>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-ref.html b/layout/reftests/css-ui-valid/button/button-ref.html
new file mode 100644
index 000000000..422cc9315
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/button/button-reset.html b/layout/reftests/css-ui-valid/button/button-reset.html
new file mode 100644
index 000000000..81547909b
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-reset.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if button is of the reset type, it is barred from constraint
+ validation and should not be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='notvalid' type='reset'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-type-barred.html b/layout/reftests/css-ui-valid/button/button-type-barred.html
new file mode 100644
index 000000000..db630d300
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/button-type-barred.html
@@ -0,0 +1,10 @@
+<!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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').type='button'; document.documentElement.className='';">
+ <button class='notvalid' type='submit' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-type-invalid.html b/layout/reftests/css-ui-valid/button/button-type-invalid.html
new file mode 100644
index 000000000..637f5aec5
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 :valid 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='notvalid' type='button' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/button-valid.html b/layout/reftests/css-ui-valid/button/button-valid.html
new file mode 100644
index 000000000..468fcb175
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 :valid pseudo-class -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <button class='valid'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/button/reftest-stylo.list b/layout/reftests/css-ui-valid/button/reftest-stylo.list
new file mode 100644
index 000000000..26f44fe35
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/reftest-stylo.list
@@ -0,0 +1,14 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+fuzzy-if(skiaContent,2,2) == button-valid.html button-valid.html
+fails fuzzy-if(skiaContent,2,3) == button-invalid.html button-invalid.html
+== button-disabled.html button-disabled.html
+fuzzy-if(skiaContent,1,3) == button-dyn-disabled.html button-dyn-disabled.html
+fails fuzzy-if(skiaContent,2,3) == button-dyn-not-disabled.html button-dyn-not-disabled.html
+fuzzy-if(skiaContent,2,3) == button-button.html button-button.html
+fails fuzzy-if(skiaContent,2,3) == button-reset.html button-reset.html
+fails fuzzy-if(skiaContent,2,3) == button-type-invalid.html button-type-invalid.html
+fails fuzzy-if(skiaContent,2,3) == button-type-barred.html button-type-barred.html
+== 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,3) == button-fieldset-legend.html button-fieldset-legend.html
+fails fuzzy-if(skiaContent,2,2) == button-novalidate.html button-novalidate.html
diff --git a/layout/reftests/css-ui-valid/button/reftest.list b/layout/reftests/css-ui-valid/button/reftest.list
new file mode 100644
index 000000000..af75c62ba
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/reftest.list
@@ -0,0 +1,13 @@
+fuzzy-if(skiaContent,2,2) == button-valid.html button-ref.html
+fuzzy-if(skiaContent,2,3) == button-invalid.html button-ref.html
+== button-disabled.html button-disabled-ref.html
+fuzzy-if(skiaContent,1,3) == button-dyn-disabled.html button-disabled-ref.html
+fuzzy-if(skiaContent,2,3) == button-dyn-not-disabled.html button-ref.html
+fuzzy-if(skiaContent,2,3) == button-button.html button-ref.html
+fuzzy-if(skiaContent,2,3) == button-reset.html button-ref.html
+fuzzy-if(skiaContent,2,3) == button-type-invalid.html button-ref.html
+fuzzy-if(skiaContent,2,3) == button-type-barred.html button-ref.html
+== 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,3) == button-fieldset-legend.html button-fieldset-legend-ref.html
+fuzzy-if(skiaContent,2,2) == button-novalidate.html button-ref.html
diff --git a/layout/reftests/css-ui-valid/button/style.css b/layout/reftests/css-ui-valid/button/style.css
new file mode 100644
index 000000000..ee57842a8
--- /dev/null
+++ b/layout/reftests/css-ui-valid/button/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+button:invalid {
+ box-shadow: none;
+}
+
+button.notvalid {
+ background-color: green;
+}
+button.notvalid:-moz-ui-valid {
+ background-color: red;
+}
+
+button.valid {
+ background-color: red;
+}
+button.valid:-moz-ui-valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-valid/input/input-button-ref.html b/layout/reftests/css-ui-valid/input/input-button-ref.html
new file mode 100644
index 000000000..3b828533e
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/input-button.html b/layout/reftests/css-ui-valid/input/input-button.html
new file mode 100644
index 000000000..75898b565
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' type='button'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-checkbox-valid-changed.html b/layout/reftests/css-ui-valid/input/input-checkbox-valid-changed.html
new file mode 100644
index 000000000..3ba877abb
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-checkbox-valid-changed.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is valid and its checkedness has changed,
+ it should be affected by :-moz-ui-valid 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-valid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='checkbox'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-checkbox-valid-default.html b/layout/reftests/css-ui-valid/input/input-checkbox-valid-default.html
new file mode 100644
index 000000000..fd7a9c594
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-checkbox-valid-default.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is valid and its checkedness hasn't changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (document.getElementById('i').matches(':-moz-ui-valid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='checkbox'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-customerror.html b/layout/reftests/css-ui-valid/input/input-customerror.html
new file mode 100644
index 000000000..3e7875809
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 not be affected by :-moz-ui-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' id='t'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-disabled-fieldset-1.html b/layout/reftests/css-ui-valid/input/input-disabled-fieldset-1.html
new file mode 100644
index 000000000..2a8450132
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <fieldset>
+ <input class='notvalid'>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-disabled-fieldset-2.html b/layout/reftests/css-ui-valid/input/input-disabled-fieldset-2.html
new file mode 100644
index 000000000..db13e2559
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid
+ 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='notvalid'>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-disabled.html b/layout/reftests/css-ui-valid/input/input-disabled.html
new file mode 100644
index 000000000..f658b2d0c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' disabled>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-dyn-disabled.html b/layout/reftests/css-ui-valid/input/input-dyn-disabled.html
new file mode 100644
index 000000000..dc8978196
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-dyn-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').disabled='true'; document.documentElement.className='';">
+ <input class='notvalid' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-dyn-not-disabled-changed.html b/layout/reftests/css-ui-valid/input/input-dyn-not-disabled-changed.html
new file mode 100644
index 000000000..535121db1
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-dyn-not-disabled-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is not disabled and its value has been changed,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').removeAttribute('disabled');
+ document.getElementById('i').value = '';
+ document.documentElement.className='';">
+ <input class='valid' id='i' disabled>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-dyn-not-disabled.html b/layout/reftests/css-ui-valid/input/input-dyn-not-disabled.html
new file mode 100644
index 000000000..3ba00d7a5
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-dyn-not-disabled.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is not disabled but its value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').removeAttribute('disabled');
+ document.documentElement.className='';">
+ <input class='notvalid' id='i' disabled>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-dyn-not-readonly-changed.html b/layout/reftests/css-ui-valid/input/input-dyn-not-readonly-changed.html
new file mode 100644
index 000000000..c50a61a45
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-dyn-not-readonly-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is no longer readonly and its value has been changed,
+ it should be affected by :-moz-ui-valid 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='valid' id='i' readonly>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-dyn-not-readonly.html b/layout/reftests/css-ui-valid/input/input-dyn-not-readonly.html
new file mode 100644
index 000000000..9a6c92d39
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-dyn-not-readonly.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is no longer readonly and its value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').removeAttribute('readonly');
+ document.documentElement.className='';">
+ <input class='notvalid' id='i' readonly>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-dyn-readonly.html b/layout/reftests/css-ui-valid/input/input-dyn-readonly.html
new file mode 100644
index 000000000..63cec69cb
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').readOnly='ro'; document.documentElement.className='';">
+ <input class='notvalid' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-email-invalid.html b/layout/reftests/css-ui-valid/input/input-email-invalid.html
new file mode 100644
index 000000000..622ccc142
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-email-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' type='email' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-email-ref.html b/layout/reftests/css-ui-valid/input/input-email-ref.html
new file mode 100644
index 000000000..ecec613c2
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/input-email-valid-changed.html b/layout/reftests/css-ui-valid/input/input-email-valid-changed.html
new file mode 100644
index 000000000..ea3a33e8c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-email-valid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input is valid and its value has been changed,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value = 'foo@bar.com';
+ document.documentElement.className = '';">
+ <input id='i' class='valid' type='email'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-email-valid.html b/layout/reftests/css-ui-valid/input/input-email-valid.html
new file mode 100644
index 000000000..05020dac8
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-email-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid but its value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' type='email' value='foo@bar.com'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-fieldset-legend-ref.html b/layout/reftests/css-ui-valid/input/input-fieldset-legend-ref.html
new file mode 100644
index 000000000..8d39d9164
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-fieldset-legend-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <legend>
+ <input style="background-color: green;"></input>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-fieldset-legend.html b/layout/reftests/css-ui-valid/input/input-fieldset-legend.html
new file mode 100644
index 000000000..f48b46c1c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-fieldset-legend.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input 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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <input class='notvalid'></input>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-fieldset-ref.html b/layout/reftests/css-ui-valid/input/input-fieldset-ref.html
new file mode 100644
index 000000000..a9e123912
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/input-file-ref.html b/layout/reftests/css-ui-valid/input/input-file-ref.html
new file mode 100644
index 000000000..73a4fc64c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/input-file-valid-changed.html b/layout/reftests/css-ui-valid/input/input-file-valid-changed.html
new file mode 100644
index 000000000..9ea52fcea
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-file-valid-changed.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input is valid and its default value has been changed,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value='';
+ document.documentElement.className='';">
+ <input id='i' class='valid' type='file'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-file-valid-default.html b/layout/reftests/css-ui-valid/input/input-file-valid-default.html
new file mode 100644
index 000000000..b940be643
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-file-valid-default.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid but its default value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' type='file'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-novalidate.html b/layout/reftests/css-ui-valid/input/input-novalidate.html
new file mode 100644
index 000000000..0247069d7
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 = 'foo';
+ document.documentElement.className = '';">
+ <form novalidate>
+ <input id='i' class='notvalid' required>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-pattern-invalid.html b/layout/reftests/css-ui-valid/input/input-pattern-invalid.html
new file mode 100644
index 000000000..2efb1748c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-pattern-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' pattern='bar' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-pattern-valid-changed.html b/layout/reftests/css-ui-valid/input/input-pattern-valid-changed.html
new file mode 100644
index 000000000..edf4bc710
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-pattern-valid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input is valid and its value has been changed,
+ it should be affected by :-moz-ui-valid 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='valid' pattern='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-pattern-valid.html b/layout/reftests/css-ui-valid/input/input-pattern-valid.html
new file mode 100644
index 000000000..b9f4db273
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-pattern-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid but its value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' pattern='foo' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-radio-customerror.html b/layout/reftests/css-ui-valid/input/input-radio-customerror.html
new file mode 100644
index 000000000..691766723
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-radio-customerror.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <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-valid') ||
+ !document.getElementById('i2').matches(':-moz-ui-valid')) {
+ 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-valid/input/input-radio-dyn-valid-1.html b/layout/reftests/css-ui-valid/input/input-radio-dyn-valid-1.html
new file mode 100644
index 000000000..3aa77deee
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-radio-dyn-valid-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i1').checked = true;
+ if (!document.getElementById('i1').matches(':-moz-ui-valid') ||
+ !document.getElementById('i2').matches(':-moz-ui-valid')) {
+ 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-valid/input/input-radio-dyn-valid-2.html b/layout/reftests/css-ui-valid/input/input-radio-dyn-valid-2.html
new file mode 100644
index 000000000..c5fbb9eac
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-radio-dyn-valid-2.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <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-valid') ||
+ !document.getElementById('i2').matches(':-moz-ui-valid')) {
+ 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-valid/input/input-radio-nogroup-required-invalid.html b/layout/reftests/css-ui-valid/input/input-radio-nogroup-required-invalid.html
new file mode 100644
index 000000000..43285750c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid')) {
+ 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-valid/input/input-radio-nogroup-required-valid.html b/layout/reftests/css-ui-valid/input/input-radio-nogroup-required-valid.html
new file mode 100644
index 000000000..3306c31fc
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid')) {
+ 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-valid/input/input-radio-required.html b/layout/reftests/css-ui-valid/input/input-radio-required.html
new file mode 100644
index 000000000..8af43a24c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-radio-required.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i1').checked = false;
+ if (document.getElementById('i1').matches(':-moz-ui-valid') ||
+ document.getElementById('i2').matches(':-moz-ui-valid')) {
+ 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-valid/input/input-radio-valid-changed.html b/layout/reftests/css-ui-valid/input/input-radio-valid-changed.html
new file mode 100644
index 000000000..77b5900e6
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-radio-valid-changed.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is valid and its checkedness has changed,
+ it should be affected by :-moz-ui-valid 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-valid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-radio-valid-default.html b/layout/reftests/css-ui-valid/input/input-radio-valid-default.html
new file mode 100644
index 000000000..360aeb21f
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-radio-valid-default.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is valid and its checkedness hasn't changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (document.getElementById('i').matches(':-moz-ui-valid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-readonly.html b/layout/reftests/css-ui-valid/input/input-readonly.html
new file mode 100644
index 000000000..f52a189f0
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' readonly>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-ref.html b/layout/reftests/css-ui-valid/input/input-ref.html
new file mode 100644
index 000000000..65b4b9707
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/input-required-invalid.html b/layout/reftests/css-ui-valid/input/input-required-invalid.html
new file mode 100644
index 000000000..56ac86422
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-required-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-required-valid-changed.html b/layout/reftests/css-ui-valid/input/input-required-valid-changed.html
new file mode 100644
index 000000000..f67732eaf
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-required-valid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input is valid and its value has been changed,
+ it should be affected by :-moz-ui-valid 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='valid' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-required-valid.html b/layout/reftests/css-ui-valid/input/input-required-valid.html
new file mode 100644
index 000000000..a4fe4e006
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-required-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and its value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' value='foo' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-reset.html b/layout/reftests/css-ui-valid/input/input-reset.html
new file mode 100644
index 000000000..6e73d6a13
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid 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='notvalid' type='reset' value=''>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-type-barred.html b/layout/reftests/css-ui-valid/input/input-type-barred.html
new file mode 100644
index 000000000..fea39eb5a
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').type='button'; document.documentElement.className='';">
+ <input class='notvalid' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-type-invalid.html b/layout/reftests/css-ui-valid/input/input-type-invalid.html
new file mode 100644
index 000000000..3fa4a5556
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 :-moz-ui-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='notvalid' type='button' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-url-invalid.html b/layout/reftests/css-ui-valid/input/input-url-invalid.html
new file mode 100644
index 000000000..f0f99a01e
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-url-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input isn't valid nor barred from constraint validation,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' type='url' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-url-ref.html b/layout/reftests/css-ui-valid/input/input-url-ref.html
new file mode 100644
index 000000000..e95cdbca2
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/input-url-valid-changed.html b/layout/reftests/css-ui-valid/input/input-url-valid-changed.html
new file mode 100644
index 000000000..76bfea089
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-url-valid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if input is valid and its value has been changed,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('i').value = 'http://mozilla.org/';
+ document.documentElement.className = '';">
+ <input id='i' class='valid' type='url'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-url-valid.html b/layout/reftests/css-ui-valid/input/input-url-valid.html
new file mode 100644
index 000000000..7d20970a4
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/input-url-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and its value hasn't been changed,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid' type='url' value='http://mozilla.org/'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/input/input-valid.html b/layout/reftests/css-ui-valid/input/input-valid.html
new file mode 100644
index 000000000..0e0440d0e
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='notvalid'>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/input/input-withtext-ref.html b/layout/reftests/css-ui-valid/input/input-withtext-ref.html
new file mode 100644
index 000000000..d54d05215
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/input/reftest-stylo.list b/layout/reftests/css-ui-valid/input/reftest-stylo.list
new file mode 100644
index 000000000..acf1da14b
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/reftest-stylo.list
@@ -0,0 +1,47 @@
+# 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
+fails-if(B2G||Mulet) == input-disabled.html input-disabled.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+fails-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
+fails fuzzy-if(skiaContent,1,3) == input-dyn-not-disabled-changed.html input-dyn-not-disabled-changed.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
+fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly.html input-dyn-not-readonly.html
+skip == input-dyn-not-readonly-changed.html input-dyn-not-readonly-changed.html
+skip == input-maxlength-valid.html input-maxlength-valid.html
+skip == input-maxlength-valid-changed.html input-maxlength-valid-changed.html
+skip == input-maxlength-invalid.html input-maxlength-invalid.html
+== input-required-valid.html input-required-valid.html
+== input-required-valid-changed.html input-required-valid-changed.html
+fuzzy-if(skiaContent,1,3) == input-required-invalid.html input-required-invalid.html
+== input-button.html input-button.html
+skip == input-reset.html input-reset.html
+== input-email-invalid.html input-email-invalid.html
+== input-email-valid.html input-email-valid.html
+== input-email-valid-changed.html input-email-valid-changed.html
+== input-url-invalid.html input-url-invalid.html
+== input-url-valid.html input-url-valid.html
+== input-url-valid-changed.html input-url-valid-changed.html
+== input-pattern-valid.html input-pattern-valid.html
+skip == input-pattern-valid-changed.html input-pattern-valid-changed.html
+== input-pattern-invalid.html input-pattern-invalid.html
+== 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-valid-changed.html input-checkbox-valid-changed.html
+== input-checkbox-valid-default.html input-checkbox-valid-default.html
+skip == input-file-valid-changed.html input-file-valid-changed.html
+== input-file-valid-default.html input-file-valid-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-valid/input/reftest.list b/layout/reftests/css-ui-valid/input/reftest.list
new file mode 100644
index 000000000..1745cfd54
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/reftest.list
@@ -0,0 +1,41 @@
+== input-valid.html input-ref.html
+fuzzy(11,4) == input-customerror.html input-ref.html
+== 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-dyn-not-disabled-changed.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.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
+== input-required-valid-changed.html input-withtext-ref.html
+fuzzy-if(skiaContent,1,3) == input-required-invalid.html input-ref.html
+== input-button.html input-button-ref.html
+== input-reset.html input-button-ref.html
+== input-email-invalid.html input-withtext-ref.html
+== input-email-valid.html input-email-ref.html
+== input-email-valid-changed.html input-email-ref.html
+== input-url-invalid.html input-withtext-ref.html
+== input-url-valid.html input-url-ref.html
+== input-url-valid-changed.html input-url-ref.html
+== input-pattern-valid.html input-withtext-ref.html
+== input-pattern-valid-changed.html input-withtext-ref.html
+== input-pattern-invalid.html input-withtext-ref.html
+== 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-valid-changed.html success-ref.html
+== input-checkbox-valid-default.html success-ref.html
+== input-file-valid-changed.html input-file-ref.html
+== input-file-valid-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-withtext-ref.html
+# input type='hidden' shouldn't show
diff --git a/layout/reftests/css-ui-valid/input/style.css b/layout/reftests/css-ui-valid/input/style.css
new file mode 100644
index 000000000..aa3f74b3c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+input:invalid {
+ box-shadow: none;
+}
+
+input.notvalid {
+ background-color: green;
+}
+input.notvalid:-moz-ui-valid {
+ background-color: red;
+}
+
+input.valid {
+ background-color: red;
+}
+input.valid:-moz-ui-valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-valid/input/success-ref.html b/layout/reftests/css-ui-valid/input/success-ref.html
new file mode 100644
index 000000000..bfa8e0a12
--- /dev/null
+++ b/layout/reftests/css-ui-valid/input/success-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ SUCCESS
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/output/output-invalid.html b/layout/reftests/css-ui-valid/output/output-invalid.html
new file mode 100644
index 000000000..83e824350
--- /dev/null
+++ b/layout/reftests/css-ui-valid/output/output-invalid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if output has a custom error, it should not be affected by :-moz-ui-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <output class='notvalid' id='b'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/output/output-novalidate.html b/layout/reftests/css-ui-valid/output/output-novalidate.html
new file mode 100644
index 000000000..1eea9689c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/output/output-novalidate.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <form novalidate>
+ <output class='notvalid'>foo</output>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/output/output-ref.html b/layout/reftests/css-ui-valid/output/output-ref.html
new file mode 100644
index 000000000..0db2c440c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/output/output-valid.html b/layout/reftests/css-ui-valid/output/output-valid.html
new file mode 100644
index 000000000..9f7321dae
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <output class='valid'>foo</output>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/output/reftest-stylo.list b/layout/reftests/css-ui-valid/output/reftest-stylo.list
new file mode 100644
index 000000000..06d928065
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/output/reftest.list b/layout/reftests/css-ui-valid/output/reftest.list
new file mode 100644
index 000000000..2a31473a9
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/output/style.css b/layout/reftests/css-ui-valid/output/style.css
new file mode 100644
index 000000000..2e71a25d9
--- /dev/null
+++ b/layout/reftests/css-ui-valid/output/style.css
@@ -0,0 +1,22 @@
+/* Override default style */
+output {
+ color: black;
+}
+
+output.notvalid {
+ color: green;
+}
+output.notvalid:-moz-ui-valid {
+ color: red;
+}
+
+output.valid {
+ color: red;
+}
+output.valid:-moz-ui-valid {
+ color: green;
+}
+
+output.ref {
+ color: green;
+}
diff --git a/layout/reftests/css-ui-valid/reftest-stylo.list b/layout/reftests/css-ui-valid/reftest-stylo.list
new file mode 100644
index 000000000..bc70990c3
--- /dev/null
+++ b/layout/reftests/css-ui-valid/reftest-stylo.list
@@ -0,0 +1,7 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+# :-moz-ui-valid 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
diff --git a/layout/reftests/css-ui-valid/reftest.list b/layout/reftests/css-ui-valid/reftest.list
new file mode 100644
index 000000000..5a765bd71
--- /dev/null
+++ b/layout/reftests/css-ui-valid/reftest.list
@@ -0,0 +1,6 @@
+# :-moz-ui-valid 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
diff --git a/layout/reftests/css-ui-valid/select/reftest-stylo.list b/layout/reftests/css-ui-valid/select/reftest-stylo.list
new file mode 100644
index 000000000..efd559ede
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/reftest-stylo.list
@@ -0,0 +1,21 @@
+# 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,2,5) needs-focus == select-valid-reset.html select-valid-reset.html
+fails fuzzy-if(skiaContent,1,3) needs-focus == select-invalid.html select-invalid.html
+fuzzy-if(skiaContent,2,4) needs-focus == select-disabled.html select-disabled.html
+fuzzy-if(skiaContent,2,4) needs-focus == select-dyn-disabled.html select-dyn-disabled.html
+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.html select-required-invalid.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-1.html select-required-valid-1.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-2.html select-required-valid-2.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-changed-1.html select-required-valid-changed-1.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-changed-2.html select-required-valid-changed-2.html
+needs-focus == select-required-multiple-invalid.html select-required-multiple-invalid.html
+needs-focus == select-required-multiple-valid.html select-required-multiple-valid.html
+fails fuzzy-if(asyncPan&&layersGPUAccelerated,84,77) fuzzy-if(skiaContent,1,1000) needs-focus == select-required-multiple-valid-changed.html select-required-multiple-valid-changed.html
+fails-if(Android||B2G||Mulet) needs-focus == select-disabled-fieldset-1.html select-disabled-fieldset-1.html
+# Initial mulet triage: parity with B2G/B2G Desktop
+fails-if(Android||B2G||Mulet) 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,2,5) needs-focus == select-novalidate.html select-novalidate.html
diff --git a/layout/reftests/css-ui-valid/select/reftest.list b/layout/reftests/css-ui-valid/select/reftest.list
new file mode 100644
index 000000000..082a6fc0c
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/reftest.list
@@ -0,0 +1,18 @@
+needs-focus == select-valid.html select-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-valid-reset.html select-required-ref.html
+fuzzy-if(skiaContent,1,3) needs-focus == select-invalid.html select-ref.html
+fuzzy-if(skiaContent,2,4) needs-focus == select-disabled.html select-disabled-ref.html
+fuzzy-if(skiaContent,2,4) 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.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-1.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-2.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-changed-1.html select-required-ref.html
+fuzzy-if(skiaContent,2,5) needs-focus == select-required-valid-changed-2.html select-required-ref.html
+needs-focus == select-required-multiple-invalid.html select-required-multiple-ref.html
+needs-focus == select-required-multiple-valid.html select-required-multiple-ref.html
+fuzzy(64,4) fuzzy-if(asyncPan&&layersGPUAccelerated,84,77) fuzzy-if(skiaContent,1,1000) needs-focus == select-required-multiple-valid-changed.html select-required-multiple-ref.html
+fails-if(Android) 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,2,5) needs-focus == select-novalidate.html select-required-ref.html
diff --git a/layout/reftests/css-ui-valid/select/select-disabled-fieldset-1.html b/layout/reftests/css-ui-valid/select/select-disabled-fieldset-1.html
new file mode 100644
index 000000000..43a6941f4
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-disabled-fieldset-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select has a disabled fieldset ancestor, it is barred from
+ constraint validation and should not be affected by :-moz-ui-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <fieldset>
+ <select class='notvalid'></select>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-disabled-fieldset-2.html b/layout/reftests/css-ui-valid/select/select-disabled-fieldset-2.html
new file mode 100644
index 000000000..22b2fe780
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-disabled-fieldset-2.html
@@ -0,0 +1,23 @@
+<!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-valid
+ 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>
+ <select class='notvalid'></select>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-disabled-ref.html b/layout/reftests/css-ui-valid/select/select-disabled-ref.html
new file mode 100644
index 000000000..e3a228a89
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/select/select-disabled.html b/layout/reftests/css-ui-valid/select/select-disabled.html
new file mode 100644
index 000000000..0a3395320
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid' disabled></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-dyn-disabled.html b/layout/reftests/css-ui-valid/select/select-dyn-disabled.html
new file mode 100644
index 000000000..43054fd56
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-dyn-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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').disabled='true'; document.documentElement.className='';">
+ <select class='notvalid' id='s'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-dyn-not-disabled.html b/layout/reftests/css-ui-valid/select/select-dyn-not-disabled.html
new file mode 100644
index 000000000..fbf34b020
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-dyn-not-disabled.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select is not disabled but it's value hasn't changed,
+ it should not be affected:-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').removeAttribute('disabled');
+ document.documentElement.className='';">
+ <select class='notvalid' id='s' disabled></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-fieldset-legend-ref.html b/layout/reftests/css-ui-valid/select/select-fieldset-legend-ref.html
new file mode 100644
index 000000000..5083cea90
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/select/select-fieldset-legend.html b/layout/reftests/css-ui-valid/select/select-fieldset-legend.html
new file mode 100644
index 000000000..9711f39c2
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-fieldset-legend.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- 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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <select class='notvalid'></select>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-fieldset-ref.html b/layout/reftests/css-ui-valid/select/select-fieldset-ref.html
new file mode 100644
index 000000000..ca82a8022
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/select/select-invalid.html b/layout/reftests/css-ui-valid/select/select-invalid.html
new file mode 100644
index 000000000..83a3b79f2
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-invalid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select has a custom error, it should not be affected by :-moz-ui-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').setCustomValidity('foo'); document.documentElement.className='';">
+ <select class='notvalid' id='s'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-novalidate.html b/layout/reftests/css-ui-valid/select/select-novalidate.html
new file mode 100644
index 000000000..54c951d70
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-novalidate.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('s').selectedIndex = 0;
+ document.documentElement.className = '';">
+ <form novalidate>
+ <select id='s' class='notvalid'>
+ <option>foo</option>
+ </select>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-ref.html b/layout/reftests/css-ui-valid/select/select-ref.html
new file mode 100644
index 000000000..a28668557
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/select/select-required-invalid.html b/layout/reftests/css-ui-valid/select/select-required-invalid.html
new file mode 100644
index 000000000..e4569fb0f
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-invalid.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a select option which has an empty
+ string value, :-moz-ui-valid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid' required>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html></html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-multiple-invalid.html b/layout/reftests/css-ui-valid/select/select-required-multiple-invalid.html
new file mode 100644
index 000000000..4a862dbca
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-multiple-invalid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has all selected option value set to the
+ string string, :-moz-ui-valid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid' required multiple>
+ <option selected></option>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-multiple-ref.html b/layout/reftests/css-ui-valid/select/select-required-multiple-ref.html
new file mode 100644
index 000000000..a9477333f
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/select/select-required-multiple-valid-changed.html b/layout/reftests/css-ui-valid/select/select-required-multiple-valid-changed.html
new file mode 100644
index 000000000..704a6e80a
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-multiple-valid-changed.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('s').options[0].selected = false;
+ document.getElementById('s').options[1].selected = false;
+ document.getElementById('s').options[0].selected = true;
+ document.getElementById('s').options[1].selected = true;
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest, false);
+ </script>
+ </head>
+ <!-- Test: if select is required and has at least one option selected and the
+ selection did changed, :-moz-ui-valid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select id='s' class='valid' required multiple>
+ <option selected></option>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-multiple-valid.html b/layout/reftests/css-ui-valid/select/select-required-multiple-valid.html
new file mode 100644
index 000000000..572d6477f
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-multiple-valid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has at least one option selected but the
+ selection didn't changed, :-moz-ui-valid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid' required multiple>
+ <option selected></option>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-ref.html b/layout/reftests/css-ui-valid/select/select-required-ref.html
new file mode 100644
index 000000000..3c2bde80a
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/select/select-required-valid-1.html b/layout/reftests/css-ui-valid/select/select-required-valid-1.html
new file mode 100644
index 000000000..a092e3fcb
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-valid-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a selected option but the selection
+ didn't changed, :-moz-ui-valid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid' required>
+ <option>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-valid-2.html b/layout/reftests/css-ui-valid/select/select-required-valid-2.html
new file mode 100644
index 000000000..c4cf9aec5
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-valid-2.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a selected option but the selection
+ didn't changed, :-moz-ui-valid should not apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid' required>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-valid-changed-1.html b/layout/reftests/css-ui-valid/select/select-required-valid-changed-1.html
new file mode 100644
index 000000000..89095e7b9
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-valid-changed-1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if select is required and has a selected option and the selection
+ did changed, :-moz-ui-valid 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='valid' required>
+ <option>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-required-valid-changed-2.html b/layout/reftests/css-ui-valid/select/select-required-valid-changed-2.html
new file mode 100644
index 000000000..421fee51e
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-required-valid-changed-2.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if select is required and has a selected option and the selection
+ did changed, :-moz-ui-valid 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='valid' required>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-valid-reset.html b/layout/reftests/css-ui-valid/select/select-valid-reset.html
new file mode 100644
index 000000000..a2b22a176
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/select-valid-reset.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class='reftest-wait'>
+ <!-- Test: if select has no custom error and is not barred from constraint
+ validation, it should be affected by :-moz-ui-valid 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='notvalid' required>
+ <option>foo</option>
+ </select>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/select-valid.html b/layout/reftests/css-ui-valid/select/select-valid.html
new file mode 100644
index 000000000..e3adb623d
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='notvalid'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/select/style.css b/layout/reftests/css-ui-valid/select/style.css
new file mode 100644
index 000000000..ea29b7ad0
--- /dev/null
+++ b/layout/reftests/css-ui-valid/select/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+select:invalid {
+ box-shadow: none;
+}
+
+select.notvalid {
+ background-color: green;
+}
+select.notvalid:-moz-ui-valid {
+ background-color: red;
+}
+
+select.valid {
+ background-color: red;
+}
+select.valid:-moz-ui-valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-valid/textarea/reftest-stylo.list b/layout/reftests/css-ui-valid/textarea/reftest-stylo.list
new file mode 100644
index 000000000..06417ad92
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/reftest-stylo.list
@@ -0,0 +1,21 @@
+# 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-dyn-not-disabled-changed.html textarea-dyn-not-disabled-changed.html
+== textarea-readonly.html textarea-readonly.html
+== textarea-dyn-readonly.html textarea-dyn-readonly.html
+== textarea-dyn-not-readonly.html textarea-dyn-not-readonly.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-valid-changed.html textarea-maxlength-valid-changed.html
+skip == textarea-maxlength-invalid.html textarea-maxlength-invalid.html
+== textarea-required-valid.html textarea-required-valid.html
+== textarea-required-valid-changed.html textarea-required-valid-changed.html
+== textarea-required-invalid.html textarea-required-invalid.html
+== textarea-disabled-fieldset-1.html textarea-disabled-fieldset-1.html
+== textarea-disabled-fieldset-2.html textarea-disabled-fieldset-2.html
+== textarea-fieldset-legend.html textarea-fieldset-legend.html
+== textarea-novalidate.html textarea-novalidate.html
diff --git a/layout/reftests/css-ui-valid/textarea/reftest.list b/layout/reftests/css-ui-valid/textarea/reftest.list
new file mode 100644
index 000000000..84faafe83
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/reftest.list
@@ -0,0 +1,17 @@
+== 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-dyn-not-disabled-changed.html textarea-ref.html
+== textarea-readonly.html textarea-ref.html
+== textarea-dyn-readonly.html textarea-ref.html
+== textarea-dyn-not-readonly.html textarea-ref.html
+== textarea-dyn-not-readonly-changed.html textarea-ref.html
+== textarea-required-valid.html textarea-withtext-ref.html
+== textarea-required-valid-changed.html textarea-withtext-ref.html
+== textarea-required-invalid.html textarea-ref.html
+== textarea-disabled-fieldset-1.html textarea-fieldset-ref.html
+== textarea-disabled-fieldset-2.html textarea-fieldset-ref.html
+== textarea-fieldset-legend.html textarea-fieldset-legend-ref.html
+== textarea-novalidate.html textarea-withtext-ref.html
diff --git a/layout/reftests/css-ui-valid/textarea/style.css b/layout/reftests/css-ui-valid/textarea/style.css
new file mode 100644
index 000000000..3ffe6c687
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/style.css
@@ -0,0 +1,26 @@
+/* Override default style */
+textarea {
+ border: 0px;
+}
+
+textarea.ref {
+ background-color: green;
+}
+
+textarea:invalid {
+ box-shadow: none;
+}
+
+textarea.notvalid {
+ background-color: green;
+}
+textarea.notvalid:-moz-ui-valid {
+ background-color: red;
+}
+
+textarea.valid {
+ background-color: red;
+}
+textarea.valid:-moz-ui-valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-customerror.html b/layout/reftests/css-ui-valid/textarea/textarea-customerror.html
new file mode 100644
index 000000000..3db17bee1
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 not be affected by :-moz-ui-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-disabled-fieldset-1.html b/layout/reftests/css-ui-valid/textarea/textarea-disabled-fieldset-1.html
new file mode 100644
index 000000000..51c99bbbd
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <fieldset>
+ <textarea class='notvalid'></textarea>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-disabled-fieldset-2.html b/layout/reftests/css-ui-valid/textarea/textarea-disabled-fieldset-2.html
new file mode 100644
index 000000000..4b7c6a751
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid
+ 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='notvalid'></textarea>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-disabled.html b/layout/reftests/css-ui-valid/textarea/textarea-disabled.html
new file mode 100644
index 000000000..12748dfa2
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' disabled></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-dyn-disabled.html b/layout/reftests/css-ui-valid/textarea/textarea-dyn-disabled.html
new file mode 100644
index 000000000..2a07363ce
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-dyn-disabled.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').disabled='true';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest, false);
+ </script>
+ </head>
+ <!-- Test: if textarea is disabled, it is barred from constraint validation
+ and should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled-changed.html b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled-changed.html
new file mode 100644
index 000000000..24faa3ecc
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled-changed.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').removeAttribute('disabled');
+ document.getElementById('t').value = '';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest, false);
+ </script>
+ </head>
+ <!-- Test: if textarea is not disabled and its value has been modifie,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='valid' id='t' disabled></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled.html b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled.html
new file mode 100644
index 000000000..73e0876e9
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-disabled.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <script>
+ function doTest() {
+ document.getElementById('t').removeAttribute('disabled');
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest, false);
+ </script>
+ </head>
+ <!-- Test: if textarea is not disabled but its value hasn't been modified,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' id='t' disabled></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly-changed.html b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly-changed.html
new file mode 100644
index 000000000..bf44240e1
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 its value has been modified,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='valid' id='t' readonly></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly.html b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly.html
new file mode 100644
index 000000000..514b40eb8
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-dyn-not-readonly.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 its value hasn't been modified,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' id='t' readonly></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-dyn-readonly.html b/layout/reftests/css-ui-valid/textarea/textarea-dyn-readonly.html
new file mode 100644
index 000000000..4fc894ca5
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-fieldset-legend-ref.html b/layout/reftests/css-ui-valid/textarea/textarea-fieldset-legend-ref.html
new file mode 100644
index 000000000..8e81d23f1
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/textarea/textarea-fieldset-legend.html b/layout/reftests/css-ui-valid/textarea/textarea-fieldset-legend.html
new file mode 100644
index 000000000..8ec616374
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-fieldset-legend.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea 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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <textarea class='notvalid'></textarea>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-fieldset-ref.html b/layout/reftests/css-ui-valid/textarea/textarea-fieldset-ref.html
new file mode 100644
index 000000000..1d01eb043
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/textarea/textarea-novalidate.html b/layout/reftests/css-ui-valid/textarea/textarea-novalidate.html
new file mode 100644
index 000000000..adadc621b
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 = 'foo';
+ document.documentElement.className = '';">
+ <form novalidate>
+ <textarea id='t' required class='notvalid'></textarea>
+ </form>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-readonly.html b/layout/reftests/css-ui-valid/textarea/textarea-readonly.html
new file mode 100644
index 000000000..f75dea171
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' readonly></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-ref.html b/layout/reftests/css-ui-valid/textarea/textarea-ref.html
new file mode 100644
index 000000000..b370a02a0
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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-valid/textarea/textarea-required-invalid.html b/layout/reftests/css-ui-valid/textarea/textarea-required-invalid.html
new file mode 100644
index 000000000..adbef2e79
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-required-invalid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea isn't valid nor barred from constraint validation,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' required></textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-required-valid-changed.html b/layout/reftests/css-ui-valid/textarea/textarea-required-valid-changed.html
new file mode 100644
index 000000000..f6357d8bc
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-required-valid-changed.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html class='reftet-wait'>
+ <!-- Test: if textarea is valid and its value has been modified,
+ it should be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('t').value = 'foo';
+ document.documentElement.className = '';">
+ <textarea id='t' class='valid' required></textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-required-valid.html b/layout/reftests/css-ui-valid/textarea/textarea-required-valid.html
new file mode 100644
index 000000000..e7cf83dc6
--- /dev/null
+++ b/layout/reftests/css-ui-valid/textarea/textarea-required-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea is valid but its value hasn't been modified,
+ it should not be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid' required>foo</textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-valid.html b/layout/reftests/css-ui-valid/textarea/textarea-valid.html
new file mode 100644
index 000000000..4b24c17b5
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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 be affected by :-moz-ui-valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='notvalid'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-ui-valid/textarea/textarea-withtext-ref.html b/layout/reftests/css-ui-valid/textarea/textarea-withtext-ref.html
new file mode 100644
index 000000000..a6a2b79cf
--- /dev/null
+++ b/layout/reftests/css-ui-valid/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>