summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-valid
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/css-valid')
-rw-r--r--layout/reftests/css-valid/button/button-button.html9
-rw-r--r--layout/reftests/css-valid/button/button-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-valid/button/button-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-valid/button/button-disabled-ref.html6
-rw-r--r--layout/reftests/css-valid/button/button-disabled.html10
-rw-r--r--layout/reftests/css-valid/button/button-dyn-disabled.html9
-rw-r--r--layout/reftests/css-valid/button/button-dyn-not-disabled.html9
-rw-r--r--layout/reftests/css-valid/button/button-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-valid/button/button-fieldset-legend.html14
-rw-r--r--layout/reftests/css-valid/button/button-fieldset-ref.html11
-rw-r--r--layout/reftests/css-valid/button/button-invalid.html9
-rw-r--r--layout/reftests/css-valid/button/button-ref.html6
-rw-r--r--layout/reftests/css-valid/button/button-reset.html9
-rw-r--r--layout/reftests/css-valid/button/button-type-barred.html11
-rw-r--r--layout/reftests/css-valid/button/button-type-invalid.html19
-rw-r--r--layout/reftests/css-valid/button/button-valid.html9
-rw-r--r--layout/reftests/css-valid/button/reftest.list12
-rw-r--r--layout/reftests/css-valid/button/style.css18
-rw-r--r--layout/reftests/css-valid/fieldset/fieldset-invalid.html13
-rw-r--r--layout/reftests/css-valid/fieldset/fieldset-valid.html12
-rw-r--r--layout/reftests/css-valid/fieldset/reftest.list2
-rw-r--r--layout/reftests/css-valid/input/input-button-ref.html6
-rw-r--r--layout/reftests/css-valid/input/input-button.html9
-rw-r--r--layout/reftests/css-valid/input/input-customerror.html18
-rw-r--r--layout/reftests/css-valid/input/input-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-valid/input/input-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-valid/input/input-disabled.html9
-rw-r--r--layout/reftests/css-valid/input/input-dyn-disabled.html9
-rw-r--r--layout/reftests/css-valid/input/input-dyn-not-disabled.html9
-rw-r--r--layout/reftests/css-valid/input/input-dyn-not-readonly.html9
-rw-r--r--layout/reftests/css-valid/input/input-dyn-readonly.html9
-rw-r--r--layout/reftests/css-valid/input/input-email-invalid.html10
-rw-r--r--layout/reftests/css-valid/input/input-email-ref.html6
-rw-r--r--layout/reftests/css-valid/input/input-email-valid.html10
-rw-r--r--layout/reftests/css-valid/input/input-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-valid/input/input-fieldset-legend.html14
-rw-r--r--layout/reftests/css-valid/input/input-fieldset-ref.html10
-rw-r--r--layout/reftests/css-valid/input/input-image-ref.html6
-rw-r--r--layout/reftests/css-valid/input/input-image.html9
-rw-r--r--layout/reftests/css-valid/input/input-pattern-invalid.html10
-rw-r--r--layout/reftests/css-valid/input/input-pattern-valid.html10
-rw-r--r--layout/reftests/css-valid/input/input-radio-customerror.html15
-rw-r--r--layout/reftests/css-valid/input/input-radio-dyn-valid-1.html15
-rw-r--r--layout/reftests/css-valid/input/input-radio-dyn-valid-2.html15
-rw-r--r--layout/reftests/css-valid/input/input-radio-nogroup-required-invalid.html12
-rw-r--r--layout/reftests/css-valid/input/input-radio-nogroup-required-valid.html12
-rw-r--r--layout/reftests/css-valid/input/input-radio-required.html14
-rw-r--r--layout/reftests/css-valid/input/input-readonly.html9
-rw-r--r--layout/reftests/css-valid/input/input-ref.html6
-rw-r--r--layout/reftests/css-valid/input/input-required-invalid.html10
-rw-r--r--layout/reftests/css-valid/input/input-required-valid.html10
-rw-r--r--layout/reftests/css-valid/input/input-reset.html10
-rw-r--r--layout/reftests/css-valid/input/input-submit-ref.html6
-rw-r--r--layout/reftests/css-valid/input/input-submit.html9
-rw-r--r--layout/reftests/css-valid/input/input-type-barred.html10
-rw-r--r--layout/reftests/css-valid/input/input-type-invalid.html20
-rw-r--r--layout/reftests/css-valid/input/input-url-invalid.html10
-rw-r--r--layout/reftests/css-valid/input/input-url-ref.html6
-rw-r--r--layout/reftests/css-valid/input/input-url-valid.html10
-rw-r--r--layout/reftests/css-valid/input/input-valid.html9
-rw-r--r--layout/reftests/css-valid/input/input-withtext-ref.html6
-rw-r--r--layout/reftests/css-valid/input/reftest.list32
-rw-r--r--layout/reftests/css-valid/input/style.css18
-rw-r--r--layout/reftests/css-valid/input/success-ref.html6
-rw-r--r--layout/reftests/css-valid/output/output-invalid.html9
-rw-r--r--layout/reftests/css-valid/output/output-ref.html7
-rw-r--r--layout/reftests/css-valid/output/output-valid.html9
-rw-r--r--layout/reftests/css-valid/output/reftest.list2
-rw-r--r--layout/reftests/css-valid/output/style.css22
-rw-r--r--layout/reftests/css-valid/reftest.list9
-rw-r--r--layout/reftests/css-valid/select/reftest.list12
-rw-r--r--layout/reftests/css-valid/select/select-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-valid/select/select-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-valid/select/select-disabled-ref.html6
-rw-r--r--layout/reftests/css-valid/select/select-disabled.html9
-rw-r--r--layout/reftests/css-valid/select/select-dyn-disabled.html9
-rw-r--r--layout/reftests/css-valid/select/select-dyn-not-disabled.html9
-rw-r--r--layout/reftests/css-valid/select/select-fieldset-legend-ref.html10
-rw-r--r--layout/reftests/css-valid/select/select-fieldset-legend.html14
-rw-r--r--layout/reftests/css-valid/select/select-fieldset-ref.html10
-rw-r--r--layout/reftests/css-valid/select/select-invalid.html9
-rw-r--r--layout/reftests/css-valid/select/select-ref.html6
-rw-r--r--layout/reftests/css-valid/select/select-required-invalid.html11
-rw-r--r--layout/reftests/css-valid/select/select-required-multiple-ref.html10
-rw-r--r--layout/reftests/css-valid/select/select-required-multiple-still-valid.html12
-rw-r--r--layout/reftests/css-valid/select/select-required-multiple-valid.html12
-rw-r--r--layout/reftests/css-valid/select/select-required-ref.html9
-rw-r--r--layout/reftests/css-valid/select/select-required-valid.html11
-rw-r--r--layout/reftests/css-valid/select/select-valid.html9
-rw-r--r--layout/reftests/css-valid/select/style.css18
-rw-r--r--layout/reftests/css-valid/textarea/reftest.list13
-rw-r--r--layout/reftests/css-valid/textarea/style.css26
-rw-r--r--layout/reftests/css-valid/textarea/textarea-customerror.html18
-rw-r--r--layout/reftests/css-valid/textarea/textarea-disabled-fieldset-1.html14
-rw-r--r--layout/reftests/css-valid/textarea/textarea-disabled-fieldset-2.html23
-rw-r--r--layout/reftests/css-valid/textarea/textarea-disabled.html9
-rw-r--r--layout/reftests/css-valid/textarea/textarea-dyn-disabled.html18
-rw-r--r--layout/reftests/css-valid/textarea/textarea-dyn-not-disabled.html18
-rw-r--r--layout/reftests/css-valid/textarea/textarea-dyn-not-readonly.html18
-rw-r--r--layout/reftests/css-valid/textarea/textarea-dyn-readonly.html18
-rw-r--r--layout/reftests/css-valid/textarea/textarea-fieldset-legend-ref.html11
-rw-r--r--layout/reftests/css-valid/textarea/textarea-fieldset-legend.html14
-rw-r--r--layout/reftests/css-valid/textarea/textarea-fieldset-ref.html11
-rw-r--r--layout/reftests/css-valid/textarea/textarea-readonly.html9
-rw-r--r--layout/reftests/css-valid/textarea/textarea-ref.html7
-rw-r--r--layout/reftests/css-valid/textarea/textarea-required-invalid.html10
-rw-r--r--layout/reftests/css-valid/textarea/textarea-required-valid.html10
-rw-r--r--layout/reftests/css-valid/textarea/textarea-valid.html9
-rw-r--r--layout/reftests/css-valid/textarea/textarea-withtext-ref.html7
109 files changed, 1259 insertions, 0 deletions
diff --git a/layout/reftests/css-valid/button/button-button.html b/layout/reftests/css-valid/button/button-button.html
new file mode 100644
index 0000000000..dd3332294f
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/button/button-disabled-fieldset-1.html b/layout/reftests/css-valid/button/button-disabled-fieldset-1.html
new file mode 100644
index 0000000000..74f7d371a7
--- /dev/null
+++ b/layout/reftests/css-valid/button/button-disabled-fieldset-1.html
@@ -0,0 +1,14 @@
+<!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-valid/button/button-disabled-fieldset-2.html b/layout/reftests/css-valid/button/button-disabled-fieldset-2.html
new file mode 100644
index 0000000000..4f18437d7b
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-disabled-ref.html b/layout/reftests/css-valid/button/button-disabled-ref.html
new file mode 100644
index 0000000000..7de1ba7c5c
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-disabled.html b/layout/reftests/css-valid/button/button-disabled.html
new file mode 100644
index 0000000000..9e21f2ac2b
--- /dev/null
+++ b/layout/reftests/css-valid/button/button-disabled.html
@@ -0,0 +1,10 @@
+<!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-valid/button/button-dyn-disabled.html b/layout/reftests/css-valid/button/button-dyn-disabled.html
new file mode 100644
index 0000000000..ef3436eb64
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/button/button-dyn-not-disabled.html b/layout/reftests/css-valid/button/button-dyn-not-disabled.html
new file mode 100644
index 0000000000..671573cc3e
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-fieldset-legend-ref.html b/layout/reftests/css-valid/button/button-fieldset-legend-ref.html
new file mode 100644
index 0000000000..22adc433cd
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-fieldset-legend.html b/layout/reftests/css-valid/button/button-fieldset-legend.html
new file mode 100644
index 0000000000..34159d6180
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-fieldset-ref.html b/layout/reftests/css-valid/button/button-fieldset-ref.html
new file mode 100644
index 0000000000..d057de5ad7
--- /dev/null
+++ b/layout/reftests/css-valid/button/button-fieldset-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <fieldset>
+ <fieldset disabled>
+ <button style="background-color: green;"></button>
+ </fieldset>
+ </fieldset>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-valid/button/button-invalid.html b/layout/reftests/css-valid/button/button-invalid.html
new file mode 100644
index 0000000000..7583803dfa
--- /dev/null
+++ b/layout/reftests/css-valid/button/button-invalid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if button has a custom error, it should not be affected by :valid
+ pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
+ <button class='notvalid' id='b'></button>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/button/button-ref.html b/layout/reftests/css-valid/button/button-ref.html
new file mode 100644
index 0000000000..422cc9315f
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-reset.html b/layout/reftests/css-valid/button/button-reset.html
new file mode 100644
index 0000000000..81547909b1
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-type-barred.html b/layout/reftests/css-valid/button/button-type-barred.html
new file mode 100644
index 0000000000..b98377a819
--- /dev/null
+++ b/layout/reftests/css-valid/button/button-type-barred.html
@@ -0,0 +1,11 @@
+<!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-valid/button/button-type-invalid.html b/layout/reftests/css-valid/button/button-type-invalid.html
new file mode 100644
index 0000000000..637f5aec5f
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/button-valid.html b/layout/reftests/css-valid/button/button-valid.html
new file mode 100644
index 0000000000..f3f0be5ca1
--- /dev/null
+++ b/layout/reftests/css-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-valid/button/reftest.list b/layout/reftests/css-valid/button/reftest.list
new file mode 100644
index 0000000000..e8ec2bd828
--- /dev/null
+++ b/layout/reftests/css-valid/button/reftest.list
@@ -0,0 +1,12 @@
+== button-valid.html button-ref.html
+fuzzy(0-1,0-3) == button-invalid.html button-ref.html
+== button-disabled.html button-disabled-ref.html
+== button-dyn-disabled.html button-disabled-ref.html
+fuzzy(0-1,0-3) == button-dyn-not-disabled.html button-ref.html
+fuzzy(0-1,0-3) == button-button.html button-ref.html
+fuzzy(0-1,0-3) == button-reset.html button-ref.html
+fuzzy(0-1,0-3) == button-type-invalid.html button-ref.html
+fuzzy(0-1,0-3) == button-type-barred.html button-ref.html
+== button-disabled-fieldset-1.html button-fieldset-ref.html
+fuzzy(0-1,0-3) == button-disabled-fieldset-2.html button-fieldset-ref.html
+== button-fieldset-legend.html button-fieldset-legend-ref.html
diff --git a/layout/reftests/css-valid/button/style.css b/layout/reftests/css-valid/button/style.css
new file mode 100644
index 0000000000..23ea98031c
--- /dev/null
+++ b/layout/reftests/css-valid/button/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+button:invalid {
+ box-shadow: none;
+}
+
+button.notvalid {
+ background-color: green;
+}
+button.notvalid:valid {
+ background-color: red;
+}
+
+button.valid {
+ background-color: red;
+}
+button.valid:valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-valid/fieldset/fieldset-invalid.html b/layout/reftests/css-valid/fieldset/fieldset-invalid.html
new file mode 100644
index 0000000000..139f4d4fa0
--- /dev/null
+++ b/layout/reftests/css-valid/fieldset/fieldset-invalid.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: fieldset undergoes constraint validation.
+ It should be affected by :invalid pseudo-class. -->
+ <style>
+ fieldset:invalid { display: none; }
+ </style>
+ <body onload="document.getElementById('f').setCustomValidity('foo'); document.documentElement.className='';">
+ <fieldset>
+ <input id='f'>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/fieldset/fieldset-valid.html b/layout/reftests/css-valid/fieldset/fieldset-valid.html
new file mode 100644
index 0000000000..8f99cb0218
--- /dev/null
+++ b/layout/reftests/css-valid/fieldset/fieldset-valid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: fieldset undergoes constraint validation.
+ It should be affected by :valid pseudo-class. -->
+ <style>
+ fieldset:valid { display: none; }
+ </style>
+ <body>
+ <fieldset>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/fieldset/reftest.list b/layout/reftests/css-valid/fieldset/reftest.list
new file mode 100644
index 0000000000..a70ab664be
--- /dev/null
+++ b/layout/reftests/css-valid/fieldset/reftest.list
@@ -0,0 +1,2 @@
+== fieldset-valid.html about:blank
+== fieldset-invalid.html about:blank
diff --git a/layout/reftests/css-valid/input/input-button-ref.html b/layout/reftests/css-valid/input/input-button-ref.html
new file mode 100644
index 0000000000..3b828533e3
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/input-button.html b/layout/reftests/css-valid/input/input-button.html
new file mode 100644
index 0000000000..f367111ce7
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-customerror.html b/layout/reftests/css-valid/input/input-customerror.html
new file mode 100644
index 0000000000..5553bf8552
--- /dev/null
+++ b/layout/reftests/css-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);
+ </script>
+ </head>
+ <!-- Test: if input has a custom error, it should not be affected by :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-valid/input/input-disabled-fieldset-1.html b/layout/reftests/css-valid/input/input-disabled-fieldset-1.html
new file mode 100644
index 0000000000..114447a3f3
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-disabled-fieldset-2.html b/layout/reftests/css-valid/input/input-disabled-fieldset-2.html
new file mode 100644
index 0000000000..d00df76a52
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-disabled.html b/layout/reftests/css-valid/input/input-disabled.html
new file mode 100644
index 0000000000..adbae0e037
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-dyn-disabled.html b/layout/reftests/css-valid/input/input-dyn-disabled.html
new file mode 100644
index 0000000000..5ad8314228
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-dyn-not-disabled.html b/layout/reftests/css-valid/input/input-dyn-not-disabled.html
new file mode 100644
index 0000000000..1f693b4f7d
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-dyn-not-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input 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('i').removeAttribute('disabled'); document.documentElement.className='';">
+ <input class='valid' id='i' disabled>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-dyn-not-readonly.html b/layout/reftests/css-valid/input/input-dyn-not-readonly.html
new file mode 100644
index 0000000000..f77588ec91
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-dyn-not-readonly.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if input is no longer readonly, 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('i').removeAttribute('readonly'); document.documentElement.className='';">
+ <input class='valid' id='i' readonly>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-dyn-readonly.html b/layout/reftests/css-valid/input/input-dyn-readonly.html
new file mode 100644
index 0000000000..3fb4aae976
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-email-invalid.html b/layout/reftests/css-valid/input/input-email-invalid.html
new file mode 100644
index 0000000000..1c17776730
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-email-ref.html b/layout/reftests/css-valid/input/input-email-ref.html
new file mode 100644
index 0000000000..ecec613c26
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/input-email-valid.html b/layout/reftests/css-valid/input/input-email-valid.html
new file mode 100644
index 0000000000..4f08160588
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-email-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='valid' type='email' value='foo@bar.com'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-valid/input/input-fieldset-legend-ref.html b/layout/reftests/css-valid/input/input-fieldset-legend-ref.html
new file mode 100644
index 0000000000..8d39d91646
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/input-fieldset-legend.html b/layout/reftests/css-valid/input/input-fieldset-legend.html
new file mode 100644
index 0000000000..7c454f3604
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <input class='valid'></input>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-fieldset-ref.html b/layout/reftests/css-valid/input/input-fieldset-ref.html
new file mode 100644
index 0000000000..a9e1239125
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/input-image-ref.html b/layout/reftests/css-valid/input/input-image-ref.html
new file mode 100644
index 0000000000..6c014b8954
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-image-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type='image' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-image.html b/layout/reftests/css-valid/input/input-image.html
new file mode 100644
index 0000000000..de4cce3d3d
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-image.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is of image type, 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>
+ <input class='valid' type='image'>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-pattern-invalid.html b/layout/reftests/css-valid/input/input-pattern-invalid.html
new file mode 100644
index 0000000000..a7172bb46b
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-pattern-valid.html b/layout/reftests/css-valid/input/input-pattern-valid.html
new file mode 100644
index 0000000000..1ed74225c6
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-pattern-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='valid' pattern='foo' value='foo'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-valid/input/input-radio-customerror.html b/layout/reftests/css-valid/input/input-radio-customerror.html
new file mode 100644
index 0000000000..296bd5a4c9
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-radio-customerror.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').setCustomValidity('foo');
+ if (document.getElementById('i1').matches(':valid') ||
+ !document.getElementById('i2').matches(':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-valid/input/input-radio-dyn-valid-1.html b/layout/reftests/css-valid/input/input-radio-dyn-valid-1.html
new file mode 100644
index 0000000000..5d5ca72c7e
--- /dev/null
+++ b/layout/reftests/css-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(':valid') ||
+ !document.getElementById('i2').matches(':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-valid/input/input-radio-dyn-valid-2.html b/layout/reftests/css-valid/input/input-radio-dyn-valid-2.html
new file mode 100644
index 0000000000..ebece2b4c8
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-radio-dyn-valid-2.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').required = false;
+ if (!document.getElementById('i1').matches(':valid') ||
+ !document.getElementById('i2').matches(':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-valid/input/input-radio-nogroup-required-invalid.html b/layout/reftests/css-valid/input/input-radio-nogroup-required-invalid.html
new file mode 100644
index 0000000000..765de1cb2a
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-radio-nogroup-required-invalid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (!document.getElementById('i').matches(':valid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio' checked required>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-radio-nogroup-required-valid.html b/layout/reftests/css-valid/input/input-radio-nogroup-required-valid.html
new file mode 100644
index 0000000000..c096613e25
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-radio-nogroup-required-valid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (document.getElementById('i').matches(':valid')) {
+ document.body.textContent='FAIL';
+ } else {
+ document.body.textContent='SUCCESS';
+ }
+ document.documentElement.className='';">
+ <input id='i' type='radio' required name='s'>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-radio-required.html b/layout/reftests/css-valid/input/input-radio-required.html
new file mode 100644
index 0000000000..f1e056d36d
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-radio-required.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="if (document.getElementById('i1').matches(':valid') ||
+ document.getElementById('i2').matches(':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-valid/input/input-readonly.html b/layout/reftests/css-valid/input/input-readonly.html
new file mode 100644
index 0000000000..d8c1f494a7
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-ref.html b/layout/reftests/css-valid/input/input-ref.html
new file mode 100644
index 0000000000..65b4b97078
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/input-required-invalid.html b/layout/reftests/css-valid/input/input-required-invalid.html
new file mode 100644
index 0000000000..59c89358e4
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-required-valid.html b/layout/reftests/css-valid/input/input-required-valid.html
new file mode 100644
index 0000000000..38d6632a2c
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-required-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='valid' value='foo' required>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-valid/input/input-reset.html b/layout/reftests/css-valid/input/input-reset.html
new file mode 100644
index 0000000000..7f03b9f81b
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-submit-ref.html b/layout/reftests/css-valid/input/input-submit-ref.html
new file mode 100644
index 0000000000..d758ea56a6
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-submit-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type='submit' style="background-color: green;">
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-submit.html b/layout/reftests/css-valid/input/input-submit.html
new file mode 100644
index 0000000000..585de71d77
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-submit.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is of button type, 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>
+ <input class='valid' type='submit'>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-type-barred.html b/layout/reftests/css-valid/input/input-type-barred.html
new file mode 100644
index 0000000000..34581c1b34
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-type-invalid.html b/layout/reftests/css-valid/input/input-type-invalid.html
new file mode 100644
index 0000000000..70273c6ec9
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function doTest()
+ {
+ var i = document.getElementById('i');
+ i.setCustomValidity('foo');
+ i.type = 'text';
+ document.documentElement.className='';
+ }
+ document.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+ <body>
+ <input class='notvalid' type='button' id='i'>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-url-invalid.html b/layout/reftests/css-valid/input/input-url-invalid.html
new file mode 100644
index 0000000000..06300d6327
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/input/input-url-ref.html b/layout/reftests/css-valid/input/input-url-ref.html
new file mode 100644
index 0000000000..e95cdbca2e
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/input-url-valid.html b/layout/reftests/css-valid/input/input-url-valid.html
new file mode 100644
index 0000000000..319f67e17e
--- /dev/null
+++ b/layout/reftests/css-valid/input/input-url-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if input is valid and not barred from constraint validation,
+ it should be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='valid' type='url' value='http://mozilla.org/'>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-valid/input/input-valid.html b/layout/reftests/css-valid/input/input-valid.html
new file mode 100644
index 0000000000..88c07045b3
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input class='valid'>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/input/input-withtext-ref.html b/layout/reftests/css-valid/input/input-withtext-ref.html
new file mode 100644
index 0000000000..d54d052157
--- /dev/null
+++ b/layout/reftests/css-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-valid/input/reftest.list b/layout/reftests/css-valid/input/reftest.list
new file mode 100644
index 0000000000..8d045e07f1
--- /dev/null
+++ b/layout/reftests/css-valid/input/reftest.list
@@ -0,0 +1,32 @@
+== input-valid.html input-ref.html
+fuzzy(0-64,0-4) == input-customerror.html input-ref.html
+fuzzy(0-1,0-3) == input-disabled.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-disabled.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-not-disabled.html input-ref.html
+fuzzy(0-1,0-3) == input-readonly.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-readonly.html input-ref.html
+fuzzy(0-1,0-3) == input-dyn-not-readonly.html input-ref.html
+== input-required-valid.html input-withtext-ref.html
+fuzzy(0-1,0-3) == input-required-invalid.html input-ref.html
+fuzzy(0-2,0-5) == input-button.html input-button-ref.html
+fuzzy(0-2,0-5) == input-reset.html input-button-ref.html
+== input-email-invalid.html input-withtext-ref.html
+fuzzy(0-2,0-5) == input-email-valid.html input-email-ref.html
+== input-url-invalid.html input-withtext-ref.html
+== input-url-valid.html input-url-ref.html
+== input-pattern-valid.html input-withtext-ref.html
+== input-pattern-invalid.html input-withtext-ref.html
+fuzzy(0-2,0-5) == input-type-barred.html input-button-ref.html
+fuzzy(0-64,0-4) == input-type-invalid.html input-ref.html
+== input-disabled-fieldset-1.html input-fieldset-ref.html
+fuzzy(0-1,0-3) == input-disabled-fieldset-2.html input-fieldset-ref.html
+== input-fieldset-legend.html input-fieldset-legend-ref.html
+== input-radio-required.html success-ref.html
+== input-radio-customerror.html success-ref.html
+== input-radio-dyn-valid-1.html success-ref.html
+== input-radio-dyn-valid-2.html success-ref.html
+== input-radio-nogroup-required-valid.html success-ref.html
+== input-radio-nogroup-required-invalid.html success-ref.html
+== input-submit.html input-submit-ref.html
+== input-image.html input-image-ref.html
+# input type='hidden' shouldn't show
diff --git a/layout/reftests/css-valid/input/style.css b/layout/reftests/css-valid/input/style.css
new file mode 100644
index 0000000000..81c09c3e20
--- /dev/null
+++ b/layout/reftests/css-valid/input/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+input:invalid {
+ box-shadow: none;
+}
+
+input.notvalid {
+ background-color: green;
+}
+input.notvalid:valid {
+ background-color: red;
+}
+
+input.valid {
+ background-color: red;
+}
+input.valid:valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-valid/input/success-ref.html b/layout/reftests/css-valid/input/success-ref.html
new file mode 100644
index 0000000000..bfa8e0a12c
--- /dev/null
+++ b/layout/reftests/css-valid/input/success-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ SUCCESS
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/output/output-invalid.html b/layout/reftests/css-valid/output/output-invalid.html
new file mode 100644
index 0000000000..dc0abeb347
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/output/output-ref.html b/layout/reftests/css-valid/output/output-ref.html
new file mode 100644
index 0000000000..0db2c440c7
--- /dev/null
+++ b/layout/reftests/css-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-valid/output/output-valid.html b/layout/reftests/css-valid/output/output-valid.html
new file mode 100644
index 0000000000..2e14a8ec67
--- /dev/null
+++ b/layout/reftests/css-valid/output/output-valid.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if output has no custom error, it should not be affected by :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-valid/output/reftest.list b/layout/reftests/css-valid/output/reftest.list
new file mode 100644
index 0000000000..74468e394a
--- /dev/null
+++ b/layout/reftests/css-valid/output/reftest.list
@@ -0,0 +1,2 @@
+== output-valid.html output-ref.html
+== output-invalid.html output-ref.html
diff --git a/layout/reftests/css-valid/output/style.css b/layout/reftests/css-valid/output/style.css
new file mode 100644
index 0000000000..b5ab09a3f2
--- /dev/null
+++ b/layout/reftests/css-valid/output/style.css
@@ -0,0 +1,22 @@
+/* Override default style */
+output {
+ color: black;
+}
+
+output.notvalid {
+ color: green;
+}
+output.notvalid:valid {
+ color: red;
+}
+
+output.valid {
+ color: green;
+}
+output.valid:valid {
+ color: red;
+}
+
+output.ref {
+ color: green;
+}
diff --git a/layout/reftests/css-valid/reftest.list b/layout/reftests/css-valid/reftest.list
new file mode 100644
index 0000000000..12f5b0318d
--- /dev/null
+++ b/layout/reftests/css-valid/reftest.list
@@ -0,0 +1,9 @@
+# :valid should not apply on fieldset (always barred from constraint validation)
+include fieldset/reftest.list
+
+# :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-valid/select/reftest.list b/layout/reftests/css-valid/select/reftest.list
new file mode 100644
index 0000000000..1044775949
--- /dev/null
+++ b/layout/reftests/css-valid/select/reftest.list
@@ -0,0 +1,12 @@
+fuzzy(0-2,0-7) needs-focus == select-valid.html select-ref.html
+fuzzy(0-2,0-5) needs-focus == select-invalid.html select-ref.html
+needs-focus == select-disabled.html select-disabled-ref.html
+fuzzy(0-1,0-5) needs-focus == select-dyn-disabled.html select-disabled-ref.html
+fuzzy(0-2,0-5) needs-focus == select-dyn-not-disabled.html select-ref.html
+needs-focus == select-required-invalid.html select-required-ref.html
+needs-focus == select-required-valid.html select-required-ref.html
+needs-focus == select-required-multiple-still-valid.html select-required-multiple-ref.html
+fuzzy(0-1,0-250) needs-focus == select-required-multiple-valid.html select-required-multiple-ref.html
+needs-focus == select-disabled-fieldset-1.html select-fieldset-ref.html
+fuzzy-if(!Android,0-1,0-3) needs-focus == select-disabled-fieldset-2.html select-fieldset-ref.html
+needs-focus == select-fieldset-legend.html select-fieldset-legend-ref.html
diff --git a/layout/reftests/css-valid/select/select-disabled-fieldset-1.html b/layout/reftests/css-valid/select/select-disabled-fieldset-1.html
new file mode 100644
index 0000000000..856dc9c69d
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/select/select-disabled-fieldset-2.html b/layout/reftests/css-valid/select/select-disabled-fieldset-2.html
new file mode 100644
index 0000000000..c05671a73b
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/select/select-disabled-ref.html b/layout/reftests/css-valid/select/select-disabled-ref.html
new file mode 100644
index 0000000000..e3a228a897
--- /dev/null
+++ b/layout/reftests/css-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-valid/select/select-disabled.html b/layout/reftests/css-valid/select/select-disabled.html
new file mode 100644
index 0000000000..4d03a70f80
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/select/select-dyn-disabled.html b/layout/reftests/css-valid/select/select-dyn-disabled.html
new file mode 100644
index 0000000000..b37feda47a
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/select/select-dyn-not-disabled.html b/layout/reftests/css-valid/select/select-dyn-not-disabled.html
new file mode 100644
index 0000000000..debad37641
--- /dev/null
+++ b/layout/reftests/css-valid/select/select-dyn-not-disabled.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- Test: if select 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('s').removeAttribute('disabled'); document.documentElement.className='';">
+ <select class='valid' id='s' disabled></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/select/select-fieldset-legend-ref.html b/layout/reftests/css-valid/select/select-fieldset-legend-ref.html
new file mode 100644
index 0000000000..5083cea90d
--- /dev/null
+++ b/layout/reftests/css-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-valid/select/select-fieldset-legend.html b/layout/reftests/css-valid/select/select-fieldset-legend.html
new file mode 100644
index 0000000000..5020bc0be9
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <select class='valid'></select>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/select/select-fieldset-ref.html b/layout/reftests/css-valid/select/select-fieldset-ref.html
new file mode 100644
index 0000000000..ca82a8022d
--- /dev/null
+++ b/layout/reftests/css-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-valid/select/select-invalid.html b/layout/reftests/css-valid/select/select-invalid.html
new file mode 100644
index 0000000000..a30a1555a6
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/select/select-ref.html b/layout/reftests/css-valid/select/select-ref.html
new file mode 100644
index 0000000000..a28668557f
--- /dev/null
+++ b/layout/reftests/css-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-valid/select/select-required-invalid.html b/layout/reftests/css-valid/select/select-required-invalid.html
new file mode 100644
index 0000000000..45e38acb78
--- /dev/null
+++ b/layout/reftests/css-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, :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-valid/select/select-required-multiple-ref.html b/layout/reftests/css-valid/select/select-required-multiple-ref.html
new file mode 100644
index 0000000000..a9477333f8
--- /dev/null
+++ b/layout/reftests/css-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-valid/select/select-required-multiple-still-valid.html b/layout/reftests/css-valid/select/select-required-multiple-still-valid.html
new file mode 100644
index 0000000000..d093c06772
--- /dev/null
+++ b/layout/reftests/css-valid/select/select-required-multiple-still-valid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has all selected option value set to the
+ empty string, :valid should still apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='valid' required multiple>
+ <option selected></option>
+ <option selected value="">foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/select/select-required-multiple-valid.html b/layout/reftests/css-valid/select/select-required-multiple-valid.html
new file mode 100644
index 0000000000..6bf74d623b
--- /dev/null
+++ b/layout/reftests/css-valid/select/select-required-multiple-valid.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a selected option which has value
+ different from the empty string, :valid should apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='valid' required multiple>
+ <option selected></option>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/select/select-required-ref.html b/layout/reftests/css-valid/select/select-required-ref.html
new file mode 100644
index 0000000000..3c2bde80a0
--- /dev/null
+++ b/layout/reftests/css-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-valid/select/select-required-valid.html b/layout/reftests/css-valid/select/select-required-valid.html
new file mode 100644
index 0000000000..685995b673
--- /dev/null
+++ b/layout/reftests/css-valid/select/select-required-valid.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if select is required and has a select option which has value
+ different from the empty string, :valid should apply. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='valid' required>
+ <option selected>foo</option>
+ </select>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/select/select-valid.html b/layout/reftests/css-valid/select/select-valid.html
new file mode 100644
index 0000000000..aab4313401
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <select class='valid'></select>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/select/style.css b/layout/reftests/css-valid/select/style.css
new file mode 100644
index 0000000000..32bb6a7f00
--- /dev/null
+++ b/layout/reftests/css-valid/select/style.css
@@ -0,0 +1,18 @@
+/* Override default style */
+select:invalid {
+ box-shadow: none;
+}
+
+select.notvalid {
+ background-color: green;
+}
+select.notvalid:valid {
+ background-color: red;
+}
+
+select.valid {
+ background-color: red;
+}
+select.valid:valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-valid/textarea/reftest.list b/layout/reftests/css-valid/textarea/reftest.list
new file mode 100644
index 0000000000..d290f294f3
--- /dev/null
+++ b/layout/reftests/css-valid/textarea/reftest.list
@@ -0,0 +1,13 @@
+== textarea-valid.html textarea-ref.html
+== textarea-customerror.html textarea-ref.html
+== textarea-disabled.html textarea-ref.html
+== textarea-dyn-disabled.html textarea-ref.html
+== textarea-dyn-not-disabled.html textarea-ref.html
+== textarea-readonly.html textarea-ref.html
+== textarea-dyn-readonly.html textarea-ref.html
+== textarea-dyn-not-readonly.html textarea-ref.html
+== textarea-required-valid.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
diff --git a/layout/reftests/css-valid/textarea/style.css b/layout/reftests/css-valid/textarea/style.css
new file mode 100644
index 0000000000..5c74ec8ae4
--- /dev/null
+++ b/layout/reftests/css-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:valid {
+ background-color: red;
+}
+
+textarea.valid {
+ background-color: red;
+}
+textarea.valid:valid {
+ background-color: green;
+}
diff --git a/layout/reftests/css-valid/textarea/textarea-customerror.html b/layout/reftests/css-valid/textarea/textarea-customerror.html
new file mode 100644
index 0000000000..175894ff7a
--- /dev/null
+++ b/layout/reftests/css-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);
+ </script>
+ </head>
+ <!-- Test: if textarea has a custom error, it should not be affected by :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-valid/textarea/textarea-disabled-fieldset-1.html b/layout/reftests/css-valid/textarea/textarea-disabled-fieldset-1.html
new file mode 100644
index 0000000000..fcc093f028
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/textarea/textarea-disabled-fieldset-2.html b/layout/reftests/css-valid/textarea/textarea-disabled-fieldset-2.html
new file mode 100644
index 0000000000..68070a86ed
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/textarea/textarea-disabled.html b/layout/reftests/css-valid/textarea/textarea-disabled.html
new file mode 100644
index 0000000000..ab6aebcc23
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/textarea/textarea-dyn-disabled.html b/layout/reftests/css-valid/textarea/textarea-dyn-disabled.html
new file mode 100644
index 0000000000..7d4591b557
--- /dev/null
+++ b/layout/reftests/css-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);
+ </script>
+ </head>
+ <!-- Test: if textarea 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>
+ <textarea class='notvalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/textarea/textarea-dyn-not-disabled.html b/layout/reftests/css-valid/textarea/textarea-dyn-not-disabled.html
new file mode 100644
index 0000000000..5c8bec1824
--- /dev/null
+++ b/layout/reftests/css-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);
+ </script>
+ </head>
+ <!-- Test: if textarea 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>
+ <textarea class='valid' id='t' disabled></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/textarea/textarea-dyn-not-readonly.html b/layout/reftests/css-valid/textarea/textarea-dyn-not-readonly.html
new file mode 100644
index 0000000000..d2eb59d740
--- /dev/null
+++ b/layout/reftests/css-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);
+ </script>
+ </head>
+ <!-- Test: if textarea is no longer readonly, it is candidate for constraint
+ validation and should be affected by :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-valid/textarea/textarea-dyn-readonly.html b/layout/reftests/css-valid/textarea/textarea-dyn-readonly.html
new file mode 100644
index 0000000000..0a0a4c846e
--- /dev/null
+++ b/layout/reftests/css-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);
+ </script>
+ </head>
+ <!-- Test: if textarea is readonly, 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>
+ <textarea class='notvalid' id='t'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/textarea/textarea-fieldset-legend-ref.html b/layout/reftests/css-valid/textarea/textarea-fieldset-legend-ref.html
new file mode 100644
index 0000000000..8e81d23f1f
--- /dev/null
+++ b/layout/reftests/css-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-valid/textarea/textarea-fieldset-legend.html b/layout/reftests/css-valid/textarea/textarea-fieldset-legend.html
new file mode 100644
index 0000000000..ff974a042f
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <fieldset disabled>
+ <legend>
+ <textarea class='valid'></textarea>
+ </legend>
+ </fieldset>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/textarea/textarea-fieldset-ref.html b/layout/reftests/css-valid/textarea/textarea-fieldset-ref.html
new file mode 100644
index 0000000000..1d01eb0438
--- /dev/null
+++ b/layout/reftests/css-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-valid/textarea/textarea-readonly.html b/layout/reftests/css-valid/textarea/textarea-readonly.html
new file mode 100644
index 0000000000..18f3b80574
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/textarea/textarea-ref.html b/layout/reftests/css-valid/textarea/textarea-ref.html
new file mode 100644
index 0000000000..b370a02a0f
--- /dev/null
+++ b/layout/reftests/css-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-valid/textarea/textarea-required-invalid.html b/layout/reftests/css-valid/textarea/textarea-required-invalid.html
new file mode 100644
index 0000000000..3e46efd45b
--- /dev/null
+++ b/layout/reftests/css-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 :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-valid/textarea/textarea-required-valid.html b/layout/reftests/css-valid/textarea/textarea-required-valid.html
new file mode 100644
index 0000000000..f48dabcfc1
--- /dev/null
+++ b/layout/reftests/css-valid/textarea/textarea-required-valid.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <!-- Test: if textarea is valid and not barred from constraint validation,
+ it should be affected by :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='valid' required>foo</textarea>
+ </body>
+</html>
+
diff --git a/layout/reftests/css-valid/textarea/textarea-valid.html b/layout/reftests/css-valid/textarea/textarea-valid.html
new file mode 100644
index 0000000000..1433fa839c
--- /dev/null
+++ b/layout/reftests/css-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 :valid pseudo-class. -->
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <textarea class='valid'></textarea>
+ </body>
+</html>
diff --git a/layout/reftests/css-valid/textarea/textarea-withtext-ref.html b/layout/reftests/css-valid/textarea/textarea-withtext-ref.html
new file mode 100644
index 0000000000..a6a2b79cfa
--- /dev/null
+++ b/layout/reftests/css-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>