Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test bug 784410</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | </head> |
michael@0 | 9 | <body> |
michael@0 | 10 | <p id="display"></p> |
michael@0 | 11 | <div id="outer" style="overflow:auto; height:200px; border:2px dotted black;" onscroll="doneScroll()"> |
michael@0 | 12 | <div id="d" style="overflow:auto; height:102px;" onscroll="doneScroll()"> |
michael@0 | 13 | <div id="inner" style="height:100.1px; border:1px solid black; background:yellow;">Hello</div> |
michael@0 | 14 | </div> |
michael@0 | 15 | <div style="height:500px;"></div> |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script class="testbody" type="text/javascript;version=1.7"> |
michael@0 | 19 | var sel = window.getSelection(); |
michael@0 | 20 | var outer = document.getElementById("outer"); |
michael@0 | 21 | var d = document.getElementById("d"); |
michael@0 | 22 | var inner = document.getElementById("inner"); |
michael@0 | 23 | var smoothScrollPref = "general.smoothScroll"; |
michael@0 | 24 | |
michael@0 | 25 | function innerScrollOffset() { |
michael@0 | 26 | return inner.getBoundingClientRect().top - d.getBoundingClientRect().top; |
michael@0 | 27 | } |
michael@0 | 28 | var innerStartScrollOffset = innerScrollOffset(); |
michael@0 | 29 | |
michael@0 | 30 | var step = 0; |
michael@0 | 31 | function doneScroll() { |
michael@0 | 32 | ++step; |
michael@0 | 33 | switch (step) { |
michael@0 | 34 | case 1: |
michael@0 | 35 | is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down"); |
michael@0 | 36 | ok(outer.scrollTop > 0, "Outer element should have scrolled down"); |
michael@0 | 37 | |
michael@0 | 38 | outer.scrollTop = 0; |
michael@0 | 39 | break; |
michael@0 | 40 | case 2: |
michael@0 | 41 | synthesizeWheel(inner, 4, 4, |
michael@0 | 42 | { deltaMode: WheelEvent.DOM_DELTA_LINE, deltaY: 1 }); |
michael@0 | 43 | break; |
michael@0 | 44 | case 3: |
michael@0 | 45 | is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down"); |
michael@0 | 46 | ok(outer.scrollTop > 0, "Outer element should have scrolled down"); |
michael@0 | 47 | |
michael@0 | 48 | SpecialPowers.clearUserPref(smoothScrollPref); |
michael@0 | 49 | SimpleTest.finish(); |
michael@0 | 50 | break; |
michael@0 | 51 | } |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | function test() { |
michael@0 | 55 | SpecialPowers.setBoolPref(smoothScrollPref, false); |
michael@0 | 56 | sel.collapse(inner.firstChild, 2); |
michael@0 | 57 | synthesizeKey("VK_PAGE_DOWN", {}); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 61 | SimpleTest.waitForFocus(test); |
michael@0 | 62 | |
michael@0 | 63 | </script> |
michael@0 | 64 | </pre> |
michael@0 | 65 | </body> |
michael@0 | 66 | </html> |