test_bug1714640.html (1212B)
1 <!DOCTYPE HTML> 2 <meta charset="utf-8"> 3 <title>Bug NNN</title> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <script src="/tests/SimpleTest/EventUtils.js"></script> 6 <link rel="stylesheet" href="/tests/SimpleTest/test.css"> 7 <style> 8 @font-face { 9 font-family: Ahem; 10 src: url("Ahem.ttf"); 11 } 12 13 pre { 14 font: 14px/1 Ahem; 15 height: 50px; 16 overflow-y: scroll; 17 } 18 </style> 19 <pre id=target contenteditable>ABC 20 21 22 23 24 25 <br></pre> 26 <script> 27 getSelection().collapse(target.childNodes[0], 9); 28 SimpleTest.waitForExplicitFinish(); 29 SimpleTest.waitForFocus(() => { 30 target.focus(); 31 is(document.activeElement, target, "Should be focused"); 32 is(target.scrollTop, 0, "Should be scrolled to the top"); 33 34 let editor = SpecialPowers.wrap(window).docShell.editor; 35 let controller = editor.selectionController; 36 let nsISelectionController = SpecialPowers.Ci.nsISelectionController; 37 controller.scrollSelectionIntoView(nsISelectionController.SELECTION_NORMAL, nsISelectionController.SELECTION_ANCHOR_REGION, nsISelectionController.SCROLL_SYNCHRONOUS); 38 39 isfuzzy(target.scrollTop, target.scrollTopMax, 1, "Should be scrolled to the bottom"); 40 SimpleTest.finish(); 41 }); 42 </script>