summaryrefslogtreecommitdiffstats
path: root/dom/html/reftests/autofocus
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/html/reftests/autofocus
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/html/reftests/autofocus')
-rw-r--r--dom/html/reftests/autofocus/autofocus-after-body-focus-ref.html7
-rw-r--r--dom/html/reftests/autofocus/autofocus-after-body-focus.html10
-rw-r--r--dom/html/reftests/autofocus/autofocus-after-load-ref.html7
-rw-r--r--dom/html/reftests/autofocus/autofocus-after-load.html21
-rw-r--r--dom/html/reftests/autofocus/autofocus-leaves-iframe-ref.html17
-rw-r--r--dom/html/reftests/autofocus/autofocus-leaves-iframe.html16
-rw-r--r--dom/html/reftests/autofocus/button-create.html23
-rw-r--r--dom/html/reftests/autofocus/button-load.html13
-rw-r--r--dom/html/reftests/autofocus/button-ref.html7
-rw-r--r--dom/html/reftests/autofocus/input-create.html23
-rw-r--r--dom/html/reftests/autofocus/input-load.html13
-rw-r--r--dom/html/reftests/autofocus/input-number-ref.html17
-rw-r--r--dom/html/reftests/autofocus/input-number.html26
-rw-r--r--dom/html/reftests/autofocus/input-ref.html7
-rw-r--r--dom/html/reftests/autofocus/input-time-ref.html22
-rw-r--r--dom/html/reftests/autofocus/input-time.html22
-rw-r--r--dom/html/reftests/autofocus/reftest.list13
-rw-r--r--dom/html/reftests/autofocus/select-create.html23
-rw-r--r--dom/html/reftests/autofocus/select-load.html13
-rw-r--r--dom/html/reftests/autofocus/select-ref.html7
-rw-r--r--dom/html/reftests/autofocus/style.css10
-rw-r--r--dom/html/reftests/autofocus/textarea-create.html23
-rw-r--r--dom/html/reftests/autofocus/textarea-load.html13
-rw-r--r--dom/html/reftests/autofocus/textarea-ref.html7
24 files changed, 360 insertions, 0 deletions
diff --git a/dom/html/reftests/autofocus/autofocus-after-body-focus-ref.html b/dom/html/reftests/autofocus/autofocus-after-body-focus-ref.html
new file mode 100644
index 0000000000..3801ed7543
--- /dev/null
+++ b/dom/html/reftests/autofocus/autofocus-after-body-focus-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('input')[0].focus();">
+ <input onfocus="document.documentElement.removeAttribute('class');">
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/autofocus-after-body-focus.html b/dom/html/reftests/autofocus/autofocus-after-body-focus.html
new file mode 100644
index 0000000000..6d43b865a8
--- /dev/null
+++ b/dom/html/reftests/autofocus/autofocus-after-body-focus.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <script>
+ document.body.focus();
+ </script>
+ <input autofocus onfocus="document.documentElement.removeAttribute('class');">
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/autofocus-after-load-ref.html b/dom/html/reftests/autofocus/autofocus-after-load-ref.html
new file mode 100644
index 0000000000..f28f06f0f3
--- /dev/null
+++ b/dom/html/reftests/autofocus/autofocus-after-load-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <input autofocus><textarea></textarea><select></select><button></button>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/autofocus-after-load.html b/dom/html/reftests/autofocus/autofocus-after-load.html
new file mode 100644
index 0000000000..753ef183d1
--- /dev/null
+++ b/dom/html/reftests/autofocus/autofocus-after-load.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function loadHandler()
+ {
+ var body = document.body;
+
+ var elements = ["input", "textarea", "select", "button"];
+ for (var e of elements) {
+ var el = document.createElement(e);
+ el.autofocus = true;
+ body.appendChild(el);
+ }
+
+ setTimeout(document.documentElement.removeAttribute('class'), 0);
+ }
+ </script>
+ <body onload="loadHandler();">
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/autofocus-leaves-iframe-ref.html b/dom/html/reftests/autofocus/autofocus-leaves-iframe-ref.html
new file mode 100644
index 0000000000..e74e2753dc
--- /dev/null
+++ b/dom/html/reftests/autofocus/autofocus-leaves-iframe-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function loadHandler()
+ {
+ frames[0].document.getElementsByTagName('input')[0].onfocus = function() {
+ document.documentElement.removeAttribute('class');
+ }
+ frames[0].document.getElementsByTagName('input')[0].focus();
+ }
+ </script>
+ <body onload="loadHandler();">
+ <iframe srcdoc="<input>"></iframe>
+ <input></input>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/autofocus-leaves-iframe.html b/dom/html/reftests/autofocus/autofocus-leaves-iframe.html
new file mode 100644
index 0000000000..9069156878
--- /dev/null
+++ b/dom/html/reftests/autofocus/autofocus-leaves-iframe.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function frameLoadHandler()
+ {
+ var i = document.createElement('input');
+ i.autofocus = true;
+ document.body.appendChild(i);
+ setTimeout(document.documentElement.removeAttribute('class'), 0);
+ }
+ </script>
+ <body>
+ <iframe onload="frameLoadHandler();" srcdoc="<input autofocus>"></iframe>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/button-create.html b/dom/html/reftests/autofocus/button-create.html
new file mode 100644
index 0000000000..ae49d162ad
--- /dev/null
+++ b/dom/html/reftests/autofocus/button-create.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <script>
+ var body = document.body;
+
+ var i = document.createElement('button');
+ i.autofocus = false;
+ body.appendChild(i);
+
+ i = document.createElement('button');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+
+ i = document.createElement('button');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+ </script>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/button-load.html b/dom/html/reftests/autofocus/button-load.html
new file mode 100644
index 0000000000..a9e28e2bb6
--- /dev/null
+++ b/dom/html/reftests/autofocus/button-load.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function focusHandler()
+ {
+ setTimeout(document.documentElement.removeAttribute('class'), 0);
+ }
+ </script>
+ <body>
+ <button></button><button autofocus onfocus="focusHandler();"></button><button autofocus onfocus="focusHandler();"></button>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/button-ref.html b/dom/html/reftests/autofocus/button-ref.html
new file mode 100644
index 0000000000..878c8e2681
--- /dev/null
+++ b/dom/html/reftests/autofocus/button-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('button')[1].focus();">
+ <button></button><button onfocus="document.documentElement.removeAttribute('class');"></button><button></button>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/input-create.html b/dom/html/reftests/autofocus/input-create.html
new file mode 100644
index 0000000000..c6d0c28089
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-create.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <script>
+ var body = document.body;
+
+ var i = document.createElement('input');
+ i.autofocus = false;
+ body.appendChild(i);
+
+ i = document.createElement('input');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+
+ i = document.createElement('input');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+ </script>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/input-load.html b/dom/html/reftests/autofocus/input-load.html
new file mode 100644
index 0000000000..d40b49177a
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-load.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function focusHandler()
+ {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+ <body>
+ <input><input autofocus onfocus="focusHandler();"><input autofocus onfocus="focusHandler();">
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/input-number-ref.html b/dom/html/reftests/autofocus/input-number-ref.html
new file mode 100644
index 0000000000..384915edb8
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-number-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- In this case we're using reftest-wait to make sure the test doesn't
+ get snapshotted before it's been focused. We're not testing
+ invalidation so we don't need to listen for MozReftestInvalidate.
+ -->
+ <head>
+ <meta charset="utf-8">
+ </head>
+ <body onload="document.getElementsByTagName('input')[0].focus();">
+ <input onfocus="document.documentElement.removeAttribute('class');"
+ style="-moz-appearance: none;">
+ <!-- div to cover spin box area for type=number to type=text comparison -->
+ <div style="display:block; position:absolute; background-color:black; width:200px; height:100px; top:0px; left:100px;">
+ </body>
+</html>
+
diff --git a/dom/html/reftests/autofocus/input-number.html b/dom/html/reftests/autofocus/input-number.html
new file mode 100644
index 0000000000..7816ee9bd9
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-number.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- In this case we're using reftest-wait to make sure the test doesn't
+ get snapshotted before it's been focused. We're not testing
+ invalidation so we don't need to listen for MozReftestInvalidate.
+ -->
+ <head>
+ <meta charset="utf-8">
+ <script>
+
+function focusHandler() {
+ setTimeout(function() {
+ document.documentElement.removeAttribute('class');
+ }, 0);
+}
+
+ </script>
+ </head>
+ <body>
+ <input type="number" autofocus onfocus="focusHandler();"
+ style="-moz-appearance: none;">
+ <!-- div to cover spin box area for type=number to type=text comparison -->
+ <div style="display:block; position:absolute; background-color:black; width:200px; height:100px; top:0px; left:100px;">
+ </body>
+</html>
+
diff --git a/dom/html/reftests/autofocus/input-ref.html b/dom/html/reftests/autofocus/input-ref.html
new file mode 100644
index 0000000000..6e2e546d24
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('input')[1].focus();">
+ <input><input onfocus="document.documentElement.removeAttribute('class');"><input>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/input-time-ref.html b/dom/html/reftests/autofocus/input-time-ref.html
new file mode 100644
index 0000000000..abaa6feeac
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-time-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- In this case we're using reftest-wait to make sure the test doesn't
+ get snapshotted before it's been focused. We're not testing
+ invalidation so we don't need to listen for MozReftestInvalidate.
+ -->
+ <head>
+ <script>
+ function focusHandler() {
+ setTimeout(function() {
+ document.documentElement.removeAttribute("class");
+ }, 0);
+ }
+ </script>
+ </head>
+ <body onload="document.getElementById('t').focus();">
+ <input type="time" id="t" onfocus="focusHandler();"
+ style="-moz-appearance: none;">
+ </body>
+</html>
+
+
diff --git a/dom/html/reftests/autofocus/input-time.html b/dom/html/reftests/autofocus/input-time.html
new file mode 100644
index 0000000000..a86a91bbfc
--- /dev/null
+++ b/dom/html/reftests/autofocus/input-time.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <!-- In this case we're using reftest-wait to make sure the test doesn't
+ get snapshotted before it's been focused. We're not testing
+ invalidation so we don't need to listen for MozReftestInvalidate.
+ -->
+ <head>
+ <script>
+ function focusHandler() {
+ setTimeout(function() {
+ document.documentElement.removeAttribute("class");
+ }, 0);
+ }
+ </script>
+ </head>
+ <body>
+ <input type="time" autofocus onfocus="focusHandler();"
+ style="-moz-appearance: none;">
+ </body>
+</html>
+
+
diff --git a/dom/html/reftests/autofocus/reftest.list b/dom/html/reftests/autofocus/reftest.list
new file mode 100644
index 0000000000..03ddce4149
--- /dev/null
+++ b/dom/html/reftests/autofocus/reftest.list
@@ -0,0 +1,13 @@
+needs-focus == input-load.html input-ref.html
+needs-focus == input-create.html input-ref.html
+needs-focus == input-number.html input-number-ref.html
+fuzzy(0-5,0-1) needs-focus == input-time.html input-time-ref.html # One anti-aliased outline corner.
+needs-focus == button-load.html button-ref.html
+needs-focus == button-create.html button-ref.html
+fuzzy-if(gtkWidget,0-18,0-1) needs-focus == textarea-load.html textarea-ref.html # One anti-aliased corner.
+needs-focus == textarea-create.html textarea-ref.html
+fuzzy-if(Android,0-10,0-5) needs-focus == select-load.html select-ref.html
+fuzzy(0-10,0-5) needs-focus == select-create.html select-ref.html
+fuzzy(0-1,0-1) needs-focus == autofocus-after-load.html autofocus-after-load-ref.html
+needs-focus == autofocus-leaves-iframe.html autofocus-leaves-iframe-ref.html
+fuzzy(0-5,0-1) needs-focus == autofocus-after-body-focus.html autofocus-after-body-focus-ref.html
diff --git a/dom/html/reftests/autofocus/select-create.html b/dom/html/reftests/autofocus/select-create.html
new file mode 100644
index 0000000000..fd9c29c954
--- /dev/null
+++ b/dom/html/reftests/autofocus/select-create.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <script>
+ var body = document.body;
+
+ var i = document.createElement('select');
+ i.autofocus = false;
+ body.appendChild(i);
+
+ i = document.createElement('select');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+
+ i = document.createElement('select');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+ </script>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/select-load.html b/dom/html/reftests/autofocus/select-load.html
new file mode 100644
index 0000000000..976005bec2
--- /dev/null
+++ b/dom/html/reftests/autofocus/select-load.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function focusHandler()
+ {
+ setTimeout(document.documentElement.removeAttribute('class'), 0);
+ }
+ </script>
+ <body>
+ <select></select><select autofocus onfocus="focusHandler();"></select><select autofocus onfocus="focusHandler();"></select>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/select-ref.html b/dom/html/reftests/autofocus/select-ref.html
new file mode 100644
index 0000000000..7fa9cd6559
--- /dev/null
+++ b/dom/html/reftests/autofocus/select-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('select')[1].focus();">
+ <select></select><select onfocus="document.documentElement.removeAttribute('class');"></select><select></select>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/style.css b/dom/html/reftests/autofocus/style.css
new file mode 100644
index 0000000000..f0dd5d1498
--- /dev/null
+++ b/dom/html/reftests/autofocus/style.css
@@ -0,0 +1,10 @@
+:focus { background-color: green; }
+
+/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1645773 */
+textarea { -moz-appearance: none; }
+
+/**
+ * autofocus is considered like a keyboard focus and .focus() isn't.
+ * We might change that with bug 620056 but for these tests, we don't really care.
+ */
+::-moz-focus-inner { border: none; }
diff --git a/dom/html/reftests/autofocus/textarea-create.html b/dom/html/reftests/autofocus/textarea-create.html
new file mode 100644
index 0000000000..e506bb2b72
--- /dev/null
+++ b/dom/html/reftests/autofocus/textarea-create.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body>
+ <script>
+ var body = document.body;
+
+ var i = document.createElement('textarea');
+ i.autofocus = false;
+ body.appendChild(i);
+
+ i = document.createElement('textarea');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+
+ i = document.createElement('textarea');
+ i.autofocus = true;
+ i.onfocus = function() { setTimeout(document.documentElement.removeAttribute('class'), 0); };
+ body.appendChild(i);
+ </script>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/textarea-load.html b/dom/html/reftests/autofocus/textarea-load.html
new file mode 100644
index 0000000000..13ab2cb2cc
--- /dev/null
+++ b/dom/html/reftests/autofocus/textarea-load.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <script>
+ function focusHandler()
+ {
+ setTimeout(document.documentElement.removeAttribute('class'), 0);
+ }
+ </script>
+ <body>
+ <textarea></textarea><textarea autofocus onfocus="focusHandler();"></textarea><textarea autofocus onfocus="focusHandler();"></textarea>
+ </body>
+</html>
diff --git a/dom/html/reftests/autofocus/textarea-ref.html b/dom/html/reftests/autofocus/textarea-ref.html
new file mode 100644
index 0000000000..b79bd7abe8
--- /dev/null
+++ b/dom/html/reftests/autofocus/textarea-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <link rel='stylesheet' type='text/css' href='style.css'>
+ <body onload="document.getElementsByTagName('textarea')[1].focus();">
+ <textarea></textarea><textarea onfocus="document.documentElement.removeAttribute('class');"></textarea><textarea></textarea>
+ </body>
+</html>