There are no callers from JS (looked at the selection region constant usage in idl and those use nsISelectionController, not this). If we were to provide this API in the future, it would probably use ScrollIntoViewOptions or so instead (plus something extra perhaps). I wanted to remove the weird WehreToScroll percentage impl, but actually some C++ accessibility code still uses it. Differential Revision: https://phabricator.services.mozilla.com/D216872
43 lines
1.2 KiB
HTML
43 lines
1.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<meta charset="utf-8">
|
|
<title>Bug NNN</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
|
<style>
|
|
@font-face {
|
|
font-family: Ahem;
|
|
src: url("Ahem.ttf");
|
|
}
|
|
|
|
pre {
|
|
font: 14px/1 Ahem;
|
|
height: 50px;
|
|
overflow-y: scroll;
|
|
}
|
|
</style>
|
|
<pre id=target contenteditable>ABC
|
|
|
|
|
|
|
|
|
|
|
|
<br></pre>
|
|
<script>
|
|
getSelection().collapse(target.childNodes[0], 9);
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.waitForFocus(() => {
|
|
target.focus();
|
|
is(document.activeElement, target, "Should be focused");
|
|
is(target.scrollTop, 0, "Should be scrolled to the top");
|
|
|
|
let editor = SpecialPowers.wrap(window).docShell.editor;
|
|
let controller = editor.selectionController;
|
|
let nsISelectionController = SpecialPowers.Ci.nsISelectionController;
|
|
controller.scrollSelectionIntoView(nsISelectionController.SELECTION_NORMAL, nsISelectionController.SELECTION_ANCHOR_REGION, nsISelectionController.SCROLL_SYNCHRONOUS);
|
|
|
|
is(target.scrollTop, target.scrollTopMax, "Should be scrolled to the bottom");
|
|
SimpleTest.finish();
|
|
});
|
|
</script>
|