--- a/dom/events/test/window_wheel_default_action.html
+++ b/dom/events/test/window_wheel_default_action.html
@@ -63,16 +63,17 @@ SimpleTest.waitForFocus(function() {
});
});
chromeScript.promiseOneMessage("blank-attribute-removed").then(() => {
chromeScript.destroy();
runTests();
});
}, window);
+SimpleTest.requestLongerTimeout(5);
SimpleTest.requestFlakyTimeout("untriaged");
var winUtils = SpecialPowers.getDOMWindowUtils(window);
// grab refresh driver
winUtils.advanceTimeAndRefresh(100);
var gScrollableElement = document.getElementById("scrollable");
var gScrolledElement = document.getElementById("scrolled");
@@ -356,17 +357,17 @@ function doTestScroll(aSettings, aCallba
{ 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,
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
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,
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
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,
@@ -1159,17 +1160,17 @@ function doTestHorizontalizedScroll(aSet
{ 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,
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
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,
@@ -1297,16 +1298,2092 @@ function doTestHorizontalizedScroll(aSet
winUtils.advanceTimeAndRefresh(100);
doNextTest();
}
});
}
doNextTest();
}
+// It will take *freaking* long time(maybe *hours*) to test all the writing mode
+// combinations for the scroll target and its root, because there are altogether
+// *one hundred* combinations (10 x 10)!
+//
+// So unless you really don't care a snap on time-consuming testing or a strict
+// criteria is required for testing, it is strongly recommeneded that you
+// comment out at least the writing modes which are marked as "peculiar" before
+// running this test, you are encouraged to also comment out those "uncommon"
+// writing modes in order to further shorten testing time.
+//
+// Note that if you are going to run time-consuming tests without commenting out
+// most of the writing modes, don't forget to increase the value of the
+// parameter in SimpleTest.requestLongerTimeout in this file; otherwise it'll
+// most likely lead you to a timed-out failure.
+//
+// Also note that |isBTT| has nothing to do with the behaviour of auto-dir
+// scrolling, it's just used to set the sign of |origScrollTop|.
+const kWritingModes = [
+ {
+ isRTL: true,
+ isBTT: false,
+ styles: [
+ {
+ writingMode: "horizontal-tb",
+ direction: "rtl",
+ },
+ // uncommon
+ //{
+ // writingMode: "vertical-rl",
+ // direction: "ltr",
+ //},
+ // peculiar
+ //{
+ // writingMode: "sideways-rl",
+ // direction: "ltr",
+ //},
+ ],
+ },
+ {
+ isRTL: false,
+ isBTT: false,
+ styles: [
+ {
+ writingMode: "horizontal-tb",
+ direction: "ltr",
+ },
+ // uncommon
+ //{
+ // writingMode: "vertical-lr",
+ // direction: "ltr",
+ //},
+ // peculiar
+ //{
+ // writingMode: "sideways-lr",
+ // direction: "ltr",
+ //},
+ ],
+ },
+ {
+ isRTL: true,
+ isBTT: true,
+ styles: [
+ // peculiar
+ //{
+ // writingMode: "vertical-rl",
+ // direction: "rtl",
+ //},
+ // peculiar
+ //{
+ // writingMode: "sideways-rl",
+ // direction: "rtl",
+ //},
+ ],
+ },
+ {
+ isRTL: false,
+ isBTT: true,
+ styles: [
+ // peculiar
+ //{
+ // writingMode: "vertical-lr",
+ // direction: "rtl",
+ //},
+ // peculiar
+ //{
+ // writingMode: "sideways-lr",
+ // direction: "rtl",
+ //},
+ ],
+ },
+];
+
+function getFirstWritingModeStyle()
+{
+ if (kWritingModes.length < 1) {
+ return false;
+ }
+ let typeIndex = 0;
+ while (kWritingModes[typeIndex].styles.length < 1) {
+ typeIndex++;
+ if (typeIndex >= kWritingModes.length) {
+ return false;
+ }
+ }
+ return {typeIndex: typeIndex, styleIndex: 0};
+}
+
+function getNextWritingModeStyle(curStyle)
+{
+ let typeIndex = curStyle.typeIndex;
+ let styleIndex = curStyle.styleIndex + 1;
+ while (typeIndex < kWritingModes.length) {
+ if (styleIndex < kWritingModes[typeIndex].styles.length) {
+ return {typeIndex: typeIndex, styleIndex: styleIndex};
+ }
+ typeIndex++;
+ styleIndex = 0;
+ }
+ return false;
+}
+
+function doTestAutoDirScroll(aSettings, aAutoDirTrait, aCallback) {
+ // Go through all the writing-mode combinations for the scroll target and its
+ // root.
+
+ let firstStyle = getFirstWritingModeStyle();
+ if (!firstStyle) {
+ // The whole writing mode list is empty, no need to do any test for auto-dir
+ // scrolling. Go ahead with the subsequent tests.
+ SimpleTest.executeSoon(aCallback);
+ return;
+ }
+
+ // Begin with the first style for both the root and the scroll target.
+ // doTestAutoDirScroll2 will recursively call itself back for every
+ // style combination with getNextWritingModeStyle until all combinations have
+ // been enumerated, and then it will call SimpleTest.executeSoon(aCallback).
+ doTestAutoDirScroll2(aSettings, aAutoDirTrait,
+ firstStyle, firstStyle,
+ aCallback);
+}
+
+function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
+ aStyleForRoot, aStyleForTarget,
+ aCallback)
+{
+ const styleTypeForRoot = kWritingModes[aStyleForRoot.typeIndex];
+ const styleTypeForTarget = kWritingModes[aStyleForTarget.typeIndex];
+
+ const styleForRoot = styleTypeForRoot.styles[aStyleForRoot.styleIndex];
+ const styleForTarget = styleTypeForTarget.styles[aStyleForTarget.styleIndex];
+
+ const isRootRTL = styleTypeForRoot.isRTL;
+ const isTargetRTL = styleTypeForTarget.isRTL;
+ // Just used to set the sign of |origScrollTop|, not related to the auto-dir
+ // behaviour.
+ const isTargetBTT = styleTypeForTarget.isBTT;
+
+ const oldStyleForRoot = {};
+ const oldStyleForTarget = {};
+
+ const honoursRoot = Boolean(aAutoDirTrait.honoursRoot);
+
+ const kNoScroll = 0x00;
+ const kScrollUp = 0x01;
+ const kScrollDown = 0x02;
+ const kScrollLeft = 0x04;
+ const kScrollRight = 0x08;
+
+ // The four constants indicate the expected result if the scroll direction is
+ // adjusted.
+ const adjustedForUp = {};
+ const adjustedForDown = {};
+ const adjustedForLeft = {};
+ const adjustedForRight = {};
+ if (honoursRoot ? isRootRTL : isTargetRTL) {
+ adjustedForUp.result = kScrollRight;
+ adjustedForUp.desc = "right";
+ adjustedForDown.result = kScrollLeft;
+ adjustedForDown.desc = "left";
+ adjustedForLeft.result = kScrollDown;
+ adjustedForLeft.desc = "bottom";
+ adjustedForRight.result = kScrollUp;
+ adjustedForRight.desc = "top";
+ } else {
+ adjustedForUp.result = kScrollLeft;
+ adjustedForUp.desc = "left";
+ adjustedForDown.result = kScrollRight;
+ adjustedForDown.desc = "right";
+ adjustedForLeft.result = kScrollUp;
+ adjustedForLeft.desc = "top";
+ adjustedForRight.result = kScrollDown;
+ adjustedForRight.desc = "bottom";
+ }
+
+ const kTests = [
+ // Tests: Test pixel scrolling towards four edges when the target
+ // overflows in both the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions.
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown,
+ prepare: function (cb)
+ {
+ // Static contents will not start from the topleft side in some
+ // writing modes, for ease of coding, we simply absolutely
+ // position the target to the topleft in every case.
+ gScrollableElement.style.position = "absolute";
+ gScrollableElement.style.top = "10px";
+ gScrollableElement.style.left = "10px";
+ SpecialPowers.pushPrefEnv({
+ "set": [["mousewheel.autodir.enabled", true],
+ ["mousewheel.autodir.honourroot", honoursRoot]]
+ }, cb);
+ } },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test diagonal pixel scrolling when the target overflows in both
+ // the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions, furthermore, it never applies to
+ // diagonal scrolling.
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollRight },
+
+ // Tests: Test pixel scrolling with non-zero deltaZ when the target
+ // overflows in both the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions, furthermore, it never applies to
+ // scrolling with non-zero deltaZ.
+ { 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to bottom by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to bottom by pixel scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by pixel scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to right by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by pixel scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by pixel scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to bottom-right by pixel scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollRight },
+ { description: "auto-dir scroll to bottom-left by pixel scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollLeft },
+ { description: "auto-dir scroll to top-left by pixel scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollLeft },
+ { description: "auto-dir scroll to top-right by pixel scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollRight },
+
+ // Tests: Test line scrolling towards four edges when the target overflows
+ // in both the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions.
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test diagonal line scrolling when the target overflows in both
+ // the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions, furthermore, it never applies to
+ // diagonal scrolling.
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollRight },
+
+ // Tests: Test line scrolling with non-zero deltaZ when the target
+ // overflows in both the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions, furthermore, it never applies to
+ // scrolling with non-zero deltaZ.
+ { 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to bottom by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to bottom by line scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by line scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to right by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by line scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by line scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to bottom-right by line scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollRight },
+ { description: "auto-dir scroll to bottom-left by line scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollLeft },
+ { description: "auto-dir scroll to top-left by line scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollLeft },
+ { description: "auto-dir scroll to top-right by line scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollRight },
+
+ // Tests: Test page scrolling towards four edges when the target overflows
+ // in both the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions.
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test diagonal page scrolling when the target overflows in both
+ // the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions, furthermore, it never applies to
+ // diagonal scrolling.
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollRight },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollLeft },
+ { description: "auto-dir 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollRight },
+
+ // Tests: Test page scrolling with non-zero deltaZ when the target
+ // overflows in both the two directions.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment never applies to a target which overflows in
+ // both the two directions, furthermore, it never applies to
+ // scrolling with non-zero deltaZ.
+ { 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,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to bottom by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to bottom by page scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by page scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to right by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by page scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by page scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to bottom-right by page scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollRight },
+ { description: "auto-dir scroll to bottom-left by page scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown | kScrollLeft },
+ { description: "auto-dir scroll to top-left by page scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollLeft },
+ { description: "auto-dir scroll to top-right by page scroll when deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp | kScrollRight },
+
+ // The tests above in this function are all for testing a target with two
+ // scrollbars. All of them should not be adjustable.
+ // From here on, the tests below in this function are all for testing a
+ // target with only one scrollbar, either a vertical scrollbar or horizontal
+ // scrollbar. Some of them are adjustable.
+
+ // Tests: Test pixel scrolling towards four edges when the target
+ // overflows only in the horizontal direction.
+ // Results: Vertical wheel scrolls are adjusted to be horizontal whereas the
+ // horizontal wheel scrolls are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero.
+ { description: "auto-dir scroll to " + adjustedForDown.desc +
+ "(originally bottom) by pixel scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForDown.result,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowY = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to " + adjustedForDown.desc +
+ "(originally bottom) by pixel scroll when lineOrPageDelta is 1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForDown.result },
+ { description: "auto-dir scroll to " + adjustedForUp.desc +
+ "(originally top) by pixel scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForUp.result },
+ { description: "auto-dir scroll to " + adjustedForUp.desc +
+ "(originally top) by pixel scroll when lineOrPageDelta is -1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForUp.result },
+ { description: "auto-dir scroll to right by pixel scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by pixel scroll when lineOrPageDelta is 1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by pixel scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by pixel scroll when lineOrPageDelta is -1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test pixel scrolling towards four edges when the target
+ // overflows only in the vertical direction.
+ // Results: Horizontal wheel scrolls are adjusted to be vertical whereas the
+ // vertical wheel scrolls are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero.
+ { description: "auto-dir scroll to bottom by pixel scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowY = "auto";
+ gScrollableElement.style.overflowX = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to bottom by pixel scroll when lineOrPageDelta is 1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by pixel scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by pixel scroll when lineOrPageDelta is -1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to " + adjustedForRight.desc +
+ "(originally right) by pixel scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForRight.result },
+ { description: "auto-dir scroll to " + adjustedForRight.desc +
+ "(originally right) by pixel scroll when lineOrPageDelta is 1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForRight.result },
+ { description: "auto-dir scroll to " + adjustedForLeft.desc +
+ "(originally left) by pixel scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForLeft.result },
+ { description: "auto-dir scroll to " + adjustedForLeft.desc +
+ "(originally left) by pixel scroll when lineOrPageDelta is -1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForLeft.result },
+
+ // Tests: Test pixel scrolling towards four edges when the target
+ // overflows only in the vertical direction and deltaZ is non-zero.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero. But the last condition is unmet.
+ { description: "auto-dir scroll to bottom by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to bottom by pixel scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by pixel scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to right by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to right by pixel scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to left by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to left by pixel scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+
+ // Tests: Test pixel scrolling towards four edges when the target
+ // overflows only in the horizontal direction and deltaZ is
+ // non-zero.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero. But the last condition is unmet.
+ { description: "auto-dir scroll to bottom by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowX = "auto";
+ gScrollableElement.style.overflowY = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to bottom by pixel scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: 8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to top by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to top by pixel scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 0.0, deltaY: -8.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to right by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by pixel scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: 8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by pixel scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by pixel scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
+ deltaX: -8.0, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test line scrolling towards four edges when the target overflows
+ // only in the horizontal direction.
+ // Results: Vertical wheel scrolls are adjusted to be horizontal whereas the
+ // horizontal wheel scrolls are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero.
+ { description: "auto-dir scroll to " + adjustedForDown.desc +
+ "(originally bottom) by line scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForDown.result },
+ { description: "auto-dir scroll to " + adjustedForDown.desc +
+ "(originally bottom) by line scroll when lineOrPageDelta is 1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForDown.result },
+ { description: "auto-dir scroll to " + adjustedForUp.desc +
+ "(originally top) by line scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForUp.result },
+ { description: "auto-dir scroll to " + adjustedForUp.desc +
+ "(originally top) by line scroll when lineOrPageDelta is -1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForUp.result },
+ { description: "auto-dir scroll to right by line scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by line scroll when lineOrPageDelta is 1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by line scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by line scroll when lineOrPageDelta is -1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test line scrolling towards four edges when the target overflows
+ // only in the vertical direction.
+ // Results: Horizontal wheel scrolls are adjusted to be vertical whereas the
+ // vertical wheel scrolls are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero.
+ { description: "auto-dir scroll to bottom by line scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowY = "auto";
+ gScrollableElement.style.overflowX = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to bottom by line scroll when lineOrPageDelta is 1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by line scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by line scroll when lineOrPageDelta is -1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to " + adjustedForRight.desc +
+ "(originally right) by line scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForRight.result },
+ { description: "auto-dir scroll to " + adjustedForRight.desc +
+ "(originally right) by line scroll when lineOrPageDelta is 1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForRight.result },
+ { description: "auto-dir scroll to " + adjustedForLeft.desc +
+ "(originally left) by line scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForLeft.result },
+ { description: "auto-dir scroll to " + adjustedForLeft.desc +
+ "(originally left) by line scroll when lineOrPageDelta is -1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForLeft.result },
+
+ // Tests: Test line scrolling towards four edges when the target overflows
+ // only in the vertical direction and deltaZ is non-zero.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero. But the last condition is unmet.
+ { description: "auto-dir scroll to bottom by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to bottom by line scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by line scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to right by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to right by line scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to left by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to left by line scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+
+ // Tests: Test line scrolling towards four edges when the target overflows
+ // only in the horizontal direction and deltaZ is non-zero.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero. But the last condition is unmet.
+ { description: "auto-dir scroll to bottom by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowX = "auto";
+ gScrollableElement.style.overflowY = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to bottom by line scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to top by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to top by line scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to right by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by line scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by line scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by line scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test page scrolling towards four edges when the target overflows
+ // only in the horizontal direction.
+ // Results: Vertical wheel scrolls are adjusted to be horizontal whereas the
+ // horizontal wheel scrolls are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero.
+ { description: "auto-dir scroll to " + adjustedForDown.desc +
+ "(originally bottom) by page scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForDown.result },
+ { description: "auto-dir scroll to " + adjustedForDown.desc +
+ "(originally bottom) by page scroll when lineOrPageDelta is 1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForDown.result },
+ { description: "auto-dir scroll to " + adjustedForUp.desc +
+ "(originally top) by page scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForUp.result },
+ { description: "auto-dir scroll to " + adjustedForUp.desc +
+ "(originally top) by page scroll when lineOrPageDelta is -1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForUp.result },
+ { description: "auto-dir scroll to right by page scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by page scroll when lineOrPageDelta is 1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by page scroll even if lineOrPageDelta is 0, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by page scroll when lineOrPageDelta is -1, "+
+ "no vertical scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+
+ // Tests: Test page scrolling towards four edges when the target overflows
+ // only in the vertical direction.
+ // Results: Horizontal wheel scrolls are adjusted to be vertical whereas the
+ // vertical wheel scrolls are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero.
+ { description: "auto-dir scroll to bottom by page scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowY = "auto";
+ gScrollableElement.style.overflowX = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to bottom by page scroll when lineOrPageDelta is 1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by page scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by page scroll when lineOrPageDelta is -1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to " + adjustedForRight.desc +
+ "(originally right) by page scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForRight.result },
+ { description: "auto-dir scroll to " + adjustedForRight.desc +
+ "(originally right) by page scroll when lineOrPageDelta is 1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForRight.result },
+ { description: "auto-dir scroll to " + adjustedForLeft.desc +
+ "(originally left) by page scroll even if lineOrPageDelta is 0, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForLeft.result },
+ { description: "auto-dir scroll to " + adjustedForLeft.desc +
+ "(originally left) by page scroll when lineOrPageDelta is -1, "+
+ "no horizontal scrollbar",
+ 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: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: true,
+ expected: adjustedForLeft.result },
+
+ // Tests: Test page scrolling towards four edges when the target overflows
+ // only in the vertical direction and deltaZ is non-zero.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero. But the last condition is unmet.
+ { description: "auto-dir scroll to bottom by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to bottom by page scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollDown },
+ { description: "auto-dir scroll to top by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to top by page scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollUp },
+ { description: "auto-dir scroll to right by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to right by page scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to left by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to left by page scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no horizontal scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+
+ // Tests: Test page scrolling towards four edges when the target overflows
+ // only in the horizontal direction and deltaZ is non-zero.
+ // Results: All are unadjusted.
+ // Reason: Auto-dir adjustment applies to a target if the target overflows
+ // in only one direction and the direction is orthogonal to the
+ // wheel and deltaZ is zero. But the last condition is unmet.
+ { description: "auto-dir scroll to bottom by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll,
+ prepare: function (cb)
+ {
+ gScrollableElement.style.overflowX = "auto";
+ gScrollableElement.style.overflowY = "hidden";
+ cb();
+ } },
+ { description: "auto-dir scroll to bottom by page scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: 0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to top by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to top by page scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.0, deltaY: -0.5, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kNoScroll },
+ { description: "auto-dir scroll to right by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to right by page scroll when lineOrPageDelta is 1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: 0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollRight },
+ { description: "auto-dir scroll to left by page scroll even if lineOrPageDelta is 0 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft },
+ { description: "auto-dir scroll to left by page scroll when lineOrPageDelta is -1 "+
+ "and deltaZ is non-zero, and no vertical scrollbar",
+ event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
+ deltaX: -0.5, deltaY: 0.0, deltaZ: 1.0,
+ lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
+ expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
+ shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
+ adjusted: false,
+ expected: kScrollLeft,
+ cleanup: function (cb)
+ {
+ gScrollableElement.style.position = "static";
+ gScrollableElement.style.top = "auto";
+ gScrollableElement.style.left = "auto";
+ gScrollableElement.style.overflowY = "auto";
+ Object.assign(document.body.style, oldStyleForRoot);
+ Object.assign(gScrollableElement.style, oldStyleForTarget);
+ SpecialPowers.pushPrefEnv({"set":
+ [["mousewheel.autodir.enabled",
+ false]]},
+ cb);
+ } },
+ ];
+
+ let styleDescForRoot = "";
+ let styleDescForTarget = "";
+ Object.keys(styleForRoot).forEach(function(property)
+ {
+ oldStyleForRoot[property] = document.body.style[property];
+ document.body.style[property] = styleForRoot[property];
+ if ("" !== styleDescForRoot) {
+ styleDescForRoot += " ";
+ }
+ styleDescForRoot += property + ": " + styleForRoot[property] + ";";
+ });
+ Object.keys(styleForTarget).forEach(function(property)
+ {
+ oldStyleForTarget[property] = gScrollableElement.style[property];
+ gScrollableElement.style[property] = styleForTarget[property];
+ if ("" !== styleDescForTarget) {
+ styleDescForTarget += " ";
+ }
+ styleDescForTarget += property + ": " +
+ styleForTarget[property] + ";";
+ });
+
+ var description;
+ var currentTestIndex = -1;
+ var isXReverted = aSettings.deltaMultiplierX < 0;
+ var isYReverted = aSettings.deltaMultiplierY < 0;
+
+ const origScrollLeft = isTargetRTL ? -1000 : 1000;
+ const origScrollTop = isTargetBTT ? -1000 : 1000;
+
+ function doNextTest()
+ {
+ if (++currentTestIndex >= kTests.length) {
+ // The tests for the current writing mode combination have been finished.
+ // Continue the tests for the next writing mode combination, if any.
+ let nextStyleForRoot;
+ let nextStyleForTarget;
+ nextStyleForTarget = getNextWritingModeStyle(aStyleForTarget);
+ if (nextStyleForTarget) {
+ nextStyleForRoot = aStyleForRoot;
+ } else {
+ nextStyleForRoot = getNextWritingModeStyle(aStyleForRoot);
+ if (!nextStyleForRoot) {
+ // All writing mode combinations have been enumerated, so stop
+ // recursively calling doTestAutoDirScroll2, and go ahead with the
+ // subsequent tests.
+ SimpleTest.executeSoon(aCallback);
+ return;
+ }
+ nextStyleForTarget = getFirstWritingModeStyle();
+ }
+ doTestAutoDirScroll2(aSettings, aAutoDirTrait,
+ nextStyleForRoot, nextStyleForTarget,
+ aCallback);
+ return;
+ }
+
+ gScrollableElement.scrollTop = origScrollTop;
+ gScrollableElement.scrollLeft = origScrollLeft;
+
+ var currentTest = kTests[currentTestIndex];
+ description = "doTestAutoDirScroll(aSettings=" + aSettings.description + ", ";
+ if (honoursRoot) {
+ description += "{honoursRoot: true}), ";
+ } else {
+ description += "{honoursRoot: false}), ";
+ }
+ description += "root = " + styleDescForRoot + " ";
+ description += "target = " + styleDescForTarget + " ";
+ if (currentTest.adjusted) {
+ description += "adjusted ";
+ } else {
+ description += "unadjusted ";
+ }
+ description += currentTest.description + ": ";
+ if (currentTest.prepare) {
+ currentTest.prepare(doTestCurrentScroll);
+ } else {
+ doTestCurrentScroll();
+ }
+ }
+
+ function doTestCurrentScroll() {
+ var currentTest = kTests[currentTestIndex];
+ sendWheelAndWait(100, 100, currentTest.event, function () {
+ if (currentTest.expected == kNoScroll) {
+ is(gScrollableElement.scrollTop, origScrollTop, description + "scrolled vertical");
+ is(gScrollableElement.scrollLeft, origScrollLeft, description + "scrolled horizontal");
+ } else {
+ // If auto-dir adjustment occurs, temporarily swap |isYReverted| and
+ // |isXReverted|.
+ if (currentTest.adjusted) {
+ [isYReverted, isXReverted] = [isXReverted, isYReverted];
+ }
+ var scrollUp = !isYReverted ? (currentTest.expected & kScrollUp) :
+ (currentTest.expected & kScrollDown);
+ var scrollDown = !isYReverted ? (currentTest.expected & kScrollDown) :
+ (currentTest.expected & kScrollUp);
+ if (scrollUp) {
+ ok(gScrollableElement.scrollTop < origScrollTop,
+ description + "not scrolled up, got " + gScrollableElement.scrollTop);
+ } else if (scrollDown) {
+ ok(gScrollableElement.scrollTop > origScrollTop,
+ description + "not scrolled down, got " + gScrollableElement.scrollTop);
+ } else {
+ is(gScrollableElement.scrollTop, origScrollTop,
+ description + "scrolled vertical");
+ }
+ var scrollLeft = !isXReverted ? (currentTest.expected & kScrollLeft) :
+ (currentTest.expected & kScrollRight);
+ var scrollRight = !isXReverted ? (currentTest.expected & kScrollRight) :
+ (currentTest.expected & kScrollLeft);
+ if (scrollLeft) {
+ ok(gScrollableElement.scrollLeft < origScrollLeft,
+ description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
+ } else if (scrollRight) {
+ ok(gScrollableElement.scrollLeft > origScrollLeft,
+ description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
+ } else {
+ is(gScrollableElement.scrollLeft, origScrollLeft,
+ description + "scrolled horizontal");
+ }
+ // |isYReverted| and |isXReverted| have been temporarily swaped for
+ // auto-dir adjustment, restore them.
+ if (currentTest.adjusted) {
+ [isYReverted, isXReverted] = [isXReverted, isYReverted];
+ }
+ }
+ if (currentTest.cleanup) {
+ currentTest.cleanup(nextStep);
+ } else {
+ nextStep();
+ }
+
+ function nextStep() {
+ winUtils.advanceTimeAndRefresh(100);
+ doNextTest();
+ }
+ });
+ }
+ doNextTest();
+}
+
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;
}
@@ -2212,31 +4289,35 @@ function runTests2()
deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: -2.0 },
];
var index = 0;
function doTest() {
setDeltaMultiplierSettings(kSettings[index], function () {
doTestScroll(kSettings[index], function () {
- doTestHorizontalizedScroll(kSettings[index], function() {
- doTestZoom(kSettings[index], function() {
- if (++index == kSettings.length) {
- setDeltaMultiplierSettings(kSettings[0], function() {
- doTestZoomedScroll(function() {
- doTestWholeScroll(function() {
- doTestActionOverride(function() {
- finishTests();
+ doTestAutoDirScroll(kSettings[index], {honoursRoot: false}, function () {
+ doTestAutoDirScroll(kSettings[index], {honoursRoot: true}, function () {
+ doTestHorizontalizedScroll(kSettings[index], function() {
+ doTestZoom(kSettings[index], function() {
+ if (++index == kSettings.length) {
+ setDeltaMultiplierSettings(kSettings[0], function() {
+ doTestZoomedScroll(function() {
+ doTestWholeScroll(function() {
+ doTestActionOverride(function() {
+ finishTests();
+ });
+ });
});
});
- });
+ } else {
+ doTest();
+ }
});
- } else {
- doTest();
- }
+ });
});
});
});
});
}
doTest();
}