2012-08-12 05:42:36 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for default action of WheelEvent</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
2015-04-13 07:51:43 +03:00
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
|
2012-08-12 05:42:36 +04:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="scrollable" style="overflow: auto; width: 200px; height: 200px;">
|
|
|
|
<div id="clipper" style="margin: 0; padding: 0; overflow: hidden; width: 3000px; height: 3000px;">
|
|
|
|
<div id="scrolled" style="width: 5000px; height: 5000px;">
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-09-04 12:39:28 +04:00
|
|
|
<div id="spacerForBody"></div>
|
2012-08-12 05:42:36 +04:00
|
|
|
<div id="content" style="display: none">
|
2016-02-29 16:42:56 +03:00
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
2017-09-16 00:43:56 +03:00
|
|
|
// Until the first non-blank paint, the parent will set the opacity of our
|
|
|
|
// browser to 0 using the 'blank' attribute.
|
|
|
|
// Until the blank attribute is removed, we can't send scroll events.
|
|
|
|
SimpleTest.waitForFocus(function() {
|
2017-09-22 01:50:54 +03:00
|
|
|
let chromeScript = SpecialPowers.loadChromeScript(_ => {
|
2017-09-16 00:43:56 +03:00
|
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
2017-09-22 01:50:54 +03:00
|
|
|
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
|
|
|
win.requestAnimationFrame(() => {
|
|
|
|
win.gBrowser.selectedBrowser.removeAttribute("blank");
|
|
|
|
win.requestAnimationFrame(() => {
|
|
|
|
sendAsyncMessage("blank-attribute-removed");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
chromeScript.promiseOneMessage("blank-attribute-removed").then(() => {
|
|
|
|
chromeScript.destroy();
|
|
|
|
runTests();
|
2017-09-16 00:43:56 +03:00
|
|
|
});
|
|
|
|
}, window);
|
|
|
|
|
2014-12-11 21:34:40 +03:00
|
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
2012-08-12 05:42:36 +04:00
|
|
|
|
2012-10-02 20:35:49 +04:00
|
|
|
var winUtils = SpecialPowers.getDOMWindowUtils(window);
|
|
|
|
// grab refresh driver
|
|
|
|
winUtils.advanceTimeAndRefresh(100);
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
var gScrollableElement = document.getElementById("scrollable");
|
|
|
|
var gScrolledElement = document.getElementById("scrolled");
|
2012-09-04 12:39:28 +04:00
|
|
|
var gSpacerForBodyElement = document.getElementById("spacerForBody");
|
2012-08-12 05:42:36 +04:00
|
|
|
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
const kDefaultActionNone = 0;
|
|
|
|
const kDefaultActionScroll = 1;
|
|
|
|
const kDefaultActionHistory = 2;
|
|
|
|
const kDefaultActionZoom = 3;
|
|
|
|
const kDefaultActionHorizontalScroll = 4;
|
|
|
|
|
|
|
|
const kDefaultActionOverrideXNoOverride = -1;
|
|
|
|
const kDefaultActionOverrideXNone = kDefaultActionNone;
|
|
|
|
const kDefaultActionOverrideXScroll = kDefaultActionScroll;
|
|
|
|
const kDefaultActionOverrideXHistory = kDefaultActionHistory;
|
|
|
|
const kDefaultActionOverrideXZoom = kDefaultActionZoom;
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
function is()
|
|
|
|
{
|
|
|
|
window.opener.is.apply(window.opener, arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
function ok()
|
|
|
|
{
|
|
|
|
window.opener.ok.apply(window.opener, arguments);
|
|
|
|
}
|
|
|
|
|
2015-04-13 07:51:43 +03:00
|
|
|
function sendWheelAndWait(aX, aY, aEvent, aCallback)
|
|
|
|
{
|
|
|
|
sendWheelAndPaint(gScrollableElement, aX, aY, aEvent, aCallback);
|
|
|
|
}
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
function hitEventLoop(aFunc, aTimes)
|
|
|
|
{
|
2012-10-02 20:35:49 +04:00
|
|
|
winUtils.advanceTimeAndRefresh(100);
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
if (--aTimes) {
|
|
|
|
setTimeout(hitEventLoop, 0, aFunc, aTimes);
|
|
|
|
} else {
|
|
|
|
setTimeout(aFunc, 20);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-30 21:20:37 +04:00
|
|
|
function onZoomReset(aCallback) {
|
2017-03-15 18:26:57 +03:00
|
|
|
var fullZoom = SpecialPowers.getFullZoom(window);
|
|
|
|
if (fullZoom == 1) {
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SpecialPowers.addChromeEventListener("FullZoomChange", function onFullZoomChange(event) {
|
|
|
|
is(SpecialPowers.getFullZoom(window), 1, "Zoom should be reset to 1");
|
|
|
|
SpecialPowers.removeChromeEventListener("FullZoomChange", onFullZoomChange);
|
2014-01-30 21:20:37 +04:00
|
|
|
SimpleTest.executeSoon(aCallback);
|
2017-03-15 18:26:57 +03:00
|
|
|
});
|
2014-01-30 21:20:37 +04:00
|
|
|
}
|
|
|
|
|
2016-02-29 16:42:56 +03:00
|
|
|
function setDeltaMultiplierSettings(aSettings, aCallback)
|
2012-08-12 05:42:36 +04:00
|
|
|
{
|
2016-02-29 16:42:56 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [
|
|
|
|
["mousewheel.default.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
|
|
|
|
["mousewheel.default.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
|
|
|
|
["mousewheel.default.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
|
|
|
|
["mousewheel.with_alt.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
|
|
|
|
["mousewheel.with_alt.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
|
|
|
|
["mousewheel.with_alt.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
|
|
|
|
["mousewheel.with_control.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
|
|
|
|
["mousewheel.with_control.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
|
|
|
|
["mousewheel.with_control.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
|
|
|
|
["mousewheel.with_meta.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
|
|
|
|
["mousewheel.with_meta.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
|
|
|
|
["mousewheel.with_meta.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
|
|
|
|
["mousewheel.with_shift.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
|
|
|
|
["mousewheel.with_shift.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
|
|
|
|
["mousewheel.with_shift.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
|
|
|
|
["mousewheel.with_win.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
|
|
|
|
["mousewheel.with_win.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
|
|
|
|
["mousewheel.with_win.delta_multiplier_z", aSettings.deltaMultiplierZ * 100]
|
|
|
|
]}, aCallback);
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function doTestScroll(aSettings, aCallback)
|
|
|
|
{
|
|
|
|
const kNoScroll = 0x00;
|
|
|
|
const kScrollUp = 0x01;
|
|
|
|
const kScrollDown = 0x02;
|
|
|
|
const kScrollLeft = 0x04;
|
|
|
|
const kScrollRight = 0x08;
|
|
|
|
|
|
|
|
const kTests = [
|
|
|
|
{ description: "Scroll to bottom by pixel scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to bottom by pixel scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to top by pixel scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to top by pixel scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to right by pixel scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by pixel scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by pixel scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by pixel scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to bottom-right by pixel scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollRight },
|
|
|
|
{ description: "Scroll to bottom-left by pixel scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-left by pixel scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-right by pixel scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollRight },
|
|
|
|
{ description: "Not Scroll by pixel scroll for z",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
|
|
|
|
{ description: "Scroll to bottom by line scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to bottom by line scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to top by line scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to top by line scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to right by line scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by line scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by line scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by line scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to bottom-right by line scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollRight },
|
|
|
|
{ description: "Scroll to bottom-left by line scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-left by line scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-right by line scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollRight },
|
|
|
|
{ description: "Not Scroll by line scroll for z",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
|
|
|
|
{ description: "Scroll to bottom by page scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to bottom by page scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to top by page scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to top by page scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to right by page scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by page scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by page scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by page scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to bottom-right by page scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollRight },
|
|
|
|
{ description: "Scroll to bottom-left by page scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-left by page scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-right by page scroll",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollRight },
|
|
|
|
{ description: "Not Scroll by page scroll for z",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
|
|
|
|
// special cases.
|
|
|
|
|
|
|
|
// momentum scroll should cause scroll even if the action is zoom, but if the default action is none,
|
|
|
|
// shouldn't do it.
|
|
|
|
{ description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 1, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is -1, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 1, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is -1, even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to bottom-right by momentum pixel scroll even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollRight },
|
|
|
|
{ description: "Scroll to bottom-left by momentum pixel scroll even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-left by momentum pixel scroll even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-right by momentum pixel scroll even if the action is zoom",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp | kScrollRight },
|
|
|
|
{ description: "Not Scroll by momentum pixel scroll for z (action is zoom)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Not Scroll by momentum pixel scroll if default action is none (action is zoom)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
2012-08-12 05:42:36 +04:00
|
|
|
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
|
2012-08-12 05:42:36 +04:00
|
|
|
|
|
|
|
// momentum scroll should cause scroll even if the action is history, but if the default action is none,
|
|
|
|
// shouldn't do it.
|
|
|
|
{ description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 1, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is -1, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 1, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is -1, even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to bottom-right by momentum pixel scroll even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollDown | kScrollRight },
|
|
|
|
{ description: "Scroll to bottom-left by momentum pixel scroll even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollDown | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-left by momentum pixel scroll even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollUp | kScrollLeft },
|
|
|
|
{ description: "Scroll to top-right by momentum pixel scroll even if the action is history",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kScrollUp | kScrollRight },
|
|
|
|
{ description: "Not Scroll by momentum pixel scroll for z (action is history)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Not Scroll by momentum pixel scroll if default action is none (action is history)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNoScroll,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
|
2012-08-30 05:05:16 +04:00
|
|
|
|
2012-09-04 12:39:28 +04:00
|
|
|
// Don't scroll along axis whose overflow style is hidden.
|
2012-08-30 05:05:16 +04:00
|
|
|
{ description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function(cb) { gScrollableElement.style.overflowX = "hidden"; cb(); } },
|
2012-08-30 05:05:16 +04:00
|
|
|
{ description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to only bottom by oblique page wheel event with overflow-x: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to only top by oblique pixel wheel event with overflow-x: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to only top by oblique line wheel event with overflow-x: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to only top by oblique page wheel event with overflow-x: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp,
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
|
2012-08-30 05:05:16 +04:00
|
|
|
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
|
2012-08-30 05:05:16 +04:00
|
|
|
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to only right by oblique page wheel event with overflow-y: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to only left by oblique pixel wheel event with overflow-y: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to only top by oblique line wheel event with overflow-y: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to only top by oblique page wheel event with overflow-y: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft,
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) { gScrollableElement.style.overflowY = "auto"; cb(); } },
|
2012-08-30 05:05:16 +04:00
|
|
|
{ description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function(cb) { gScrollableElement.style.overflow = "hidden"; cb(); } },
|
2012-08-30 05:05:16 +04:00
|
|
|
{ description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
2012-09-04 12:39:28 +04:00
|
|
|
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
|
2012-08-30 05:05:16 +04:00
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll,
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) { gScrollableElement.style.overflow = "auto"; cb(); } },
|
2012-09-04 12:39:28 +04:00
|
|
|
|
|
|
|
// Don't scroll along axis whose overflow style is hidden and overflow delta values should
|
|
|
|
// be zero if there is ancestor scrollable element.
|
|
|
|
{ description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function(cb) {
|
2012-09-04 12:39:28 +04:00
|
|
|
gScrollableElement.style.overflowX = "hidden";
|
|
|
|
gScrollableElement.style.position = "fixed";
|
|
|
|
gScrollableElement.style.top = "30px";
|
|
|
|
gScrollableElement.style.left = "30px";
|
|
|
|
// Make body element scrollable.
|
|
|
|
gSpacerForBodyElement.style.width = "5000px";
|
|
|
|
gSpacerForBodyElement.style.height = "5000px";
|
|
|
|
document.documentElement.scrollTop = 500;
|
|
|
|
document.documentElement.scrollLeft = 500;
|
2016-02-29 16:42:56 +03:00
|
|
|
cb();
|
2012-09-04 12:39:28 +04:00
|
|
|
} },
|
|
|
|
{ description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to only bottom by oblique page wheel event with overflow-x: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollDown },
|
|
|
|
{ description: "Scroll to only top by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to only top by oblique line wheel event with overflow-x: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp },
|
|
|
|
{ description: "Scroll to only top by oblique page wheel event with overflow-x: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollUp,
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
|
2012-09-04 12:39:28 +04:00
|
|
|
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight,
|
2016-02-29 16:42:56 +03:00
|
|
|
prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
|
2012-09-04 12:39:28 +04:00
|
|
|
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to only right by oblique page wheel event with overflow-y: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to only left by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to only top by oblique line wheel event with overflow-y: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to only top by oblique page wheel event with overflow-y: hidden (body is scrollable)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft,
|
2016-02-29 16:42:56 +03:00
|
|
|
cleanup: function (cb) {
|
2012-09-04 12:39:28 +04:00
|
|
|
gScrollableElement.style.overflowY = "auto";
|
|
|
|
gScrollableElement.style.position = "static";
|
|
|
|
gSpacerForBodyElement.style.width = "";
|
|
|
|
gSpacerForBodyElement.style.height = "";
|
2016-02-29 16:42:56 +03:00
|
|
|
cb();
|
2012-09-04 12:39:28 +04:00
|
|
|
} },
|
2012-08-12 05:42:36 +04:00
|
|
|
];
|
|
|
|
|
|
|
|
var description;
|
|
|
|
|
|
|
|
var currentTestIndex = -1;
|
|
|
|
var isXReverted = (aSettings.deltaMultiplierX < 0);
|
|
|
|
var isYReverted = (aSettings.deltaMultiplierY < 0);
|
|
|
|
|
|
|
|
function doNextTest()
|
|
|
|
{
|
|
|
|
if (++currentTestIndex >= kTests.length) {
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
|
|
|
|
var currentTest = kTests[currentTestIndex];
|
|
|
|
description = "doTestScroll(aSettings=" + aSettings.description + "), " + currentTest.description + ": ";
|
|
|
|
if (currentTest.prepare) {
|
2016-02-29 16:42:56 +03:00
|
|
|
currentTest.prepare(doTestCurrentScroll);
|
|
|
|
} else {
|
|
|
|
doTestCurrentScroll();
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
2016-02-29 16:42:56 +03:00
|
|
|
}
|
2012-08-12 05:42:36 +04:00
|
|
|
|
2016-02-29 16:42:56 +03:00
|
|
|
function doTestCurrentScroll() {
|
|
|
|
var currentTest = kTests[currentTestIndex];
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, currentTest.event, function () {
|
2012-08-12 05:42:36 +04:00
|
|
|
if (currentTest.expected == kNoScroll) {
|
|
|
|
is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
|
|
|
|
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
|
|
|
|
} else {
|
|
|
|
var scrollUp = !isYReverted ? (currentTest.expected & kScrollUp) :
|
|
|
|
(currentTest.expected & kScrollDown);
|
|
|
|
var scrollDown = !isYReverted ? (currentTest.expected & kScrollDown) :
|
|
|
|
(currentTest.expected & kScrollUp);
|
|
|
|
if (scrollUp) {
|
|
|
|
ok(gScrollableElement.scrollTop < 1000, description + "not scrolled up, got " + gScrollableElement.scrollTop);
|
|
|
|
} else if (scrollDown) {
|
|
|
|
ok(gScrollableElement.scrollTop > 1000, description + "not scrolled down, got " + gScrollableElement.scrollTop);
|
2012-08-30 05:05:16 +04:00
|
|
|
} else {
|
|
|
|
is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
var scrollLeft = !isXReverted ? (currentTest.expected & kScrollLeft) :
|
|
|
|
(currentTest.expected & kScrollRight);
|
|
|
|
var scrollRight = !isXReverted ? (currentTest.expected & kScrollRight) :
|
|
|
|
(currentTest.expected & kScrollLeft);
|
|
|
|
if (scrollLeft) {
|
|
|
|
ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
|
|
|
|
} else if (scrollRight) {
|
|
|
|
ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
|
2012-08-30 05:05:16 +04:00
|
|
|
} else {
|
|
|
|
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentTest.cleanup) {
|
2016-02-29 16:42:56 +03:00
|
|
|
currentTest.cleanup(nextStep);
|
|
|
|
} else {
|
|
|
|
nextStep();
|
|
|
|
}
|
|
|
|
|
|
|
|
function nextStep() {
|
|
|
|
winUtils.advanceTimeAndRefresh(100);
|
|
|
|
doNextTest();
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
doNextTest();
|
|
|
|
}
|
|
|
|
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
function doTestHorizontalScroll(aSettings, aCallback)
|
|
|
|
{
|
|
|
|
const kNoScroll = 0x00;
|
|
|
|
const kScrollLeft = 0x01;
|
|
|
|
const kScrollRight = 0x02;
|
|
|
|
|
|
|
|
const kTests = [
|
|
|
|
{ description: "Scroll to right by pixel scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by pixel scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by pixel scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by pixel scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Don't scroll by deltaX (pixel scroll, lineOrPageDelta is 0)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by deltaX (pixel scroll, lineOrPageDelta is 1)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by negative deltaX (pixel scroll, lineOrPageDelta is 0)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by negative deltaX (pixel scroll, lineOrPageDelta is -1)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Scroll only to right by diagonal pixel scroll (to bottom-right)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll only to right by diagonal pixel scroll (to bottom-left)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll only to left by diagonal pixel scroll (to top-left)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll only to left by pixel scroll (to bottom-right)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Don't scroll by pixel scroll for z-axis",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
|
|
|
|
{ description: "Scroll to right by line scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by line scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by line scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by line scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Don't scroll by deltaX (line scroll, lineOrPageDelta is 0)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by deltaX (line scroll, lineOrPageDelta is 1)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by negative deltaX (line scroll, lineOrPageDelta is 0)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by negative deltaY (line scroll, lineOrPageDelta is -1)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Scroll only to right by diagonal line scroll (to bottom-right)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll only to right by diagonal line scroll (to bottom-left)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll only to left by diagonal line scroll (to top-left)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll only to left by line scroll (to top-right)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Don't scroll by line scroll for z-axis",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
|
|
|
|
{ description: "Scroll to right by page scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to right by page scroll when lineOrPageDelta is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll to left by page scroll even if lineOrPageDelta is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll to left by page scroll when lineOrPageDelta is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Don't scroll by deltaX (page scroll, lineOrPageDelta is 0)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by deltaX (page scroll, lineOrPageDelta is 1)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by deltaX (page scroll, lineOrPageDelta is 0)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Don't scroll by deltaX (page scroll, lineOrPageDelta is -1)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
{ description: "Scroll only to right by diagonal page scroll (to bottom-right)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll only to right by diagonal page scroll (to bottom-left)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollRight },
|
|
|
|
{ description: "Scroll only to left by diagonal page scroll (to top-left)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Scroll only to left by diagonal page scroll (to top-right)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kScrollLeft },
|
|
|
|
{ description: "Don't scroll by page scroll for z-axis",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
|
|
|
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
|
|
|
expected: kNoScroll },
|
|
|
|
];
|
|
|
|
|
|
|
|
var description;
|
|
|
|
|
|
|
|
var currentTestIndex = -1;
|
|
|
|
// deltaY should cause horizontal scroll and affected by deltaMultiplierY.
|
|
|
|
// So, horizontal scroll amount and direction is affected by deltaMultiplierY.
|
|
|
|
var isXReverted = (aSettings.deltaMultiplierY < 0);
|
|
|
|
|
|
|
|
function doNextTest()
|
|
|
|
{
|
|
|
|
if (++currentTestIndex >= kTests.length) {
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
|
|
|
|
var currentTest = kTests[currentTestIndex];
|
|
|
|
description = "doTestHorizontalScroll(aSettings=" + aSettings.description + "), " + currentTest.description + ": ";
|
|
|
|
if (currentTest.prepare) {
|
|
|
|
currentTest.prepare(doTestCurrentScroll);
|
|
|
|
} else {
|
|
|
|
doTestCurrentScroll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function doTestCurrentScroll() {
|
|
|
|
var currentTest = kTests[currentTestIndex];
|
|
|
|
sendWheelAndWait(10, 10, currentTest.event, function () {
|
|
|
|
is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
|
|
|
|
if (currentTest.expected == kNoScroll) {
|
|
|
|
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
|
|
|
|
} else {
|
|
|
|
var scrollLeft = !isXReverted ? (currentTest.expected & kScrollLeft) :
|
|
|
|
(currentTest.expected & kScrollRight);
|
|
|
|
var scrollRight = !isXReverted ? (currentTest.expected & kScrollRight) :
|
|
|
|
(currentTest.expected & kScrollLeft);
|
|
|
|
if (scrollLeft) {
|
|
|
|
ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
|
|
|
|
} else if (scrollRight) {
|
|
|
|
ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
|
|
|
|
} else {
|
|
|
|
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentTest.cleanup) {
|
|
|
|
currentTest.cleanup(nextStep);
|
|
|
|
} else {
|
|
|
|
nextStep();
|
|
|
|
}
|
|
|
|
|
|
|
|
function nextStep() {
|
|
|
|
winUtils.advanceTimeAndRefresh(100);
|
|
|
|
doNextTest();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
doNextTest();
|
|
|
|
}
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
function doTestZoom(aSettings, aCallback)
|
|
|
|
{
|
|
|
|
if ((aSettings.deltaMultiplierX != 1.0 && aSettings.deltaMultiplierX != -1.0) ||
|
|
|
|
(aSettings.deltaMultiplierY != 1.0 && aSettings.deltaMultiplierY != -1.0)) {
|
|
|
|
todo(false, "doTestZoom doesn't support to test with aSettings=" + aSettings.description);
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const kNone = 0x00;
|
|
|
|
const kPositive = 0x01;
|
|
|
|
const kNegative = 0x02;
|
|
|
|
const kUseX = 0x10;
|
|
|
|
const kUseY = 0x20;
|
|
|
|
const kTests = [
|
|
|
|
{ description: "by vertical/positive pixel event when its lineOrPageDeltaY is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by vertical/positive pixel event when its lineOrPageDeltaY is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kPositive | kUseY },
|
|
|
|
{ description: "by vertical/negative pixel event when its lineOrPageDeltaY is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by vertical/negative pixel event when its lineOrPageDeltaY is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNegative | kUseY },
|
|
|
|
{ description: "by horizotal/positive pixel event when its lineOrPageDeltaX is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by horizotal/positive pixel event when its lineOrPageDeltaX is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kPositive | kUseX },
|
|
|
|
{ description: "by horizotal/negative pixel event when its lineOrPageDeltaX is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by horizotal/negative pixel event when its lineOrPageDeltaX is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNegative | kUseX },
|
|
|
|
{ description: "by z pixel event",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 16.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
|
|
|
|
{ description: "by vertical/positive line event when its lineOrPageDeltaY is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by vertical/positive line event when its lineOrPageDeltaY is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kPositive | kUseY },
|
|
|
|
{ description: "by vertical/negative line event when its lineOrPageDeltaY is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by vertical/negative line event when its lineOrPageDeltaY is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNegative | kUseY },
|
|
|
|
{ description: "by horizotal/positive line event when its lineOrPageDeltaX is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by horizotal/positive line event when its lineOrPageDeltaX is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kPositive | kUseX },
|
|
|
|
{ description: "by horizotal/negative line event when its lineOrPageDeltaX is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by horizotal/negative line event when its lineOrPageDeltaX is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNegative | kUseX },
|
|
|
|
{ description: "by z line event",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
|
|
|
|
{ description: "by vertical/positive page event when its lineOrPageDeltaY is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by vertical/positive page event when its lineOrPageDeltaY is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kPositive | kUseY },
|
|
|
|
{ description: "by vertical/negative page event when its lineOrPageDeltaY is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by vertical/negative page event when its lineOrPageDeltaY is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNegative | kUseY },
|
|
|
|
{ description: "by horizotal/positive page event when its lineOrPageDeltaX is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by horizotal/positive page event when its lineOrPageDeltaX is 1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kPositive | kUseX },
|
|
|
|
{ description: "by horizotal/negative page event when its lineOrPageDeltaX is 0",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
{ description: "by horizotal/negative page event when its lineOrPageDeltaX is -1",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNegative | kUseX },
|
|
|
|
{ description: "by z page event",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
2012-09-04 12:39:28 +04:00
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
|
|
|
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
2012-08-12 05:42:36 +04:00
|
|
|
expected: kNone },
|
|
|
|
];
|
|
|
|
|
|
|
|
var description, currentTest;
|
|
|
|
var currentTestIndex = -1;
|
|
|
|
var isXReverted = (aSettings.deltaMultiplierX < 0);
|
|
|
|
var isYReverted = (aSettings.deltaMultiplierY < 0);
|
|
|
|
|
|
|
|
function doNextTest()
|
|
|
|
{
|
|
|
|
if (++currentTestIndex >= kTests.length) {
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
|
|
|
|
currentTest = kTests[currentTestIndex];
|
|
|
|
description = "doTestZoom(aSettings=" + aSettings.description + "), ";
|
|
|
|
if (currentTest.expected == kNone) {
|
|
|
|
description += "Shouldn't ";
|
|
|
|
} else {
|
|
|
|
description += "Should ";
|
|
|
|
}
|
|
|
|
description += "zoom " + currentTest.description + ": ";
|
|
|
|
|
|
|
|
var event = currentTest.event;
|
|
|
|
event.ctrlKey = true;
|
|
|
|
|
|
|
|
// NOTE: Zooming might change scrollTop and scrollLeft by rounding fraction.
|
|
|
|
// This test assume that zoom happens synchronously and scrolling
|
|
|
|
// happens asynchronously.
|
|
|
|
var scrollTop = gScrollableElement.scrollTop;
|
|
|
|
var scrollLeft = gScrollableElement.scrollLeft;
|
|
|
|
|
2017-07-07 06:48:42 +03:00
|
|
|
fullZoomChangePromise = new Promise(resolve => {
|
|
|
|
if (currentTest.expected & (kNegative | kPositive)) {
|
|
|
|
SpecialPowers.addChromeEventListener("FullZoomChange", function onFullZoomChange() {
|
|
|
|
if (SpecialPowers.getFullZoom(window) != 1) {
|
|
|
|
SpecialPowers.removeChromeEventListener("FullZoomChange", onFullZoomChange)
|
|
|
|
setTimeout(() => resolve(), 0);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
resolve();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, event, function () {
|
2012-08-12 05:42:36 +04:00
|
|
|
is(gScrollableElement.scrollTop, scrollTop, description + "scrolled vertical");
|
|
|
|
is(gScrollableElement.scrollLeft, scrollLeft, description + "scrolled horizontal");
|
2017-07-07 06:48:42 +03:00
|
|
|
|
|
|
|
fullZoomChangePromise.then(() => {
|
|
|
|
// When input event prioritization is enabled, the wheel event may be
|
|
|
|
// dispatched to the content process before the message 'FullZoom' to
|
|
|
|
// zoom in/out. Waiting for the event 'FullZoomChange' and then check
|
|
|
|
// the result.
|
|
|
|
if (!(currentTest.expected & (kNegative | kPositive))) {
|
|
|
|
is(SpecialPowers.getFullZoom(window), 1.0, description + "zoomed");
|
2012-08-12 05:42:36 +04:00
|
|
|
} else {
|
2017-07-07 06:48:42 +03:00
|
|
|
var isReverted = (currentTest.expected & kUseX) ? isXReverted :
|
|
|
|
(currentTest.expected & kUseY) ? isYReverted : false;
|
|
|
|
if ((!isReverted && (currentTest.expected & kNegative)) ||
|
|
|
|
(isReverted && (currentTest.expected & kPositive))) {
|
|
|
|
ok(SpecialPowers.getFullZoom(window) > 1.0,
|
|
|
|
description + "not zoomed in, got " + SpecialPowers.getFullZoom(window));
|
|
|
|
} else {
|
|
|
|
ok(SpecialPowers.getFullZoom(window) < 1.0,
|
|
|
|
description + "not zoomed out, got " + SpecialPowers.getFullZoom(window));
|
|
|
|
}
|
2017-07-07 06:48:42 +03:00
|
|
|
}
|
2017-07-07 06:48:42 +03:00
|
|
|
if (SpecialPowers.getFullZoom(window) != 1) {
|
|
|
|
// Only synthesizes key event to reset zoom when necessary to avoid
|
|
|
|
// triggering the next test before the key event is handled. In that
|
|
|
|
// case, the key event may break the next test.
|
|
|
|
synthesizeKey("0", { accelKey: true });
|
|
|
|
}
|
|
|
|
onZoomReset(function () {
|
|
|
|
hitEventLoop(doNextTest, 20);
|
|
|
|
});
|
2014-01-30 21:20:37 +04:00
|
|
|
});
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
doNextTest();
|
|
|
|
}
|
|
|
|
|
2012-10-31 03:22:23 +04:00
|
|
|
function doTestZoomedScroll(aCallback)
|
2012-08-12 05:42:36 +04:00
|
|
|
{
|
2014-03-11 09:14:07 +04:00
|
|
|
var zoom = 1.0;
|
|
|
|
function setFullZoom(aWindow, aZoom)
|
|
|
|
{
|
|
|
|
zoom = aZoom;
|
|
|
|
SpecialPowers.setFullZoom(aWindow, aZoom);
|
|
|
|
}
|
|
|
|
|
2014-01-30 21:20:37 +04:00
|
|
|
function prepareTestZoomedPixelScroll()
|
2012-08-12 05:42:36 +04:00
|
|
|
{
|
|
|
|
// Reset zoom and store the scroll amount into the data.
|
2012-08-15 19:51:13 +04:00
|
|
|
synthesizeKey("0", { accelKey: true });
|
2014-03-11 09:14:07 +04:00
|
|
|
zoom = 1.0;
|
2014-01-30 21:20:37 +04:00
|
|
|
onZoomReset(testZoomedPixelScroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testZoomedPixelScroll()
|
|
|
|
{
|
2012-08-12 05:42:36 +04:00
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
// Ensure not to be in reflow.
|
|
|
|
hitEventLoop(function () {
|
2014-03-11 09:14:07 +04:00
|
|
|
function mousePixelScrollHandler(aEvent)
|
2012-08-12 05:42:36 +04:00
|
|
|
{
|
|
|
|
if (aEvent.axis == MouseScrollEvent.HORIZONTAL_AXIS) {
|
|
|
|
is(aEvent.detail, 16,
|
|
|
|
"doTestZoomedScroll: The detail of horizontal MozMousePixelScroll for pixel wheel event is wrong");
|
|
|
|
} else if (aEvent.axis == MouseScrollEvent.VERTICAL_AXIS) {
|
|
|
|
is(aEvent.detail, 16,
|
|
|
|
"doTestZoomedScroll: The detail of vertical MozMousePixelScroll for pixel wheel event is wrong");
|
|
|
|
} else {
|
|
|
|
ok(false, "doTestZoomedScroll: The axis of MozMousePixelScroll for pixel wheel event is invalid, got " + aEvent.axis);
|
|
|
|
}
|
|
|
|
}
|
2014-03-11 09:14:07 +04:00
|
|
|
function wheelHandler(aEvent)
|
|
|
|
{
|
|
|
|
is(aEvent.deltaX, 16.0 / zoom,
|
|
|
|
"doTestZoomedScroll: The deltaX of wheel for pixel is wrong");
|
|
|
|
is(aEvent.deltaY, 16.0 / zoom,
|
|
|
|
"doTestZoomedScroll: The deltaY of wheel for pixel is wrong");
|
|
|
|
}
|
|
|
|
window.addEventListener("MozMousePixelScroll", mousePixelScrollHandler, true);
|
|
|
|
window.addEventListener("wheel", wheelHandler, true);
|
2015-04-13 07:51:43 +03:00
|
|
|
var event = {
|
|
|
|
deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0,
|
|
|
|
deltaY: 16.0,
|
|
|
|
lineOrPageDeltaX: 0,
|
|
|
|
lineOrPageDeltaY: 0
|
|
|
|
};
|
2012-08-12 05:42:36 +04:00
|
|
|
// wait scrolled actually.
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, event, function () {
|
2012-08-12 05:42:36 +04:00
|
|
|
var scrolledX = gScrollableElement.scrollLeft;
|
|
|
|
var scrolledY = gScrollableElement.scrollTop;
|
|
|
|
ok(scrolledX > 1000,
|
|
|
|
"doTestZoomedScroll: scrolledX must be larger than 1000 for pixel wheel event, got " + scrolledX);
|
|
|
|
ok(scrolledY > 1000,
|
|
|
|
"doTestZoomedScroll: scrolledY must be larger than 1000 for pixel wheel event, got " + scrolledY);
|
|
|
|
|
|
|
|
// Zoom
|
2014-03-11 09:14:07 +04:00
|
|
|
setFullZoom(window, 2.0);
|
2012-08-12 05:42:36 +04:00
|
|
|
// Ensure not to be in reflow.
|
|
|
|
hitEventLoop(function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
2015-04-13 07:51:43 +03:00
|
|
|
var event = {
|
|
|
|
deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 16.0,
|
|
|
|
deltaY: 16.0,
|
|
|
|
lineOrPageDeltaX: 0,
|
|
|
|
lineOrPageDeltaY: 0
|
|
|
|
};
|
2012-08-12 05:42:36 +04:00
|
|
|
// wait scrolled actually.
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, event, function () {
|
2012-08-12 05:42:36 +04:00
|
|
|
ok(Math.abs(gScrollableElement.scrollLeft - (1000 + (scrolledX - 1000) / 2)) <= 1,
|
|
|
|
"doTestZoomedScroll: zoomed horizontal scroll amount by pixel wheel event is different from normal, scrollLeft=" +
|
|
|
|
gScrollableElement.scrollLeft + ", scrolledX=" + scrolledX);
|
|
|
|
ok(Math.abs(gScrollableElement.scrollTop - (1000 + (scrolledY - 1000) / 2)) <= 1,
|
|
|
|
"doTestZoomedScroll: zoomed vertical scroll amount by pixel wheel event is different from normal, scrollTop=" +
|
|
|
|
gScrollableElement.scrollTop + ", scrolledY=" + scrolledY);
|
2014-03-11 09:14:07 +04:00
|
|
|
window.removeEventListener("MozMousePixelScroll", mousePixelScrollHandler, true);
|
|
|
|
window.removeEventListener("wheel", wheelHandler, true);
|
2012-08-12 05:42:36 +04:00
|
|
|
|
2012-08-15 19:51:13 +04:00
|
|
|
synthesizeKey("0", { accelKey: true });
|
2014-01-30 21:20:37 +04:00
|
|
|
onZoomReset(prepareTestZoomedLineScroll);
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}, 20);
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}, 20);
|
|
|
|
}
|
|
|
|
|
2014-01-30 21:20:37 +04:00
|
|
|
function prepareTestZoomedLineScroll()
|
2012-08-12 05:42:36 +04:00
|
|
|
{
|
|
|
|
// Reset zoom and store the scroll amount into the data.
|
2012-08-15 19:51:13 +04:00
|
|
|
synthesizeKey("0", { accelKey: true });
|
2014-03-11 09:14:07 +04:00
|
|
|
zoom = 1.0;
|
2014-01-30 21:20:37 +04:00
|
|
|
onZoomReset(testZoomedLineScroll);
|
|
|
|
}
|
|
|
|
function testZoomedLineScroll()
|
|
|
|
{
|
2012-08-12 05:42:36 +04:00
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
// Ensure not to be in reflow.
|
|
|
|
hitEventLoop(function () {
|
|
|
|
var lineHeightX, lineHeightY;
|
|
|
|
function handler(aEvent)
|
|
|
|
{
|
|
|
|
if (aEvent.axis == MouseScrollEvent.HORIZONTAL_AXIS) {
|
|
|
|
if (lineHeightX == undefined) {
|
|
|
|
lineHeightX = aEvent.detail;
|
|
|
|
} else {
|
|
|
|
ok(Math.abs(aEvent.detail - lineHeightX) <= 1,
|
|
|
|
"doTestZoomedScroll: The detail of horizontal MozMousePixelScroll for line wheel event is wrong, aEvent.detail=" +
|
|
|
|
aEvent.detail + ", lineHeightX=" + lineHeightX);
|
|
|
|
}
|
|
|
|
} else if (aEvent.axis == MouseScrollEvent.VERTICAL_AXIS) {
|
|
|
|
if (lineHeightY == undefined) {
|
|
|
|
lineHeightY = aEvent.detail;
|
|
|
|
} else {
|
|
|
|
ok(Math.abs(aEvent.detail - lineHeightY) <= 1,
|
|
|
|
"doTestZoomedScroll: The detail of vertical MozMousePixelScroll for line wheel event is wrong, aEvent.detail=" +
|
|
|
|
aEvent.detail + ", lineHeightY=" + lineHeightY);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ok(false, "doTestZoomedScroll: The axis of MozMousePixelScroll for line wheel event is invalid, got " + aEvent.axis);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
window.addEventListener("MozMousePixelScroll", handler, true);
|
2015-04-13 07:51:43 +03:00
|
|
|
var event = {
|
|
|
|
deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0,
|
|
|
|
deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1,
|
|
|
|
lineOrPageDeltaY: 1
|
|
|
|
};
|
2012-08-12 05:42:36 +04:00
|
|
|
// wait scrolled actually.
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, event, function () {
|
2012-08-12 05:42:36 +04:00
|
|
|
var scrolledX = gScrollableElement.scrollLeft;
|
|
|
|
var scrolledY = gScrollableElement.scrollTop;
|
|
|
|
ok(scrolledX > 1000,
|
|
|
|
"doTestZoomedScroll: scrolledX must be larger than 1000 for line wheel event, got " + scrolledX);
|
|
|
|
ok(scrolledY > 1000,
|
|
|
|
"doTestZoomedScroll: scrolledY must be larger than 1000 for line wheel event, got " + scrolledY);
|
|
|
|
|
|
|
|
// Zoom
|
2014-03-11 09:14:07 +04:00
|
|
|
setFullZoom(window, 2.0);
|
2012-08-12 05:42:36 +04:00
|
|
|
// Ensure not to be in reflow.
|
|
|
|
hitEventLoop(function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
2015-04-13 07:51:43 +03:00
|
|
|
var event = {
|
|
|
|
deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0,
|
|
|
|
deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1,
|
|
|
|
lineOrPageDeltaY: 1
|
|
|
|
};
|
2012-08-12 05:42:36 +04:00
|
|
|
// wait scrolled actually.
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, event, function () {
|
2012-08-12 05:42:36 +04:00
|
|
|
ok(Math.abs(gScrollableElement.scrollLeft - scrolledX) <= 1,
|
|
|
|
"doTestZoomedScroll: zoomed horizontal scroll amount by line wheel event is different from normal, scrollLeft=" +
|
|
|
|
gScrollableElement.scrollLeft + ", scrolledX=" + scrolledX);
|
|
|
|
ok(Math.abs(gScrollableElement.scrollTop - scrolledY) <= 1,
|
|
|
|
"doTestZoomedScroll: zoomed vertical scroll amount by line wheel event is different from normal, scrollTop=" +
|
|
|
|
gScrollableElement.scrollTop + ", scrolledY=" + scrolledY);
|
|
|
|
|
|
|
|
window.removeEventListener("MozMousePixelScroll", handler, true);
|
|
|
|
|
2012-08-15 19:51:13 +04:00
|
|
|
synthesizeKey("0", { accelKey: true });
|
2014-01-30 21:20:37 +04:00
|
|
|
onZoomReset(aCallback);
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}, 20);
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}, 20);
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX It's too difficult to test page scroll because the page scroll amount
|
|
|
|
// is computed by complex logic.
|
|
|
|
|
2014-01-30 21:20:37 +04:00
|
|
|
prepareTestZoomedPixelScroll();
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
|
2012-10-31 03:22:23 +04:00
|
|
|
function doTestWholeScroll(aCallback)
|
|
|
|
{
|
2016-02-29 16:42:56 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [
|
2016-04-12 07:06:49 +03:00
|
|
|
["mousewheel.default.delta_multiplier_x", 999999],
|
|
|
|
["mousewheel.default.delta_multiplier_y", 999999]]},
|
2016-02-29 16:42:56 +03:00
|
|
|
function() { doTestWholeScroll2(aCallback); });
|
|
|
|
}
|
2012-10-31 03:22:23 +04:00
|
|
|
|
2016-02-29 16:42:56 +03:00
|
|
|
function doTestWholeScroll2(aCallback)
|
|
|
|
{
|
2012-10-31 03:22:23 +04:00
|
|
|
const kTests = [
|
|
|
|
{ description: "try whole-scroll to top (line)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
|
|
|
expectedScrollTop: 0,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to top when scrollTop is already top-most (line)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: -1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
|
|
|
expectedScrollTop: 0,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to bottom (line)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
|
|
|
expectedScrollTop: gScrollableElement.scrollTopMax,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to bottom when scrollTop is already bottom-most (line)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
|
|
|
expectedScrollTop: gScrollableElement.scrollTopMax,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to left (line)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: 0
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to left when scrollLeft is already left-most (line)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: -1.0, deltaY: 0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: 0
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to right (line)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: gScrollableElement.scrollLeftMax
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to right when scrollLeft is already right-most (line)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: gScrollableElement.scrollLeftMax
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{ description: "try whole-scroll to top (pixel)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 0,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to top when scrollTop is already top-most (pixel)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: -1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 0,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to bottom (pixel)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: gScrollableElement.scrollTopMax,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to bottom when scrollTop is already bottom-most (pixel)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: gScrollableElement.scrollTopMax,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to left (pixel)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: 0
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to left when scrollLeft is already left-most (pixel)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: -1.0, deltaY: 0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: 0
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to right (pixel)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: gScrollableElement.scrollLeftMax
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to right when scrollLeft is already right-most (pixel)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
|
|
|
deltaX: 1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: gScrollableElement.scrollLeftMax
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{ description: "try whole-scroll to top (page)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: -1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
|
|
|
expectedScrollTop: 0,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to top when scrollTop is already top-most (page)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: -1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
|
|
|
expectedScrollTop: 0,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to bottom (page)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
|
|
|
expectedScrollTop: gScrollableElement.scrollTopMax,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to bottom when scrollTop is already bottom-most (page)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
|
|
|
expectedScrollTop: gScrollableElement.scrollTopMax,
|
|
|
|
expectedScrollLeft: 1000
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to left (page)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: 0
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to left when scrollLeft is already left-most (page)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: -1.0, deltaY: 0,
|
|
|
|
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: 0
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to right (page)",
|
|
|
|
prepare: function () {
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
|
|
|
},
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: gScrollableElement.scrollLeftMax
|
|
|
|
},
|
|
|
|
{ description: "try whole-scroll to right when scrollLeft is already right-most (page)",
|
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
|
|
|
deltaX: 1.0, deltaY: 0.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
|
|
|
expectedScrollTop: 1000,
|
|
|
|
expectedScrollLeft: gScrollableElement.scrollLeftMax
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
var index = 0;
|
|
|
|
|
|
|
|
function doIt()
|
|
|
|
{
|
|
|
|
const kTest = kTests[index];
|
|
|
|
if (kTest.prepare) {
|
|
|
|
kTest.prepare();
|
|
|
|
}
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, kTest.event, function () {
|
2012-10-31 03:22:23 +04:00
|
|
|
is(gScrollableElement.scrollTop, kTest.expectedScrollTop,
|
|
|
|
"doTestWholeScroll, " + kTest.description + ": unexpected scrollTop");
|
|
|
|
is(gScrollableElement.scrollLeft, kTest.expectedScrollLeft,
|
|
|
|
"doTestWholeScroll, " + kTest.description + ": unexpected scrollLeft");
|
|
|
|
if (++index == kTests.length) {
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
} else {
|
|
|
|
doIt();
|
|
|
|
}
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-10-31 03:22:23 +04:00
|
|
|
}
|
|
|
|
doIt();
|
|
|
|
}
|
|
|
|
|
2012-12-08 08:08:19 +04:00
|
|
|
function doTestActionOverride(aCallback)
|
|
|
|
{
|
|
|
|
const kNoScroll = 0x00;
|
|
|
|
const kScrollUp = 0x01;
|
|
|
|
const kScrollDown = 0x02;
|
|
|
|
const kScrollLeft = 0x04;
|
|
|
|
const kScrollRight = 0x08;
|
|
|
|
|
|
|
|
const kTests = [
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXNoOverride,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXNone,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXScroll,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXNoOverride,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXNone,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXScroll,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXNoOverride,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.5,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXNone,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.5,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXScroll,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.5,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXNoOverride,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.5,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXNone,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.5,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXScroll,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 1.0, deltaY: 0.5,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXNoOverride,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXNone,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionScroll, override_x: kDefaultActionOverrideXScroll,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kScrollDown | kScrollRight
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXNoOverride,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXNone,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
{ action: kDefaultActionNone, override_x: kDefaultActionOverrideXScroll,
|
2012-12-08 08:08:19 +04:00
|
|
|
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
|
|
|
deltaX: 0.5, deltaY: 1.0,
|
|
|
|
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
|
|
|
|
expected: kNoScroll
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
var index = 0;
|
|
|
|
|
|
|
|
function doIt()
|
2016-02-29 16:42:56 +03:00
|
|
|
{
|
|
|
|
const kTest = kTests[index];
|
|
|
|
SpecialPowers.pushPrefEnv({"set": [
|
|
|
|
["mousewheel.default.action", kTest.action],
|
|
|
|
["mousewheel.default.action.override_x", kTest.override_x]]},
|
|
|
|
doIt2
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function doIt2()
|
2012-12-08 08:08:19 +04:00
|
|
|
{
|
|
|
|
const kTest = kTests[index];
|
|
|
|
description = "doTestActionOverride(action=" + kTest.action + ", " +
|
|
|
|
"override_x=" + kTest.override_x + ", " +
|
|
|
|
"deltaX=" + kTest.event.deltaX + ", " +
|
|
|
|
"deltaY=" + kTest.event.deltaY + "): ";
|
|
|
|
gScrollableElement.scrollTop = 1000;
|
|
|
|
gScrollableElement.scrollLeft = 1000;
|
2015-04-13 07:51:43 +03:00
|
|
|
sendWheelAndWait(10, 10, kTest.event, function () {
|
2012-12-08 08:08:19 +04:00
|
|
|
if (kTest.expected & kScrollUp) {
|
|
|
|
ok(gScrollableElement.scrollTop < 1000, description + "not scrolled up, got " + gScrollableElement.scrollTop);
|
|
|
|
} else if (kTest.expected & kScrollDown) {
|
|
|
|
ok(gScrollableElement.scrollTop > 1000, description + "not scrolled down, got " + gScrollableElement.scrollTop);
|
|
|
|
} else {
|
|
|
|
is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
|
|
|
|
}
|
|
|
|
if (kTest.expected & kScrollLeft) {
|
|
|
|
ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
|
|
|
|
} else if (kTest.expected & kScrollRight) {
|
|
|
|
ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
|
|
|
|
} else {
|
|
|
|
is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
|
|
|
|
}
|
|
|
|
if (++index == kTests.length) {
|
|
|
|
SimpleTest.executeSoon(aCallback);
|
|
|
|
} else {
|
|
|
|
doIt();
|
|
|
|
}
|
2016-03-10 00:27:00 +03:00
|
|
|
});
|
2012-12-08 08:08:19 +04:00
|
|
|
}
|
|
|
|
doIt();
|
|
|
|
}
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
function runTests()
|
|
|
|
{
|
2016-02-29 16:42:56 +03:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [
|
2016-03-10 00:28:00 +03:00
|
|
|
["test.events.async.enabled", true],
|
2016-02-29 16:42:56 +03:00
|
|
|
["general.smoothScroll", false],
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
["mousewheel.default.action", kDefaultActionScroll],
|
|
|
|
["mousewheel.default.action.override_x", kDefaultActionOverrideXNoOverride],
|
|
|
|
["mousewheel.with_shift.action", kDefaultActionHorizontalScroll],
|
|
|
|
["mousewheel.with_shift.action.override_x", kDefaultActionOverrideXNoOverride],
|
|
|
|
["mousewheel.with_control.action", kDefaultActionZoom],
|
|
|
|
["mousewheel.with_control.action.override_x", kDefaultActionOverrideXNoOverride],
|
|
|
|
["mousewheel.with_alt.action", kDefaultActionHistory],
|
|
|
|
["mousewheel.with_alt.action.override_x", kDefaultActionOverrideXNoOverride]]},
|
2016-02-29 16:42:56 +03:00
|
|
|
runTests2);
|
|
|
|
}
|
2012-08-12 05:42:36 +04:00
|
|
|
|
2016-02-29 16:42:56 +03:00
|
|
|
function runTests2()
|
|
|
|
{
|
2012-08-12 05:42:36 +04:00
|
|
|
const kSettings = [
|
|
|
|
{ description: "all delta values are not customized",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaX is reverted",
|
|
|
|
deltaMultiplierX: -1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaY is reverted",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: -1.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaZ is reverted",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: -1.0 },
|
|
|
|
{ description: "deltaX is 2.0",
|
|
|
|
deltaMultiplierX: 2.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaY is 2.0",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: 2.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaZ is 2.0",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 2.0 },
|
|
|
|
{ description: "deltaX is -2.0",
|
|
|
|
deltaMultiplierX: -2.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaY is -2.0",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: -2.0, deltaMultiplierZ: 1.0 },
|
|
|
|
{ description: "deltaZ is -2.0",
|
|
|
|
deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: -2.0 },
|
|
|
|
];
|
|
|
|
|
|
|
|
var index = 0;
|
|
|
|
|
|
|
|
function doTest() {
|
2016-02-29 16:42:56 +03:00
|
|
|
setDeltaMultiplierSettings(kSettings[index], function () {
|
|
|
|
doTestScroll(kSettings[index], function () {
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
doTestHorizontalScroll(kSettings[index], function() {
|
|
|
|
doTestZoom(kSettings[index], function() {
|
|
|
|
if (++index == kSettings.length) {
|
|
|
|
setDeltaMultiplierSettings(kSettings[0], function() {
|
|
|
|
doTestZoomedScroll(function() {
|
|
|
|
doTestWholeScroll(function() {
|
|
|
|
doTestActionOverride(function() {
|
|
|
|
finishTests();
|
|
|
|
});
|
2016-02-29 16:42:56 +03:00
|
|
|
});
|
|
|
|
});
|
2012-10-31 03:22:23 +04:00
|
|
|
});
|
Bug 143038 Make users can scroll contents horizontally with vertical wheel operation with a modifier r=smaug
This patch declares a new default action, "horizontal scroll", this scrolls
content horizontally with deltaY of wheel events and ignores deltaX and deltaZ.
This is used for default action with Shift key in default setting except on
macOS. On macOS, legacy mouse's vertical wheel operation with Shift key causes
native horizontal wheel event. Therefore, we don't need to use this new
default action on macOS. Additionally, old default action with Shift key,
navigating history, is moved to with Alt key. This makes same settings between
macOS and the others. So, this is better for users who use macOS and another
OS and web app developers who check wheel events only on macOS or other
platform(s).
For simpler implementation, default action handlers moves deltaY values to
deltaX values temporarily *only* while they handle wheel events. This is
performed by AutoWheelDeltaAdjuster and restored after handling it
automatically.
So, in other words, even if default action is "horizontal scroll", web apps
receives wheel events whose deltaY is not zero but its content will be
scrolled horizontally. This is same as Chromium, so, this behavior shouldn't
cause any incompatible behavior with it.
MozReview-Commit-ID: E4X3yZzLEAl
--HG--
extra : rebase_source : e20d854c6b0a181ad4c9e7304bd9ad14256481ff
2017-10-04 19:12:35 +03:00
|
|
|
} else {
|
|
|
|
doTest();
|
|
|
|
}
|
|
|
|
});
|
2016-02-29 16:42:56 +03:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
});
|
2012-12-08 08:08:19 +04:00
|
|
|
});
|
2012-08-12 05:42:36 +04:00
|
|
|
}
|
|
|
|
doTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
function finishTests()
|
|
|
|
{
|
2013-03-16 01:40:37 +04:00
|
|
|
winUtils.restoreNormalRefresh();
|
|
|
|
|
2012-08-12 05:42:36 +04:00
|
|
|
window.opener.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|