mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 20:22:00 +00:00
Bug 786898 part.2 Add overflow delta value tests r=smaug, sr=smaug
This commit is contained in:
parent
8819e0f580
commit
36a101bd0d
@ -40,6 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="spacerForBody"></div>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
@ -50,6 +51,7 @@ SimpleTest.waitForFocus(runTests, window);
|
||||
|
||||
var gScrollableElement = document.getElementById("scrollable");
|
||||
var gScrolledElement = document.getElementById("scrolled");
|
||||
var gSpacerForBodyElement = document.getElementById("spacerForBody");
|
||||
|
||||
function is()
|
||||
{
|
||||
@ -105,78 +107,91 @@ function doTestScroll(aSettings, aCallback)
|
||||
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 },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to bottom by pixel scroll when lineOrPageDelta is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to top by pixel scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to top by pixel scroll when lineOrPageDelta is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to right by pixel scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to right by pixel scroll when lineOrPageDelta is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to left by pixel scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to left by pixel scroll when lineOrPageDelta is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to bottom-right by pixel scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollRight },
|
||||
{ description: "Scroll to bottom-left by pixel scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollLeft },
|
||||
{ description: "Scroll to top-left by pixel scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollLeft },
|
||||
{ description: "Scroll to top-right by pixel scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollRight },
|
||||
{ description: "Not Scroll by pixel scroll for z",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
|
||||
@ -184,78 +199,91 @@ function doTestScroll(aSettings, aCallback)
|
||||
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 },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to bottom by line scroll when lineOrPageDelta is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to top by line scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to top by line scroll when lineOrPageDelta is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to right by line scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to right by line scroll when lineOrPageDelta is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to left by line scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to left by line scroll when lineOrPageDelta is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to bottom-right by line scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollRight },
|
||||
{ description: "Scroll to bottom-left by line scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollLeft },
|
||||
{ description: "Scroll to top-left by line scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollLeft },
|
||||
{ description: "Scroll to top-right by line scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollRight },
|
||||
{ description: "Not Scroll by line scroll for z",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
|
||||
@ -263,78 +291,91 @@ function doTestScroll(aSettings, aCallback)
|
||||
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 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,
|
||||
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,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to right by page scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to right by page scroll when lineOrPageDelta is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to left by page scroll even if lineOrPageDelta is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to left by page scroll when lineOrPageDelta is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to bottom-right by page scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollRight },
|
||||
{ description: "Scroll to bottom-left by page scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollLeft },
|
||||
{ description: "Scroll to top-left by page scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollLeft },
|
||||
{ description: "Scroll to top-right by page scroll",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollRight },
|
||||
{ description: "Not Scroll by page scroll for z",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
|
||||
@ -346,84 +387,98 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 1, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is -1, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 1, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is -1, even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to bottom-right by momentum pixel scroll even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollRight },
|
||||
{ description: "Scroll to bottom-left by momentum pixel scroll even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollLeft },
|
||||
{ description: "Scroll to top-left by momentum pixel scroll even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollLeft },
|
||||
{ description: "Scroll to top-right by momentum pixel scroll even if the action is zoom",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollRight },
|
||||
{ description: "Not Scroll by momentum pixel scroll for z (action is zoom)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
{ description: "Not Scroll by momentum pixel scroll if default action is none (action is zoom)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll,
|
||||
prepare: function () { SpecialPowers.setIntPref("mousewheel.default.action", 0); },
|
||||
@ -435,94 +490,109 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 1, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is -1, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 1, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is -1, even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to bottom-right by momentum pixel scroll even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollRight },
|
||||
{ description: "Scroll to bottom-left by momentum pixel scroll even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown | kScrollLeft },
|
||||
{ description: "Scroll to top-left by momentum pixel scroll even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollLeft },
|
||||
{ description: "Scroll to top-right by momentum pixel scroll even if the action is history",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp | kScrollRight },
|
||||
{ description: "Not Scroll by momentum pixel scroll for z (action is history)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
{ description: "Not Scroll by momentum pixel scroll if default action is none (action is history)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll,
|
||||
prepare: function () { SpecialPowers.setIntPref("mousewheel.default.action", 0); },
|
||||
cleanup: function () { SpecialPowers.setIntPref("mousewheel.default.action", 1); } },
|
||||
|
||||
// Don't scroll around axis whose overflow style is hidden.
|
||||
// Don't scroll along axis whose overflow style is hidden.
|
||||
{ description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown,
|
||||
prepare: function() { gScrollableElement.style.overflowX = "hidden"; } },
|
||||
@ -530,30 +600,35 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to only bottom by oblique page wheel event with overflow-x: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to only top by oblique pixel wheel event with overflow-x: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to only top by oblique line wheel event with overflow-x: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to only top by oblique page wheel event with overflow-x: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp,
|
||||
cleanup: function () { gScrollableElement.style.overflowX = "auto"; } },
|
||||
@ -561,6 +636,7 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight,
|
||||
prepare: function() { gScrollableElement.style.overflowY = "hidden"; } },
|
||||
@ -568,30 +644,35 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to only right by oblique page wheel event with overflow-y: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to only left by oblique pixel wheel event with overflow-y: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to only top by oblique line wheel event with overflow-y: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to only top by oblique page wheel event with overflow-y: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft,
|
||||
cleanup: function () { gScrollableElement.style.overflowY = "auto"; } },
|
||||
@ -599,6 +680,7 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll,
|
||||
prepare: function() { gScrollableElement.style.overflow = "hidden"; } },
|
||||
@ -606,33 +688,143 @@ function doTestScroll(aSettings, aCallback)
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
{ description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
{ description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
{ description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll },
|
||||
{ description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kNoScroll,
|
||||
cleanup: function () { gScrollableElement.style.overflow = "auto"; } },
|
||||
|
||||
// Don't scroll along axis whose overflow style is hidden and overflow delta values should
|
||||
// be zero if there is ancestor scrollable element.
|
||||
{ description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown,
|
||||
prepare: function() {
|
||||
gScrollableElement.style.overflowX = "hidden";
|
||||
gScrollableElement.style.position = "fixed";
|
||||
gScrollableElement.style.top = "30px";
|
||||
gScrollableElement.style.left = "30px";
|
||||
// Make body element scrollable.
|
||||
gSpacerForBodyElement.style.width = "5000px";
|
||||
gSpacerForBodyElement.style.height = "5000px";
|
||||
document.documentElement.scrollTop = 500;
|
||||
document.documentElement.scrollLeft = 500;
|
||||
} },
|
||||
{ description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to only bottom by oblique page wheel event with overflow-x: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollDown },
|
||||
{ description: "Scroll to only top by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to only top by oblique line wheel event with overflow-x: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp },
|
||||
{ description: "Scroll to only top by oblique page wheel event with overflow-x: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollUp,
|
||||
cleanup: function () { gScrollableElement.style.overflowX = "auto"; } },
|
||||
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight,
|
||||
prepare: function() { gScrollableElement.style.overflowY = "hidden"; } },
|
||||
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to only right by oblique page wheel event with overflow-y: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollRight },
|
||||
{ description: "Scroll to only left by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to only top by oblique line wheel event with overflow-y: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft },
|
||||
{ description: "Scroll to only top by oblique page wheel event with overflow-y: hidden (body is scrollable)",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
|
||||
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
|
||||
expected: kScrollLeft,
|
||||
cleanup: function () {
|
||||
gScrollableElement.style.overflowY = "auto";
|
||||
gScrollableElement.style.position = "static";
|
||||
gSpacerForBodyElement.style.width = "";
|
||||
gSpacerForBodyElement.style.height = "";
|
||||
} },
|
||||
];
|
||||
|
||||
var description;
|
||||
@ -714,139 +906,166 @@ function doTestZoom(aSettings, aCallback)
|
||||
{ description: "by vertical/positive pixel event when its lineOrPageDeltaY is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by vertical/positive pixel event when its lineOrPageDeltaY is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kPositive | kUseY },
|
||||
{ description: "by vertical/negative pixel event when its lineOrPageDeltaY is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by vertical/negative pixel event when its lineOrPageDeltaY is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNegative | kUseY },
|
||||
{ description: "by horizotal/positive pixel event when its lineOrPageDeltaX is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by horizotal/positive pixel event when its lineOrPageDeltaX is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kPositive | kUseX },
|
||||
{ description: "by horizotal/negative pixel event when its lineOrPageDeltaX is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by horizotal/negative pixel event when its lineOrPageDeltaX is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNegative | kUseX },
|
||||
{ description: "by z pixel event",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 16.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
|
||||
{ description: "by vertical/positive line event when its lineOrPageDeltaY is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by vertical/positive line event when its lineOrPageDeltaY is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kPositive | kUseY },
|
||||
{ description: "by vertical/negative line event when its lineOrPageDeltaY is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by vertical/negative line event when its lineOrPageDeltaY is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNegative | kUseY },
|
||||
{ description: "by horizotal/positive line event when its lineOrPageDeltaX is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by horizotal/positive line event when its lineOrPageDeltaX is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kPositive | kUseX },
|
||||
{ description: "by horizotal/negative line event when its lineOrPageDeltaX is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by horizotal/negative line event when its lineOrPageDeltaX is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNegative | kUseX },
|
||||
{ description: "by z line event",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
|
||||
{ description: "by vertical/positive page event when its lineOrPageDeltaY is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by vertical/positive page event when its lineOrPageDeltaY is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kPositive | kUseY },
|
||||
{ description: "by vertical/negative page event when its lineOrPageDeltaY is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by vertical/negative page event when its lineOrPageDeltaY is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNegative | kUseY },
|
||||
{ description: "by horizotal/positive page event when its lineOrPageDeltaX is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by horizotal/positive page event when its lineOrPageDeltaX is 1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kPositive | kUseX },
|
||||
{ description: "by horizotal/negative page event when its lineOrPageDeltaX is 0",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
{ description: "by horizotal/negative page event when its lineOrPageDeltaX is -1",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNegative | kUseX },
|
||||
{ description: "by z page event",
|
||||
event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
|
||||
deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
|
||||
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
|
||||
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
|
||||
expected: kNone },
|
||||
];
|
||||
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "sampler.h"
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsIDOMFileHandle.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -641,7 +642,48 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
|
||||
nsEventStatus status;
|
||||
nsresult rv = widget->DispatchEvent(&wheelEvent, status);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
|
||||
bool failedX = false;
|
||||
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO) &&
|
||||
wheelEvent.overflowDeltaX != 0) {
|
||||
failedX = true;
|
||||
}
|
||||
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE) &&
|
||||
wheelEvent.overflowDeltaX <= 0) {
|
||||
failedX = true;
|
||||
}
|
||||
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE) &&
|
||||
wheelEvent.overflowDeltaX >= 0) {
|
||||
failedX = true;
|
||||
}
|
||||
bool failedY = false;
|
||||
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO) &&
|
||||
wheelEvent.overflowDeltaY != 0) {
|
||||
failedY = true;
|
||||
}
|
||||
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE) &&
|
||||
wheelEvent.overflowDeltaY <= 0) {
|
||||
failedY = true;
|
||||
}
|
||||
if ((aOptions & WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE) &&
|
||||
wheelEvent.overflowDeltaY >= 0) {
|
||||
failedY = true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (failedX) {
|
||||
nsPrintfCString debugMsg("SendWheelEvent(): unexpected overflowDeltaX: %f",
|
||||
wheelEvent.overflowDeltaX);
|
||||
NS_WARNING(debugMsg.get());
|
||||
}
|
||||
if (failedY) {
|
||||
nsPrintfCString debugMsg("SendWheelEvent(): unexpected overflowDeltaY: %f",
|
||||
wheelEvent.overflowDeltaY);
|
||||
NS_WARNING(debugMsg.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
return (!failedX && !failedY) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -317,6 +317,14 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
const unsigned long WHEEL_EVENT_CAUSED_BY_PIXEL_ONLY_DEVICE = 0x0001;
|
||||
const unsigned long WHEEL_EVENT_CAUSED_BY_MOMENTUM = 0x0002;
|
||||
const unsigned long WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS = 0x0004;
|
||||
// If any of the following flags is specified this method will throw an
|
||||
// exception in case the relevant overflowDelta has an unexpected value.
|
||||
const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO = 0x0010;
|
||||
const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE = 0x0020;
|
||||
const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE = 0x0040;
|
||||
const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO = 0x0100;
|
||||
const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE = 0x0200;
|
||||
const unsigned long WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE = 0x0400;
|
||||
void sendWheelEvent(in float aX,
|
||||
in float aY,
|
||||
in double aDeltaX,
|
||||
|
@ -257,10 +257,13 @@ function synthesizeTouchAtCenter(aTarget, aEvent, aWindow)
|
||||
* aEvent is an object which may contain the properties:
|
||||
* shiftKey, ctrlKey, altKey, metaKey, accessKey, deltaX, deltaY, deltaZ,
|
||||
* deltaMode, lineOrPageDeltaX, lineOrPageDeltaY, isMomentum, isPixelOnlyDevice,
|
||||
* isCustomizedByPrefs
|
||||
* isCustomizedByPrefs, expectedOverflowDeltaX, expectedOverflowDeltaY
|
||||
*
|
||||
* deltaMode must be defined, others are ok even if undefined.
|
||||
*
|
||||
* expectedOverflowDeltaX and expectedOverflowDeltaY take integer value. The
|
||||
* value is just checked as 0 or positive or negative.
|
||||
*
|
||||
* aWindow is optional, and defaults to the current window object.
|
||||
*/
|
||||
function synthesizeWheel(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
|
||||
@ -282,6 +285,24 @@ function synthesizeWheel(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
|
||||
if (aEvent.isCustomizedByPrefs) {
|
||||
options |= utils.WHEEL_EVENT_CUSTOMIZED_BY_USER_PREFS;
|
||||
}
|
||||
if (typeof aEvent.expectedOverflowDeltaX !== "undefined") {
|
||||
if (aEvent.expectedOverflowDeltaX === 0) {
|
||||
options |= utils.WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_ZERO;
|
||||
} else if (aEvent.expectedOverflowDeltaX > 0) {
|
||||
options |= utils.WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_POSITIVE;
|
||||
} else {
|
||||
options |= utils.WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_X_NEGATIVE;
|
||||
}
|
||||
}
|
||||
if (typeof aEvent.expectedOverflowDeltaY !== "undefined") {
|
||||
if (aEvent.expectedOverflowDeltaY === 0) {
|
||||
options |= utils.WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_ZERO;
|
||||
} else if (aEvent.expectedOverflowDeltaY > 0) {
|
||||
options |= utils.WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_POSITIVE;
|
||||
} else {
|
||||
options |= utils.WHEEL_EVENT_EXPECTED_OVERFLOW_DELTA_Y_NEGATIVE;
|
||||
}
|
||||
}
|
||||
var isPixelOnlyDevice =
|
||||
aEvent.isPixelOnlyDevice && aEvent.deltaMode == WheelEvent.DOM_DELTA_PIXEL;
|
||||
var lineOrPageDeltaX =
|
||||
|
Loading…
x
Reference in New Issue
Block a user