Bug 1689343 - Enlarge the iframe viewport in bug1448730.html. r=spohl

Without this the non-native theme fails the last assertion of the test.

I couldn't reproduce locally but the word that it's supposed to be
selected is very close to being out of the iframe viewport on my
machine, so it'd make sense if the new non-native theme, which has a bit
more padding, causes the word to move a bit further down.

I've confirmed this fixes the issue.

Differential Revision: https://phabricator.services.mozilla.com/D103317
This commit is contained in:
Emilio Cobos Álvarez 2021-01-29 14:31:32 +00:00
Родитель 350b9c52f0
Коммит 0a06c5acab
2 изменённых файлов: 133 добавлений и 131 удалений

Просмотреть файл

@ -1,103 +1,103 @@
<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<p id="display">
<input id="input">
<textarea id="textarea" cols="10" rows="2"></textarea>
<div id="editable" contenteditable style="width: 200px;"></div>
</p>
<div id="content" style="display: none;"></div>
<pre id="test">
</pre>
<script>
const SimpleTest = parent.SimpleTest;
const is = parent.is;
const isnot = parent.isnot;
const ok = parent.ok;
window.addEventListener("load", runTest);
function runTest() {
let target = document.getElementById("input");
target.focus();
// <input>
target.value = " ";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, target.value.length, "Don't select whitespace");
is(target.selectionEnd, target.value.length, "Don't select whitespace");
target.value = "abc";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, target.value.length, "Don't select word");
is(target.selectionEnd, target.value.length, "Don't select word");
target.value = " ".repeat(100);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, 0, "Select whitespace");
// <textarea>
target = document.getElementById("textarea");
target.value = " ";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, 2, "Don't select whitespace");
is(target.selectionEnd, 2, "Don't select whitespace");
target.value = "abc";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, target.value.length, "Don't select word");
is(target.selectionEnd, target.value.length, "Don't select word");
target.value = " ".repeat(10) + "\n" + " ".repeat(10) + "\n" + " ".repeat(10);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
isnot(target.selectionStart, target.selectionEnd, "Select whitespace");
// contenteditable
target = document.getElementById("editable");
target.innerHTML = "test";
target.focus();
let range = document.createRange();
range.setStart(target.firstChild, target.firstChild.length);
range.setEnd(target.firstChild, target.firstChild.length);
let selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
ok(selection.getRangeAt(0).collapsed, "Don't select word");
target.innerHTML = "t".repeat(50);
target.focus();
range = document.createRange();
range.setStart(target.firstChild, target.firstChild.length);
range.setEnd(target.firstChild, target.firstChild.length);
selection.removeAllRanges();
selection.addRange(range);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
ok(!selection.getRangeAt(0).collapsed, "Select word");
SimpleTest.finish();
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<p id="display">
<input id="input">
<textarea id="textarea" cols="10" rows="2"></textarea>
<div id="editable" contenteditable style="width: 200px;"></div>
</p>
<div id="content" style="display: none;"></div>
<pre id="test">
</pre>
<script>
const SimpleTest = parent.SimpleTest;
const is = parent.is;
const isnot = parent.isnot;
const ok = parent.ok;
window.addEventListener("load", runTest);
function runTest() {
let target = document.getElementById("input");
target.focus();
// <input>
target.value = " ";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, target.value.length, "Don't select whitespace");
is(target.selectionEnd, target.value.length, "Don't select whitespace");
target.value = "abc";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, target.value.length, "Don't select word");
is(target.selectionEnd, target.value.length, "Don't select word");
target.value = " ".repeat(100);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, 0, "Select whitespace");
// <textarea>
target = document.getElementById("textarea");
target.value = " ";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, 2, "Don't select whitespace");
is(target.selectionEnd, 2, "Don't select whitespace");
target.value = "abc";
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
is(target.selectionStart, target.value.length, "Don't select word");
is(target.selectionEnd, target.value.length, "Don't select word");
target.value = " ".repeat(10) + "\n" + " ".repeat(10) + "\n" + " ".repeat(10);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
isnot(target.selectionStart, target.selectionEnd, "Select whitespace");
// contenteditable
target = document.getElementById("editable");
target.innerHTML = "test";
target.focus();
let range = document.createRange();
range.setStart(target.firstChild, target.firstChild.length);
range.setEnd(target.firstChild, target.firstChild.length);
let selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
ok(selection.getRangeAt(0).collapsed, "Don't select word");
target.innerHTML = "t".repeat(50);
target.focus();
range = document.createRange();
range.setStart(target.firstChild, target.firstChild.length);
range.setEnd(target.firstChild, target.firstChild.length);
selection.removeAllRanges();
selection.addRange(range);
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
ok(!selection.getRangeAt(0).collapsed, "Select word");
SimpleTest.finish();
}
</script>
</body>
</html>

Просмотреть файл

@ -1,28 +1,30 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1448730
-->
<head>
<title>Mozilla Bug 1448730</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1448730">Mozilla Bug 1448730</a>
<p id="display">
<div id="container" style="width: 600px; height: 500px;"></div>
</p>
<div id="content" style="display: none;"></div>
<pre id="test">
</pre>
<script>
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['layout.accessiblecaret.enabled', true]]}, () => {
let iframe = document.createElement("iframe");
iframe.src = "bug1448730.html";
document.getElementById('container').appendChild(iframe);
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1448730
-->
<head>
<title>Mozilla Bug 1448730</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1448730">Mozilla Bug 1448730</a>
<p id="display">
<div id="container" style="width: 600px; height: 500px;"></div>
</p>
<div id="content" style="display: none;"></div>
<pre id="test">
</pre>
<script>
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['layout.accessiblecaret.enabled', true]]}, () => {
let iframe = document.createElement("iframe");
iframe.src = "bug1448730.html";
iframe.style.width = "100%";
iframe.style.height = "100%";
document.getElementById('container').appendChild(iframe);
});
</script>
</body>
</html>