diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/reftests/selection | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/reftests/selection')
51 files changed, 1741 insertions, 0 deletions
diff --git a/layout/reftests/selection/addrange-1.html b/layout/reftests/selection/addrange-1.html new file mode 100644 index 000000000..648d42140 --- /dev/null +++ b/layout/reftests/selection/addrange-1.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> + <head> + <title>Testcase #2 for bug 602331</title> + <script type="text/javascript" charset="utf-8"> + function selectNewlyAdded() { + window.getSelection().removeAllRanges(); + + var newNode = document.createElement('span'); + newNode.innerHTML = "Hello Kitty"; + document.getElementById('new_nodes').appendChild(newNode); + var range = document.createRange(); + range.selectNode(newNode); + window.getSelection().addRange(range); + } + + </script> + </head> + <body onload="selectNewlyAdded()"> + * <span id="new_nodes"></span> * + </body> +</html> diff --git a/layout/reftests/selection/addrange-2.html b/layout/reftests/selection/addrange-2.html new file mode 100644 index 000000000..480e93678 --- /dev/null +++ b/layout/reftests/selection/addrange-2.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <head> + <title>Testcase #3 for bug 602331</title> + <script type="text/javascript" charset="utf-8"> + function selectAllOfNewNodes() { + window.getSelection().removeAllRanges(); + + var newNode = document.createElement('span'); + newNode.innerHTML = "Kitty"; + document.getElementById('new_nodes').appendChild(newNode); + var range = document.createRange(); + range.selectNode(document.getElementById('new_nodes')); + window.getSelection().addRange(range); + + } + + </script> + </head> + <body onload="selectAllOfNewNodes()"> + * <span id="new_nodes"><span>Hello</span> </span> * + </body> +</html> diff --git a/layout/reftests/selection/addrange-ref.html b/layout/reftests/selection/addrange-ref.html new file mode 100644 index 000000000..4e6a70db2 --- /dev/null +++ b/layout/reftests/selection/addrange-ref.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> + <head> + <title>Testcase #1 for bug 602331</title> + <script type="text/javascript" charset="utf-8"> + function selectExisting() { + window.getSelection().removeAllRanges(); + + var range = document.createRange(); + range.selectNode(document.getElementById('existing_node')); + window.getSelection().addRange(range); + } + </script> + </head> + <body onload="selectExisting()"> + * <span id="existing_node">Hello Kitty</span> * + </body> +</html> diff --git a/layout/reftests/selection/dom-mutations-ref.html b/layout/reftests/selection/dom-mutations-ref.html new file mode 100644 index 000000000..30a0050fc --- /dev/null +++ b/layout/reftests/selection/dom-mutations-ref.html @@ -0,0 +1,190 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=619273 +--> +<head> + <title>Test for Bug 619273</title> +<script type="application/javascript;version=1.7"> +/** Test DOM mutations inside selection **/ +function createDOM(doc) { + let s = doc.createElement('span'); + s.appendChild(doc.createTextNode('|')) + let s2 = doc.createElement('span'); + s2.appendChild(doc.createTextNode('z')) + s.appendChild(s2) + return s; +} + +var tests_done = 0; +var tests = [ + function(win,doc,sel) { + doc.body.innerHTML = '.I<br>B<br>C|z' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(a, 1); + r.setEnd(a, 2); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = '.I<br>B<br>C|z' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(doc.firstChild, 0); + r.setEnd(a, 2); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>.B<br>C|z' + let a = doc.body.firstChild; + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>.B<br>C|z' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc.body, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>.B<br>C|z' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>.C|z' + let a = doc.body.firstChild; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 2); + sel.addRange(r); + }, + + function(win,doc,sel) { + doc.body.innerHTML = '|z|zI<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(a, 4); + r.setEnd(a, 5); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = '|z|zI<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(doc.firstChild, 0); + r.setEnd(a, 5); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>|z|zB<br>C' + let a = doc.body.firstChild; + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>|z|zB<br>C' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc.body, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>|z|zB<br>C' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>|z|zC' + let a = doc.body.firstChild; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 5); + sel.addRange(r); + }, + + function(win,doc,sel) { + doc.body.innerHTML = '<br>B<br>CI' + }, + function(win,doc,sel) { + doc.body.innerHTML = '<br>B<br>C' + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + }, + + function(win,doc,sel) { + doc.body.innerHTML = 'I|z' + }, + + function(win,doc,sel) { + doc.body.innerHTML = 'Iz|' + + document.body.appendChild(document.createTextNode('I')); + document.body.appendChild(document.createTextNode(' ')); + document.body.appendChild(createDOM(document)); + }, +] + +function runTestInIframe(run,t) { + let f = document.createElement('iframe'); + f.setAttribute('frameborder','0'); + f.setAttribute('height','100'); + f.setAttribute('width','200'); + f.src = 'data:text/html,<body style="margin:0;padding:0;font-family:monospace">'; + f.onload = function () { + try { + run(f.contentWindow, f.contentDocument, f.contentWindow.getSelection()); + } finally { ++tests_done; } + } + return f; +} + +var id; +function checkFinished() { + if (window.frames.length == tests_done) { + clearInterval(id); + document.documentElement.className = ""; + } +} + +function runTest() { + for (let i=0; i < tests.length; ++i) { + let t = tests[i]; + document.body.appendChild(runTestInIframe(t)); + } + id = setInterval(checkFinished,500); +} +</script> +</head> +<body onload="runTest()"></body> +</html> diff --git a/layout/reftests/selection/dom-mutations.html b/layout/reftests/selection/dom-mutations.html new file mode 100644 index 000000000..410c4b2f9 --- /dev/null +++ b/layout/reftests/selection/dom-mutations.html @@ -0,0 +1,250 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=619273 +--> +<head> + <title>Test for Bug 619273</title> +<script type="application/javascript;version=1.7"> +/** Test DOM mutations inside selection **/ +function createDOM(doc) { + let s = doc.createElement('span'); + s.appendChild(doc.createTextNode('|')) + let s2 = doc.createElement('span'); + s2.appendChild(doc.createTextNode('z')) + s.appendChild(s2) + return s; +} + +var tests_done = 0; +var tests = [ + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(a, 1); + sel.addRange(r); + doc.body.insertBefore(doc.createTextNode('.'), a); + doc.body.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(doc.firstChild, 0); + r.setEnd(a, 1); + sel.addRange(r); + doc.body.insertBefore(doc.createTextNode('.'), a); + doc.body.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + doc.body.insertBefore(doc.createTextNode('.'), b); + doc.body.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc.body, 0); + r.setEnd(c, 1); + sel.addRange(r); + doc.body.insertBefore(doc.createTextNode('.'), b); + doc.body.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc, 0); + r.setEnd(c, 1); + sel.addRange(r); + doc.body.insertBefore(doc.createTextNode('.'), b); + doc.body.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + doc.body.insertBefore(doc.createTextNode('.'), c); + doc.body.appendChild(createDOM(doc)); + }, + + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(a, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, a); + span.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(doc.firstChild, 0); + r.setEnd(a, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, a); + span.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, b); + span.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc.body, 0); + r.setEnd(c, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, b); + span.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let b = doc.body.childNodes[2]; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(doc, 0); + r.setEnd(c, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, b); + span.appendChild(createDOM(doc)); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, c); + span.appendChild(createDOM(doc)); + }, + + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(a, 1); + sel.addRange(r); + doc.body.appendChild(a); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(a, 1); + sel.addRange(r); + document.adoptNode(a); + document.body.appendChild(a); + document.body.appendChild(document.createTextNode(' ')); + }, + function(win,doc,sel) { + doc.body.innerHTML = 'I<br>B<br>C' + let a = doc.body.firstChild; + let c = doc.body.childNodes[4]; + let r = doc.createRange(); + r.setStart(a, 0); + r.setEnd(c, 1); + sel.addRange(r); + let span = createDOM(doc); + doc.body.insertBefore(span, c); + document.adoptNode(span); + document.body.appendChild(span); + }, + + function(win,doc,sel) { + doc.body.innerHTML = 'I' + let a = doc.body.firstChild; + let span = createDOM(doc); + let r = doc.createRange(); + r.setStart(span, 0); + r.setEnd(span, 1); + sel.addRange(r); + doc.body.appendChild(span); + }, + + function(win,doc,sel) { + doc.body.innerHTML = 'I' + let a = doc.body.firstChild; + let span = createDOM(doc); + let r = doc.createRange(); + r.setStart(span.firstChild, 0); + r.setEnd(span.firstChild, 1); + sel.addRange(r); + doc.body.appendChild(span); + doc.body.appendChild(span.firstChild); + r.setEnd(span.firstChild, 1); + }, +] + +function runTestInIframe(run,t) { + let f = document.createElement('iframe'); + f.setAttribute('frameborder','0'); + f.setAttribute('height','100'); + f.setAttribute('width','200'); + f.src = 'data:text/html,<body style="margin:0;padding:0;font-family:monospace">'; + f.onload = function () { + try { + run(f.contentWindow, f.contentDocument, f.contentWindow.getSelection()); + } finally { ++tests_done; } + } + return f; +} + +var id; +function checkFinished() { + if (window.frames.length == tests_done) { + clearInterval(id); + document.documentElement.className = ""; + } +} + +function runTest() { + for (let i=0; i < tests.length; ++i) { + let t = tests[i]; + document.body.appendChild(runTestInIframe(t)); + } + id = setInterval(checkFinished,500); +} +</script> +</head> +<body onload="runTest()"></body> +</html> diff --git a/layout/reftests/selection/dynamic-text-1-ref.html b/layout/reftests/selection/dynamic-text-1-ref.html new file mode 100644 index 000000000..755297963 --- /dev/null +++ b/layout/reftests/selection/dynamic-text-1-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre"> BC + FG + JK +<script> +document.body.offsetTop; +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 6); +sel.extend(t, 8); +</script> +</body> +</html> diff --git a/layout/reftests/selection/dynamic-text-1a.html b/layout/reftests/selection/dynamic-text-1a.html new file mode 100644 index 000000000..1595b545d --- /dev/null +++ b/layout/reftests/selection/dynamic-text-1a.html @@ -0,0 +1,22 @@ +<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<body style="white-space:pre"> 00
+ BC
+ FG
+ JK
+<script>
+document.body.offsetTop;
+var t = document.body.firstChild;
+var sel = window.getSelection();
+sel.collapse(t, 11);
+sel.extend(t, 13);
+
+function doTest() {
+ t.replaceData(0, 5, '');
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</body>
+</html>
diff --git a/layout/reftests/selection/dynamic-text-1b.html b/layout/reftests/selection/dynamic-text-1b.html new file mode 100644 index 000000000..9f90d9753 --- /dev/null +++ b/layout/reftests/selection/dynamic-text-1b.html @@ -0,0 +1,20 @@ +<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<body style="white-space:pre"> FG
+ JK
+<script>
+document.body.offsetTop;
+var t = document.body.firstChild;
+var sel = window.getSelection();
+sel.collapse(t, 1);
+sel.extend(t, 3);
+
+function doTest() {
+ t.insertData(0, ' BC \n');
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest, false);
+</script>
+</body>
+</html>
diff --git a/layout/reftests/selection/extend-1-ref.html b/layout/reftests/selection/extend-1-ref.html new file mode 100644 index 000000000..a3d5bd9f8 --- /dev/null +++ b/layout/reftests/selection/extend-1-ref.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); +sel.extend(t, 8); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1-sanity.html b/layout/reftests/selection/extend-1-sanity.html new file mode 100644 index 000000000..5e362a513 --- /dev/null +++ b/layout/reftests/selection/extend-1-sanity.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre">0123456789 +</body> +</html> diff --git a/layout/reftests/selection/extend-1a.html b/layout/reftests/selection/extend-1a.html new file mode 100644 index 000000000..716f949d6 --- /dev/null +++ b/layout/reftests/selection/extend-1a.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); +sel.extend(t, 9); + +function doTest() { + sel.extend(t, 8); + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1b.html b/layout/reftests/selection/extend-1b.html new file mode 100644 index 000000000..7a622f325 --- /dev/null +++ b/layout/reftests/selection/extend-1b.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test newfocus < anchor < focus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 8); // anchor +sel.extend(t, 9); // focus + +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1c.html b/layout/reftests/selection/extend-1c.html new file mode 100644 index 000000000..caf9f61c3 --- /dev/null +++ b/layout/reftests/selection/extend-1c.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test anchor < newfocus < focus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); // anchor +sel.extend(t, 9); // focus + +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1d.html b/layout/reftests/selection/extend-1d.html new file mode 100644 index 000000000..5d05ac5bb --- /dev/null +++ b/layout/reftests/selection/extend-1d.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test anchor < newfocus = focus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); // anchor +sel.extend(t, 8); // focus + +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1e.html b/layout/reftests/selection/extend-1e.html new file mode 100644 index 000000000..ac770e682 --- /dev/null +++ b/layout/reftests/selection/extend-1e.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test anchor < focus < newfocus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); // anchor +sel.extend(t, 6); // focus + +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1f.html b/layout/reftests/selection/extend-1f.html new file mode 100644 index 000000000..36fc28bdb --- /dev/null +++ b/layout/reftests/selection/extend-1f.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test newfocus < focus < anchor +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 8); // anchor +sel.extend(t, 4); // focus + +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1g.html b/layout/reftests/selection/extend-1g.html new file mode 100644 index 000000000..40d0372d4 --- /dev/null +++ b/layout/reftests/selection/extend-1g.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test newfocus = focus < anchor +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 8); // anchor +sel.extend(t, 2); // focus + +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1h.html b/layout/reftests/selection/extend-1h.html new file mode 100644 index 000000000..c91639d6a --- /dev/null +++ b/layout/reftests/selection/extend-1h.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test focus < newfocus < anchor +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 8); // anchor +sel.extend(t, 1); // focus + +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-1i.html b/layout/reftests/selection/extend-1i.html new file mode 100644 index 000000000..8a1ae5c06 --- /dev/null +++ b/layout/reftests/selection/extend-1i.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test focus < anchor < newfocus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); // anchor +sel.extend(t, 1); // focus + +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-2-ref.html b/layout/reftests/selection/extend-2-ref.html new file mode 100644 index 000000000..5e362a513 --- /dev/null +++ b/layout/reftests/selection/extend-2-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre">0123456789 +</body> +</html> diff --git a/layout/reftests/selection/extend-2a.html b/layout/reftests/selection/extend-2a.html new file mode 100644 index 000000000..6d5d1529e --- /dev/null +++ b/layout/reftests/selection/extend-2a.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test newfocus = anchor < focus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 2); // anchor +sel.extend(t, 8); // focus + +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-2b.html b/layout/reftests/selection/extend-2b.html new file mode 100644 index 000000000..6cdb5b453 --- /dev/null +++ b/layout/reftests/selection/extend-2b.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre">0123456789 +<script> +document.body.offsetTop; +// Test focus < anchor = newfocus +var t = document.body.firstChild; +var sel = window.getSelection(); +sel.collapse(t, 8); // anchor +sel.extend(t, 2); // focus + +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3-ref.html b/layout/reftests/selection/extend-3-ref.html new file mode 100644 index 000000000..37e78dad4 --- /dev/null +++ b/layout/reftests/selection/extend-3-ref.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 2); + sel.extend(t, 8); +} +window.addEventListener("load", loaded, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3-sanity.html b/layout/reftests/selection/extend-3-sanity.html new file mode 100644 index 000000000..9be470648 --- /dev/null +++ b/layout/reftests/selection/extend-3-sanity.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +</body> +</html> diff --git a/layout/reftests/selection/extend-3a.html b/layout/reftests/selection/extend-3a.html new file mode 100644 index 000000000..99636de24 --- /dev/null +++ b/layout/reftests/selection/extend-3a.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +var sel = window.getSelection(); +// Don't start the selection until the document is loaded; we may reconstruct +// frames for the images, which will lose their selection state (this is a bug) +function loaded() { + sel.collapse(t, 2); + sel.extend(t, 9); +} +function doTest() { + sel.extend(t, 8); + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3b.html b/layout/reftests/selection/extend-3b.html new file mode 100644 index 000000000..004119b4e --- /dev/null +++ b/layout/reftests/selection/extend-3b.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test newfocus < anchor < focus +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 8); // anchor + sel.extend(t, 9); // focus +} +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3c.html b/layout/reftests/selection/extend-3c.html new file mode 100644 index 000000000..d6b341af2 --- /dev/null +++ b/layout/reftests/selection/extend-3c.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test anchor < newfocus < focus +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 2); // anchor + sel.extend(t, 9); // focus +} +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3d.html b/layout/reftests/selection/extend-3d.html new file mode 100644 index 000000000..71518742d --- /dev/null +++ b/layout/reftests/selection/extend-3d.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test anchor < newfocus = focus +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 2); // anchor + sel.extend(t, 8); // focus +} +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3e.html b/layout/reftests/selection/extend-3e.html new file mode 100644 index 000000000..a7a8ce86d --- /dev/null +++ b/layout/reftests/selection/extend-3e.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test anchor < focus < newfocus +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 2); // anchor + sel.extend(t, 6); // focus +} +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3f.html b/layout/reftests/selection/extend-3f.html new file mode 100644 index 000000000..eed361edc --- /dev/null +++ b/layout/reftests/selection/extend-3f.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test newfocus < focus < anchor +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 8); // anchor + sel.extend(t, 4); // focus +} +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3g.html b/layout/reftests/selection/extend-3g.html new file mode 100644 index 000000000..a1cc8c235 --- /dev/null +++ b/layout/reftests/selection/extend-3g.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test newfocus = focus < anchor +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 8); // anchor + sel.extend(t, 2); // focus +} +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3h.html b/layout/reftests/selection/extend-3h.html new file mode 100644 index 000000000..9cd9cf7ba --- /dev/null +++ b/layout/reftests/selection/extend-3h.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test focus < newfocus < anchor +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 8); // anchor + sel.extend(t, 1); // focus +} +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-3i.html b/layout/reftests/selection/extend-3i.html new file mode 100644 index 000000000..a815b2bbb --- /dev/null +++ b/layout/reftests/selection/extend-3i.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +var t = document.body; +// Test focus < anchor < newfocus +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 2); // anchor + sel.extend(t, 1); // focus +} +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-4-ref.html b/layout/reftests/selection/extend-4-ref.html new file mode 100644 index 000000000..9be470648 --- /dev/null +++ b/layout/reftests/selection/extend-4-ref.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +</body> +</html> diff --git a/layout/reftests/selection/extend-4a.html b/layout/reftests/selection/extend-4a.html new file mode 100644 index 000000000..8d3a42315 --- /dev/null +++ b/layout/reftests/selection/extend-4a.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +// Test newfocus = anchor < focus +var t = document.body; +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 2); // anchor + sel.extend(t, 8); // focus +} +function doTest() { + sel.extend(t, 2); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/extend-4b.html b/layout/reftests/selection/extend-4b.html new file mode 100644 index 000000000..31cfffa9c --- /dev/null +++ b/layout/reftests/selection/extend-4b.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> +<body style="white-space:pre" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +><img src="data:image/gif;base64,R0lGODlhEAAQAPAAALuWAAAAACH5BAUIAAEALAMAAwAKAAoAAAIMDI5nye0Po5xutVAAADs=" +> +<script> +document.body.offsetTop; +// Test focus < anchor = newfocus +var t = document.body; +var sel = window.getSelection(); +function loaded() { + sel.collapse(t, 8); // anchor + sel.extend(t, 2); // focus +} +function doTest() { + sel.extend(t, 8); // newfocus + document.documentElement.removeAttribute('class'); +} +window.addEventListener("load", loaded, false); +document.addEventListener("MozReftestInvalidate", doTest, false); +</script> +</body> +</html> diff --git a/layout/reftests/selection/modify-range-ref.html b/layout/reftests/selection/modify-range-ref.html new file mode 100644 index 000000000..5086fcef8 --- /dev/null +++ b/layout/reftests/selection/modify-range-ref.html @@ -0,0 +1,68 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"><head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Testcase for bug </title> +<script> +var tests_done = 0; +var tests = [ + 'window.getSelection().getRangeAt(0).setEnd(document.getElementsByTagName("pre")[0].firstChild,9)', + 'window.getSelection().getRangeAt(0).setEndAfter(document.getElementsByTagName("pre")[0].firstChild)', + 'window.getSelection().getRangeAt(0).setEndBefore(document.getElementsByTagName("pre")[0].childNodes[1])', + 'pre=document.getElementsByTagName("pre")[0]; r=window.getSelection().getRangeAt(0); r.setEnd(pre.childNodes[1],3); r.setStartAfter(pre.firstChild)', + 'window.getSelection().getRangeAt(0).setStartBefore(document.getElementsByTagName("pre")[0].firstChild)', + 'window.getSelection().getRangeAt(0).selectNode(document.getElementsByTagName("pre")[0].firstChild)', + 'window.getSelection().getRangeAt(0).selectNodeContents(document.getElementsByTagName("pre")[0])', + 'window.getSelection().getRangeAt(0).collapse(true)', + 'window.getSelection().getRangeAt(0).surroundContents(document.createElement("span"))', + 'window.getSelection().getRangeAt(0).setStart(document,0)', + 'window.getSelection().getRangeAt(0).detach()', + 'window.getSelection().getRangeAt(0).extractContents()', + 'window.getSelection().getRangeAt(0).deleteContents()' +]; +function init_iframe(d) { + var pre = d.createElement('pre'); + pre.appendChild(d.createTextNode('first\nfirst\n')); + pre.appendChild(d.createTextNode('second')); + d.documentElement.appendChild(pre); + var text = pre.firstChild; + var sel = d.defaultView.getSelection(); + var r = d.createRange(); + r.setStart(text,0) + r.setEnd(text,3) + sel.addRange(r); + d.documentElement.offsetHeight; +} +function test_iframe(iframe, i) { + iframe.contentDocument.write( + '<'+'style>span { text-decoration:underline; } <'+'/style>' + + '<'+'script>' + + 'window.parent.init_iframe(document);' + + 'setTimeout(function(){' + window.parent.tests[i] + '; sel=window.getSelection(); try{r=sel.getRangeAt(0); sel.removeRange(r); sel.addRange(r);}catch(e){}; ++window.parent.tests_done; },0)' + + '<'+'/script>' + ); +} +function create_iframe(i) { + var div = document.createElement('div'); + document.body.appendChild(div); + div.innerHTML = "<iframe src='about:blank' style='height:6em; width:12em; float:left;' frameborder='0' onload='test_iframe(this,"+i+")'><iframe>" +} + +var id; +function check_if_done() { + if (tests_done == tests.length) { + clearInterval(id); + document.documentElement.className = ""; + } +} + +function test() { + for (i = 0; i < tests.length; ++i) { + create_iframe(i); + } + id = setInterval(check_if_done,500); +} +</script> + +</head> +<body onload="test()"></body> +</html> diff --git a/layout/reftests/selection/modify-range.html b/layout/reftests/selection/modify-range.html new file mode 100644 index 000000000..2595511ed --- /dev/null +++ b/layout/reftests/selection/modify-range.html @@ -0,0 +1,68 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"><head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <title>Testcase for bug </title> +<script> +var tests_done = 0; +var tests = [ + 'window.getSelection().getRangeAt(0).setEnd(document.getElementsByTagName("pre")[0].firstChild,9)', + 'window.getSelection().getRangeAt(0).setEndAfter(document.getElementsByTagName("pre")[0].firstChild)', + 'window.getSelection().getRangeAt(0).setEndBefore(document.getElementsByTagName("pre")[0].childNodes[1])', + 'pre=document.getElementsByTagName("pre")[0]; r=window.getSelection().getRangeAt(0); r.setEnd(pre.childNodes[1],3); r.setStartAfter(pre.firstChild)', + 'window.getSelection().getRangeAt(0).setStartBefore(document.getElementsByTagName("pre")[0].firstChild)', + 'window.getSelection().getRangeAt(0).selectNode(document.getElementsByTagName("pre")[0].firstChild)', + 'window.getSelection().getRangeAt(0).selectNodeContents(document.getElementsByTagName("pre")[0])', + 'window.getSelection().getRangeAt(0).collapse(true)', + 'window.getSelection().getRangeAt(0).surroundContents(document.createElement("span"))', + 'window.getSelection().getRangeAt(0).setStart(document,0)', + 'window.getSelection().getRangeAt(0).detach()', + 'window.getSelection().getRangeAt(0).extractContents()', + 'window.getSelection().getRangeAt(0).deleteContents()' +]; +function init_iframe(d) { + var pre = d.createElement('pre'); + pre.appendChild(d.createTextNode('first\nfirst\n')); + pre.appendChild(d.createTextNode('second')); + d.documentElement.appendChild(pre); + var text = pre.firstChild; + var sel = d.defaultView.getSelection(); + var r = d.createRange(); + r.setStart(text,0) + r.setEnd(text,3) + sel.addRange(r); + d.documentElement.offsetHeight; +} +function test_iframe(iframe, i) { + iframe.contentDocument.write( + '<'+'style>span { text-decoration:underline; } <'+'/style>' + + '<'+'script>' + + 'window.parent.init_iframe(document);' + + 'setTimeout(function(){' + window.parent.tests[i] + '; ++window.parent.tests_done; },0)' + + '<'+'/script>' + ); +} +function create_iframe(i) { + var div = document.createElement('div'); + document.body.appendChild(div); + div.innerHTML = "<iframe src='about:blank' style='height:6em; width:12em; float:left;' frameborder='0' onload='test_iframe(this,"+i+")'><iframe>" +} + +var id; +function check_if_done() { + if (tests_done == tests.length) { + clearInterval(id); + document.documentElement.className = ""; + } +} + +function test() { + for (i = 0; i < tests.length; ++i) { + create_iframe(i); + } + id = setInterval(check_if_done,500); +} +</script> + +</head> +<body onload="test()"></body> +</html> diff --git a/layout/reftests/selection/non-themed-widget-ref.html b/layout/reftests/selection/non-themed-widget-ref.html new file mode 100644 index 000000000..08faed7ec --- /dev/null +++ b/layout/reftests/selection/non-themed-widget-ref.html @@ -0,0 +1,16 @@ +<html> +<head> +<style type="text/css"> +input { + background-color: Highlight; +} +input::-moz-selection { + background-color: HighlightText; + color: Highlight; +} +</style> +</head> +<body onload="document.getElementById('i').select();"> +<input id="i" value="text"> +</body> +</html>
\ No newline at end of file diff --git a/layout/reftests/selection/non-themed-widget.html b/layout/reftests/selection/non-themed-widget.html new file mode 100644 index 000000000..7b8708fc1 --- /dev/null +++ b/layout/reftests/selection/non-themed-widget.html @@ -0,0 +1,12 @@ +<html> +<head> +<style type="text/css"> +input { + background-color: Highlight; +} +</style> +</head> +<body onload="document.getElementById('i').select();"> +<input id="i" value="text"> +</body> +</html>
\ No newline at end of file diff --git a/layout/reftests/selection/pseudo-element-of-native-anonymous-ref.html b/layout/reftests/selection/pseudo-element-of-native-anonymous-ref.html new file mode 100644 index 000000000..dbcfef7cf --- /dev/null +++ b/layout/reftests/selection/pseudo-element-of-native-anonymous-ref.html @@ -0,0 +1,13 @@ +<html> +<head> +<style type="text/css"> +input { + color: white; + background-color: green; +} +</style> +</head> +<body onload="document.getElementById('i').select();"> +<input value="text" id="i"> +</body> +</html>
\ No newline at end of file diff --git a/layout/reftests/selection/pseudo-element-of-native-anonymous.html b/layout/reftests/selection/pseudo-element-of-native-anonymous.html new file mode 100644 index 000000000..9193f1c27 --- /dev/null +++ b/layout/reftests/selection/pseudo-element-of-native-anonymous.html @@ -0,0 +1,17 @@ +<html> +<head> +<style type="text/css"> +input { + color: white; + background-color: green; +} +input::-moz-selection { + color: red; + background-color: blue; +} +</style> +</head> +<body onload="document.getElementById('i').select();"> +<input value="text" id="i"> +</body> +</html>
\ No newline at end of file diff --git a/layout/reftests/selection/reftest-stylo.list b/layout/reftests/selection/reftest-stylo.list new file mode 100644 index 000000000..c85f4468f --- /dev/null +++ b/layout/reftests/selection/reftest-stylo.list @@ -0,0 +1,43 @@ +# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing +fails fuzzy-if(skiaContent,1,30) == dynamic-text-1a.html dynamic-text-1a.html +fails fuzzy-if(skiaContent,1,40) == dynamic-text-1b.html dynamic-text-1b.html +== extend-1-sanity.html extend-1-sanity.html +fails fuzzy-if(skiaContent,1,1000) == extend-1a.html extend-1a.html +fails fuzzy-if(skiaContent,1,10) == extend-1b.html extend-1b.html +fails fuzzy-if(skiaContent,1,1000) == extend-1c.html extend-1c.html +fails fuzzy-if(skiaContent,1,1000) == extend-1d.html extend-1d.html +skip fuzzy-if(skiaContent,1,1000) == extend-1e.html extend-1e.html +fails fuzzy-if(skiaContent,1,1000) == extend-1f.html extend-1f.html +fails fuzzy-if(skiaContent,1,1000) == extend-1g.html extend-1g.html +fails fuzzy-if(skiaContent,1,1000) == extend-1h.html extend-1h.html +fails fuzzy-if(skiaContent,1,10) == extend-1i.html extend-1i.html +== extend-2a.html extend-2a.html +== extend-2b.html extend-2b.html +== extend-3-sanity.html extend-3-sanity.html +fuzzy-if(skiaContent,1,700) == extend-3a.html extend-3a.html +fuzzy-if(skiaContent,1,700) == extend-3b.html extend-3b.html +fuzzy-if(skiaContent,1,700) == extend-3c.html extend-3c.html +fuzzy-if(skiaContent,1,700) == extend-3d.html extend-3d.html +fuzzy-if(skiaContent,1,700) == extend-3e.html extend-3e.html +fuzzy-if(skiaContent,1,700) == extend-3f.html extend-3f.html +fuzzy-if(skiaContent,1,700) == extend-3g.html extend-3g.html +fuzzy-if(skiaContent,1,700) == extend-3h.html extend-3h.html +fuzzy-if(skiaContent,1,700) == extend-3i.html extend-3i.html +== extend-4a.html extend-4a.html +== extend-4b.html extend-4b.html +# these 3 random-if(Android) are a difference of Native & Xul, see bug 739714 +skip random-if(Android||B2G||Mulet) needs-focus == pseudo-element-of-native-anonymous.html pseudo-element-of-native-anonymous.html +# bug 676641 +# Initial mulet triage: parity with B2G/B2G Desktop +# These tests uses Highlight and HighlightText color keywords, they are not same as text selection color on Mac. +random-if(Android||B2G||Mulet) fails-if(cocoaWidget) needs-focus == non-themed-widget.html non-themed-widget.html +# bug 773482 +# Initial mulet triage: parity with B2G/B2G Desktop +random-if(Android||B2G||Mulet) fails-if(cocoaWidget) needs-focus == themed-widget.html themed-widget.html +# Initial mulet triage: parity with B2G/B2G Desktop +== addrange-1.html addrange-1.html +fuzzy-if(skiaContent,1,1200) == addrange-2.html addrange-2.html +skip == splitText-normalize.html splitText-normalize.html +skip == modify-range.html modify-range.html +skip == dom-mutations.html dom-mutations.html +fuzzy-if(OSX==1010,9,1) fuzzy-if(OSX&&skiaContent,6,1) fuzzy-if(skiaContent&&!OSX,1,2138) == trailing-space-1.html trailing-space-1.html diff --git a/layout/reftests/selection/reftest.list b/layout/reftests/selection/reftest.list new file mode 100644 index 000000000..4b20b4790 --- /dev/null +++ b/layout/reftests/selection/reftest.list @@ -0,0 +1,37 @@ +fuzzy-if(skiaContent,1,30) == dynamic-text-1a.html dynamic-text-1-ref.html +fuzzy-if(skiaContent,1,40) == dynamic-text-1b.html dynamic-text-1-ref.html +!= extend-1-sanity.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1a.html extend-1-ref.html +fuzzy-if(skiaContent,1,10) == extend-1b.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1c.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1d.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1e.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1f.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1g.html extend-1-ref.html +fuzzy-if(skiaContent,1,1000) == extend-1h.html extend-1-ref.html +fuzzy-if(skiaContent,1,10) == extend-1i.html extend-1-ref.html +== extend-2a.html extend-2-ref.html +== extend-2b.html extend-2-ref.html +!= extend-3-sanity.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3a.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3b.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3c.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3d.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3e.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3f.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3g.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3h.html extend-3-ref.html +fuzzy-if(skiaContent,1,700) == extend-3i.html extend-3-ref.html +== extend-4a.html extend-4-ref.html +== extend-4b.html extend-4-ref.html +# these 3 random-if(Android) are a difference of Native & Xul, see bug 739714 +random-if(Android) needs-focus != pseudo-element-of-native-anonymous.html pseudo-element-of-native-anonymous-ref.html # bug 676641 +# These tests uses Highlight and HighlightText color keywords, they are not same as text selection color on Mac. +random-if(Android) fails-if(cocoaWidget) needs-focus == non-themed-widget.html non-themed-widget-ref.html +random-if(Android) fails-if(cocoaWidget) needs-focus == themed-widget.html themed-widget-ref.html +== addrange-1.html addrange-ref.html +fuzzy-if(skiaContent,1,1200) == addrange-2.html addrange-ref.html +== splitText-normalize.html splitText-normalize-ref.html +== modify-range.html modify-range-ref.html +== dom-mutations.html dom-mutations-ref.html +fuzzy-if(OSX==1010,9,1) fuzzy-if(OSX&&skiaContent,6,1) fuzzy-if(skiaContent&&!OSX,1,2138) == trailing-space-1.html trailing-space-1-ref.html diff --git a/layout/reftests/selection/splitText-normalize-ref.html b/layout/reftests/selection/splitText-normalize-ref.html new file mode 100644 index 000000000..fd507ab0f --- /dev/null +++ b/layout/reftests/selection/splitText-normalize-ref.html @@ -0,0 +1,40 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=191864 +--> +<head> + <title>Test for Bug 191864</title> + <script type="application/javascript;version=1.7" src="splitText-normalize.js"></script> +<script type="application/javascript;version=1.7"> +var id; +function checkFinished() { + if (window.frames.length == tests_done) { + clearInterval(id); + document.documentElement.className = ""; + } +} + +function runTest() { + let col1 = document.getElementById('col1'); + let col2 = document.getElementById('col2'); + let col3 = document.getElementById('col3'); + let col4 = document.getElementById('col4'); + for (let i=0; i < tests.length; ++i) { + let t = tests[i]; + col1.appendChild(createFrame(test_ref,t)); + col2.appendChild(createFrame(test_ref,t)); + col3.appendChild(createFrame(test_ref,t)); + col4.appendChild(createFrame(test_ref,t)); + } + id = setInterval(checkFinished,500); +} +</script> +</head> +<body onload="runTest()"> +<span id="col1" style="float:left; height:800px; width:180px;"></span> +<span id="col2" style="float:left; height:800px; width:180px;"></span> +<span id="col3" style="float:left; height:800px; width:180px;"></span> +<span id="col4" style="float:left; height:800px; width:180px;"></span> +</body> +</html> diff --git a/layout/reftests/selection/splitText-normalize.html b/layout/reftests/selection/splitText-normalize.html new file mode 100644 index 000000000..a6fc7ed64 --- /dev/null +++ b/layout/reftests/selection/splitText-normalize.html @@ -0,0 +1,40 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=191864 +--> +<head> + <title>Test for Bug 191864</title> + <script type="application/javascript;version=1.7" src="splitText-normalize.js"></script> +<script type="application/javascript;version=1.7"> +var id; +function checkFinished() { + if (window.frames.length == tests_done) { + clearInterval(id); + document.documentElement.className = ""; + } +} + +function runTest() { + let col1 = document.getElementById('col1'); + let col2 = document.getElementById('col2'); + let col3 = document.getElementById('col3'); + let col4 = document.getElementById('col4'); + for (let i=0; i < tests.length; ++i) { + let t = tests[i]; + col1.appendChild(createFrame(test_split,t)); + col2.appendChild(createFrame(test_split_merge,t)); + col3.appendChild(createFrame(test_merge,t)); + col4.appendChild(createFrame(test_split_insert,t)); + } + id = setInterval(checkFinished,500); +} +</script> +</head> +<body onload="runTest()"> +<span id="col1" style="float:left; height:800px; width:180px;"></span> +<span id="col2" style="float:left; height:800px; width:180px;"></span> +<span id="col3" style="float:left; height:800px; width:180px;"></span> +<span id="col4" style="float:left; height:800px; width:180px;"></span> +</body> +</html> diff --git a/layout/reftests/selection/splitText-normalize.js b/layout/reftests/selection/splitText-normalize.js new file mode 100644 index 000000000..ae3dd312f --- /dev/null +++ b/layout/reftests/selection/splitText-normalize.js @@ -0,0 +1,86 @@ +/** Test for Bug 191864 **/ +var tests_done = 0; +var tests = [ + [ {}, [0,4], "012345678" ], + [ {}, [0,0], "012345678" ], + [ {}, [0,9], "012345678" ], + [ {startOffset:4}, [0,4], "012345678" ], + [ {startOffset:5}, [0,4], "012345678" ], + [ {startOffset:5,endOffset:6}, [0,4], "012345678" ], + [ {endOffset:5}, [0,4], "012345678" ], + [ {endOffset:4}, [0,4], "012345678" ], + [ {endOffset:3}, [0,4], "012345678" ], + [ {startOffset:1,endOffset:3}, [0,4], "012345678" ], + [ {startOffset:7,endOffset:7}, [0,4], "012345678" ], + [ {startOffset:4,endOffset:4}, [0,4], "012345678" ], + [ {endNode:1}, [0,4], "012345678", "" ], + [ {endNode:1}, [0,4], "01234567", "8" ], + [ {endNode:1}, [1,4], "0", "12345678" ], + [ {startOffset:1,endNode:1}, [0,0], "0", "12345678" ], + [ {endNode:2}, [1,4], "0", "12345", "678" ], +] + +function runtest(f,t,nosplit) { + // create content + let doc = f.contentDocument; + for (let i = 2; i < t.length; ++i) { + c = doc.createTextNode(t[i]); + doc.body.appendChild(c); + } + + // setup selection + let sel = t[0] + let startNode = sel.startNode === undefined ? doc.body.firstChild : doc.body.childNodes[sel.startNode]; + let startOffset = sel.startOffset === undefined ? 0 : sel.startOffset; + let endNode = sel.endNode === undefined ? startNode : doc.body.childNodes[sel.endNode]; + let endOffset = sel.endOffset === undefined ? endNode.length : sel.endOffset; + let selection = f.contentWindow.getSelection(); + let r = doc.createRange(); + r.setStart(startNode, startOffset); + r.setEnd(endNode, endOffset); + selection.addRange(r); + + // splitText + let split = t[1] + if (!nosplit) + doc.body.childNodes[split[0]].splitText(split[1]) +} +function test_ref(f,t,nosplit) { + runtest(f,t,true); +} +function test_split(f,t) { + runtest(f,t); +} +function test_split_insert(f,t) { + runtest(f,t); + let doc = f.contentDocument; + doc.body.firstChild; + let split = t[1] + let text1 = doc.body.childNodes[split[0]] + let text2 = doc.body.childNodes[split[0]+1] + if (text2.textContent.length==0) return; + let c = doc.createTextNode(text2.textContent[0]); + doc.body.insertBefore(c,text2); + let r = doc.createRange(); + r.setStart(text2, 0); + r.setEnd(text2, 1); + r.deleteContents(); +} +function test_split_merge(f,t) { + runtest(f,t); + f.contentDocument.body.normalize(); +} +function test_merge(f,t) { + runtest(f,t,true); + f.contentDocument.body.normalize(); +} + +function createFrame(run,t) { + let f = document.createElement('iframe'); + f.setAttribute('height','22'); + f.setAttribute('frameborder','0'); + f.setAttribute('width','200'); + f.src = 'data:text/html,<body style="margin:0;padding:0">'; + f.onload = function () { try { run(f, t); } finally { ++tests_done; } } + return f; +} diff --git a/layout/reftests/selection/themed-widget-ref.html b/layout/reftests/selection/themed-widget-ref.html new file mode 100644 index 000000000..1a932c303 --- /dev/null +++ b/layout/reftests/selection/themed-widget-ref.html @@ -0,0 +1,13 @@ +<html> +<head> +<style type="text/css"> +input::-moz-selection { + background-color: Highlight; + color: HighlightText; +} +</style> +</head> +<body onload="document.getElementById('i').select();"> +<input id="i" value="text"> +</body> +</html>
\ No newline at end of file diff --git a/layout/reftests/selection/themed-widget.html b/layout/reftests/selection/themed-widget.html new file mode 100644 index 000000000..6d94f5584 --- /dev/null +++ b/layout/reftests/selection/themed-widget.html @@ -0,0 +1,5 @@ +<html> +<body onload="document.getElementById('i').select();"> +<input id="i" value="text"> +</body> +</html>
\ No newline at end of file diff --git a/layout/reftests/selection/trailing-space-1-ref.html b/layout/reftests/selection/trailing-space-1-ref.html new file mode 100644 index 000000000..bb33604a7 --- /dev/null +++ b/layout/reftests/selection/trailing-space-1-ref.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> + <title>Test for bug 1146754</title> + <script> + function selectTest() { + window.getSelection().removeAllRanges(); + var range = document.createRange(); + range.selectNode(document.querySelector('#test')); + window.getSelection().addRange(range); + } + </script> + <style> + body { padding: 1em; } + div>div { height: 2em; } + </style> + </head> + <body onload="selectTest()" contenteditable> + <div id="test"> + <div>123 <span style="color:transparent;font-size:0">x</span></div> + <div style="text-shadow:8px 3px 0 red;">456 <span style="color:transparent;font-size:0">x</span></div> + <div><u>789</u> <span style="color:transparent;font-size:0">x</span></div> + <div style="text-shadow:-4px 3px 0 red;"><u>012</u> <span style="color:transparent;font-size:0">x</span></div> + </div> + </body> +</html> diff --git a/layout/reftests/selection/trailing-space-1.html b/layout/reftests/selection/trailing-space-1.html new file mode 100644 index 000000000..487cd726e --- /dev/null +++ b/layout/reftests/selection/trailing-space-1.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> + <title>Test for bug 1146754</title> + <script> + function selectTest() { + window.getSelection().removeAllRanges(); + var range = document.createRange(); + range.selectNode(document.querySelector('#test')); + window.getSelection().addRange(range); + } + </script> + <style> + body { padding: 1em; } + div>div { height: 2em; } + </style> + </head> + <body onload="selectTest()" contenteditable> + <div id="test"> + <div>123 </div> + <div style="text-shadow:8px 3px 0 red;">456 </div> + <div style="text-decoration:underline">789 </div> + <div style="text-decoration:underline; text-shadow:-4px 3px 0 red;">012 </div> + </div> + </body> +</html> |