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 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=946632 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for bug 946632 - propagate mouse-wheel vertical scroll events to container</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | <style> |
michael@0 | 12 | .scrollable { |
michael@0 | 13 | overflow: scroll; |
michael@0 | 14 | height: 200px; |
michael@0 | 15 | width: 200px; |
michael@0 | 16 | } |
michael@0 | 17 | input { |
michael@0 | 18 | font-size: 72px; |
michael@0 | 19 | height: 20px; |
michael@0 | 20 | width: 20px; |
michael@0 | 21 | } |
michael@0 | 22 | </style> |
michael@0 | 23 | </head> |
michael@0 | 24 | <body> |
michael@0 | 25 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=946632">Mozilla Bug 946632</a> |
michael@0 | 26 | <p id="display"></p> |
michael@0 | 27 | <div id="container" class="scrollable"> |
michael@0 | 28 | <input value="value"> |
michael@0 | 29 | x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br>x<br> |
michael@0 | 30 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
michael@0 | 31 | </div> |
michael@0 | 32 | <div id="content" style="display: none"> |
michael@0 | 33 | |
michael@0 | 34 | </div> |
michael@0 | 35 | <pre id="test"> |
michael@0 | 36 | <script type="application/javascript"> |
michael@0 | 37 | |
michael@0 | 38 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 39 | SimpleTest.waitForFocus(runTests, window); |
michael@0 | 40 | |
michael@0 | 41 | var input = document.querySelector("input"); |
michael@0 | 42 | var container = document.querySelector("#container"); |
michael@0 | 43 | |
michael@0 | 44 | function prepare(check) |
michael@0 | 45 | { |
michael@0 | 46 | container.scrollTop = 0; |
michael@0 | 47 | container.scrollLeft = 0; |
michael@0 | 48 | input.scrollTop = 0; |
michael@0 | 49 | input.scrollLeft = 0; |
michael@0 | 50 | container.style.display='none'; |
michael@0 | 51 | container.getBoundingClientRect(); |
michael@0 | 52 | container.style.display=''; |
michael@0 | 53 | container.getBoundingClientRect(); |
michael@0 | 54 | scrollHandler = function(event) { |
michael@0 | 55 | window.removeEventListener("scroll", arguments.callee, true); |
michael@0 | 56 | event.stopPropagation(); |
michael@0 | 57 | check(event) |
michael@0 | 58 | setTimeout(nextTest,0); |
michael@0 | 59 | }; |
michael@0 | 60 | window.addEventListener("scroll", scrollHandler, true); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | var tests = [ |
michael@0 | 64 | { |
michael@0 | 65 | check: function(event) { |
michael@0 | 66 | is(event.target, container, "<input> vertical line scroll targets container"); |
michael@0 | 67 | ok(container.scrollTop > 0, "<input> vertical line scroll container.scrollTop"); |
michael@0 | 68 | is(container.scrollLeft, 0, "<input> vertical line scroll container.scrollLeft"); |
michael@0 | 69 | is(input.scrollTop, 0, "<input> horizontal line scroll input.scrollTop"); |
michael@0 | 70 | is(input.scrollLeft, 0, "<input> horizontal line scroll input.scrollLeft"); |
michael@0 | 71 | }, |
michael@0 | 72 | test: function() { |
michael@0 | 73 | synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_LINE, |
michael@0 | 74 | deltaY: 1.0, lineOrPageDeltaY: 1 }); |
michael@0 | 75 | } |
michael@0 | 76 | }, |
michael@0 | 77 | { |
michael@0 | 78 | check: function(event) { |
michael@0 | 79 | is(event.target, input, "<input> horizontal line scroll targets <input>"); |
michael@0 | 80 | is(input.scrollTop, 0, "<input> horizontal line scroll input.scrollTop"); |
michael@0 | 81 | ok(input.scrollLeft > 0, "<input> horizontal line scroll input.scrollLeft"); |
michael@0 | 82 | is(container.scrollTop, 0, "<input> horizontal line scroll container.scrollTop"); |
michael@0 | 83 | is(container.scrollLeft, 0, "<input> horizontal line scroll container.scrollLeft"); |
michael@0 | 84 | }, |
michael@0 | 85 | test: function() { |
michael@0 | 86 | synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_LINE, |
michael@0 | 87 | deltaX: 1.0, lineOrPageDeltaX: 1 }); |
michael@0 | 88 | } |
michael@0 | 89 | }, |
michael@0 | 90 | { |
michael@0 | 91 | check: function(event) { |
michael@0 | 92 | is(event.target, container, "<input> vertical page scroll targets container"); |
michael@0 | 93 | ok(container.scrollTop > 0, "<input> vertical line scroll container.scrollTop"); |
michael@0 | 94 | is(container.scrollLeft, 0, "<input> vertical line scroll container.scrollLeft"); |
michael@0 | 95 | is(input.scrollTop, 0, "<input> vertical page scroll input.scrollTop"); |
michael@0 | 96 | is(input.scrollLeft, 0, "<input> vertical page scroll input.scrollLeft"); |
michael@0 | 97 | }, |
michael@0 | 98 | test: function() { |
michael@0 | 99 | synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_PAGE, |
michael@0 | 100 | deltaY: 1.0, lineOrPageDeltaY: 1 }); |
michael@0 | 101 | } |
michael@0 | 102 | }, |
michael@0 | 103 | { |
michael@0 | 104 | check: function(event) { |
michael@0 | 105 | is(event.target, input, "<input> horizontal page scroll targets <input>"); |
michael@0 | 106 | is(input.scrollTop, 0, "<input> horizontal page scroll input.scrollTop"); |
michael@0 | 107 | ok(input.scrollLeft > 0, "<input> horizontal page scroll input.scrollLeft"); |
michael@0 | 108 | is(container.scrollTop, 0, "<input> horizontal page scroll container.scrollTop"); |
michael@0 | 109 | is(container.scrollLeft, 0, "<input> horizontal page scroll container.scrollLeft"); |
michael@0 | 110 | }, |
michael@0 | 111 | test: function() { |
michael@0 | 112 | synthesizeWheel(input, 5, 5, { deltaMode: WheelEvent.DOM_DELTA_PAGE, |
michael@0 | 113 | deltaX: 1.0, lineOrPageDeltaX: 1 }); |
michael@0 | 114 | } |
michael@0 | 115 | }, |
michael@0 | 116 | ]; |
michael@0 | 117 | |
michael@0 | 118 | var i = 0; |
michael@0 | 119 | function nextTest() |
michael@0 | 120 | { |
michael@0 | 121 | if (i == tests.length) { |
michael@0 | 122 | SimpleTest.finish(); |
michael@0 | 123 | return; |
michael@0 | 124 | } |
michael@0 | 125 | var test = tests[i]; |
michael@0 | 126 | ++i; |
michael@0 | 127 | prepare(test.check); |
michael@0 | 128 | test.test(); |
michael@0 | 129 | } |
michael@0 | 130 | |
michael@0 | 131 | function runTests() |
michael@0 | 132 | { |
michael@0 | 133 | nextTest(); |
michael@0 | 134 | } |
michael@0 | 135 | |
michael@0 | 136 | </script> |
michael@0 | 137 | </pre> |
michael@0 | 138 | </body> |
michael@0 | 139 | </html> |