2011-02-04 11:00:06 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=607464
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 607464</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=607464">Mozilla Bug 607464</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript;version=1.7">
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for Bug 607464:
|
|
|
|
* Pixel scrolling shouldn't scroll smoothly, even if general.smoothScroll is on.
|
|
|
|
**/
|
|
|
|
|
|
|
|
function scrollDown15PxWithPixelScrolling(scrollbox) {
|
|
|
|
var win = scrollbox.ownerDocument.defaultView;
|
|
|
|
let event = {
|
2012-08-12 05:42:36 +04:00
|
|
|
deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaY: 3.0,
|
|
|
|
lineOrPageDeltaY: 1
|
2011-02-04 11:00:06 +03:00
|
|
|
};
|
2012-08-12 05:42:36 +04:00
|
|
|
// A pixel scroll with lineOrPageDeltaY.
|
|
|
|
synthesizeWheel(scrollbox, 10, 10, event, win);
|
|
|
|
// then 4 pixel scrolls without lineOrPageDeltaY.
|
|
|
|
event.lineOrPageDeltaY = 0;
|
|
|
|
for (let i = 0; i < 4; ++i) {
|
|
|
|
synthesizeWheel(scrollbox, 10, 10, event, win);
|
2011-02-04 11:00:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Note: the line scroll shouldn't have any effect because it has
|
|
|
|
// hasPixels = true set on it. We send it to emulate normal
|
|
|
|
// behavior.
|
|
|
|
}
|
|
|
|
|
|
|
|
function runTest() {
|
|
|
|
var win = open('data:text/html,<!DOCTYPE html>\n' +
|
|
|
|
'<div id="scrollbox" style="height: 100px; overflow: auto;">' +
|
|
|
|
' <div style="height: 1000px;"></div>' +
|
|
|
|
'</div>', '_blank', 'width=300,height=300');
|
|
|
|
SimpleTest.waitForFocus(function () {
|
|
|
|
var scrollbox = win.document.getElementById("scrollbox");
|
|
|
|
let scrollTopBefore = scrollbox.scrollTop;
|
|
|
|
|
|
|
|
scrollDown15PxWithPixelScrolling(scrollbox);
|
|
|
|
|
2012-05-24 14:39:11 +04:00
|
|
|
// wait for the next refresh driver run
|
|
|
|
window.mozRequestAnimationFrame(function() {
|
|
|
|
// actually, wait for the next one before checking results, since
|
|
|
|
// scrolling might not be flushed until after this code has run
|
|
|
|
window.mozRequestAnimationFrame(function() {
|
|
|
|
is(scrollbox.scrollTop, scrollTopBefore + 15,
|
|
|
|
"Pixel scrolling should have finished after one refresh driver iteration. " +
|
|
|
|
"We shouldn't be scrolling smoothly, even though the pref is set.");
|
|
|
|
win.close();
|
|
|
|
clearPrefs();
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
});
|
2011-02-04 11:00:06 +03:00
|
|
|
}, win);
|
|
|
|
}
|
|
|
|
|
|
|
|
function initPrefs()
|
|
|
|
{
|
|
|
|
// Disables the app level scroll acceleration
|
2013-04-15 21:50:45 +04:00
|
|
|
SpecialPowers.setIntPref("mousewheel.acceleration.start", -1);
|
|
|
|
SpecialPowers.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
|
2011-02-04 11:00:06 +03:00
|
|
|
|
|
|
|
// Enables smooth scrolling
|
2013-04-15 21:50:45 +04:00
|
|
|
SpecialPowers.setBoolPref("general.smoothScroll", true);
|
2011-02-04 11:00:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function clearPrefs()
|
|
|
|
{
|
2013-04-15 21:50:45 +04:00
|
|
|
SpecialPowers.clearUserPref("mousewheel.acceleration.start");
|
|
|
|
SpecialPowers.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
|
|
|
|
SpecialPowers.clearUserPref("general.smoothScroll");
|
2011-02-04 11:00:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
window.onload = function () {
|
|
|
|
initPrefs();
|
|
|
|
SimpleTest.executeSoon(runTest);
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|