mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-22 02:25:05 +00:00
120 lines
2.5 KiB
HTML
120 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test scrolling subframe scrollbars</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
<style>
|
|
p {
|
|
width:200px;
|
|
height:200px;
|
|
border:solid 1px black;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<p id="subframe">
|
|
1 <br>
|
|
2 <br>
|
|
3 <br>
|
|
4 <br>
|
|
5 <br>
|
|
6 <br>
|
|
7 <br>
|
|
8 <br>
|
|
9 <br>
|
|
10 <br>
|
|
11 <br>
|
|
12 <br>
|
|
13 <br>
|
|
14 <br>
|
|
15 <br>
|
|
16 <br>
|
|
17 <br>
|
|
18 <br>
|
|
19 <br>
|
|
20 <br>
|
|
21 <br>
|
|
22 <br>
|
|
23 <br>
|
|
24 <br>
|
|
25 <br>
|
|
26 <br>
|
|
27 <br>
|
|
28 <br>
|
|
29 <br>
|
|
30 <br>
|
|
31 <br>
|
|
32 <br>
|
|
33 <br>
|
|
34 <br>
|
|
35 <br>
|
|
36 <br>
|
|
37 <br>
|
|
38 <br>
|
|
39 <br>
|
|
40 <br>
|
|
</p>
|
|
<script clss="testbody" type="text/javascript;version=1.7">
|
|
|
|
var DefaultEvent = {
|
|
deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
deltaX: 0, deltaY: 1,
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
|
};
|
|
|
|
var ScrollbarWidth = 0;
|
|
|
|
function test() {
|
|
var subframe = document.getElementById('subframe');
|
|
var oldClientWidth = subframe.clientWidth;
|
|
|
|
subframe.style.overflow = 'auto';
|
|
subframe.getBoundingClientRect();
|
|
|
|
waitForAllPaintsFlushed(function () {
|
|
ScrollbarWidth = oldClientWidth - subframe.clientWidth;
|
|
if (!ScrollbarWidth) {
|
|
// Probably we have overlay scrollbars - abort the test.
|
|
ok(true, "overlay scrollbars - skipping test");
|
|
SimpleTest.finish();
|
|
return;
|
|
}
|
|
|
|
ok(subframe.scrollHeight > subframe.clientHeight, "subframe should have scrollable content");
|
|
testScrolling(subframe);
|
|
});
|
|
}
|
|
|
|
function testScrolling(subframe) {
|
|
// Send a wheel event roughly to where we think the trackbar is. We pick a
|
|
// point at the bottom, in the middle of the trackbar, where the slider is
|
|
// unlikely to be (since it starts at the top).
|
|
var posX = subframe.clientWidth + (ScrollbarWidth / 2);
|
|
var posY = subframe.clientHeight - 20;
|
|
|
|
var oldScrollTop = subframe.scrollTop;
|
|
|
|
sendWheelAndPaint(subframe, posX, posY, DefaultEvent, function () {
|
|
ok(subframe.scrollTop > oldScrollTop, "subframe should have scrolled");
|
|
SimpleTest.finish();
|
|
});
|
|
}
|
|
|
|
window.onload = function() {
|
|
SpecialPowers.pushPrefEnv({
|
|
'set': [['general.smoothScroll', false],
|
|
['mousewheel.transaction.timeout', 0],
|
|
['mousewheel.transaction.ignoremovedelay', 0]]
|
|
}, function () {
|
|
SimpleTest.waitForFocus(test);
|
|
});
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
</script>
|
|
</body>
|
|
</html>
|