diff options
Diffstat (limited to 'dom/html/reftests/autofocus')
25 files changed, 394 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..eab4f2ce29 --- /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><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..91cee7cbce --- /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 src="data:text/html,<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..0f950ebe27 --- /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();" src="data:text/html,<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-stylo.list b/dom/html/reftests/autofocus/reftest-stylo.list new file mode 100644 index 0000000000..5e2300b52b --- /dev/null +++ b/dom/html/reftests/autofocus/reftest-stylo.list @@ -0,0 +1,36 @@ +# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing +default-preferences pref(dom.forms.number,true) +fails skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) needs-focus == input-load.html input-load.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +fails skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) needs-focus == input-create.html input-create.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +# skip skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) needs-focus == input-number.html input-number.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +fails skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) needs-focus == button-load.html button-load.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +random needs-focus == button-create.html button-create.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +random needs-focus == textarea-load.html textarea-load.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +random needs-focus == textarea-create.html textarea-create.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +fails skip-if(B2G||Mulet) fuzzy-if(skiaContent,2,4) needs-focus == select-load.html select-load.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +fails skip-if(B2G||Mulet) fuzzy-if(skiaContent,2,4) needs-focus == select-create.html select-create.html +# B2G timed out waiting for reftest-wait to be removed +# Initial mulet triage: parity with B2G/B2G Desktop +needs-focus == autofocus-after-load.html autofocus-after-load.html +fails-if(B2G||Mulet) fuzzy-if(skiaContent,2,5) needs-focus == autofocus-leaves-iframe.html autofocus-leaves-iframe.html +# B2G focus difference between test and reference +# Initial mulet triage: parity with B2G/B2G Desktop +skip == autofocus-after-body-focus.html autofocus-after-body-focus.html +# bug 773482 +# Initial mulet triage: parity with B2G/B2G Desktop diff --git a/dom/html/reftests/autofocus/reftest.list b/dom/html/reftests/autofocus/reftest.list new file mode 100644 index 0000000000..703b414e61 --- /dev/null +++ b/dom/html/reftests/autofocus/reftest.list @@ -0,0 +1,14 @@ +default-preferences pref(dom.forms.number,true) pref(dom.forms.datetime,true) +fuzzy-if(skiaContent,1,3) needs-focus == input-load.html input-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == input-create.html input-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == input-number.html input-number-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == input-time.html input-time-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == button-load.html button-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == button-create.html button-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == textarea-load.html textarea-ref.html +fuzzy-if(skiaContent,1,3) needs-focus == textarea-create.html textarea-ref.html +fuzzy-if(skiaContent,9,6) needs-focus == select-load.html select-ref.html +fuzzy-if(skiaContent,2,4) needs-focus == select-create.html select-ref.html +needs-focus == autofocus-after-load.html autofocus-after-load-ref.html +fuzzy-if(skiaContent,2,5) needs-focus == autofocus-leaves-iframe.html autofocus-leaves-iframe-ref.html +fuzzy-if(skiaContent,2,5) 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..4216a05cf6 --- /dev/null +++ b/dom/html/reftests/autofocus/style.css @@ -0,0 +1,7 @@ +:focus { background-color: green; } + +/** + * 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> |