Bug 804486 - Tweak a few scrolling tests that makes the assumption that a horizontal "line" scroll scrolls the same amount of pixels as a vertical line scroll. r=roc

This commit is contained in:
Mats Palmgren 2012-10-29 06:44:31 +01:00
parent b23b6c84db
commit ab048c47bd
3 changed files with 147 additions and 149 deletions

View File

@ -8,7 +8,7 @@
</head>
<body>
<p id="display"></p>
<div id="scrollable" style="font-size: 16px; line-height: 1; overflow: auto; width: 200px; height: 200px;">
<div id="scrollable" style="font-family:monospace; font-size: 18px; line-height: 1; overflow: auto; width: 200px; height: 200px;">
<div id="scrolled" style="font-size: 64px; width: 5000px; height: 5000px;">
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
@ -51,6 +51,7 @@ var gScrollableElement = document.getElementById("scrollable");
var gScrolledElement = document.getElementById("scrolled");
var gLineHeight = 0;
var gHorizontalLine = 0;
var gPageHeight = 0;
var gPageWidth = 0;
@ -70,6 +71,13 @@ function prepareScrollUnits()
gLineHeight = result;
ok(gLineHeight > 10 && gLineHeight < 25, "prepareScrollUnits: gLineHeight may be illegal value, got " + gLineHeight);
result = -1;
synthesizeWheel(gScrollableElement, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gHorizontalLine = result;
ok(gHorizontalLine > 5 && gHorizontalLine < 16, "prepareScrollUnits: gHorizontalLine may be illegal value, got " + gHorizontalLine);
result = -1;
synthesizeWheel(gScrollableElement, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_PAGE,
@ -370,30 +378,12 @@ function testContinuousTrustedEvents()
deltaX: 5.3, deltaY: 0.0, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
horizontal: { expected: false, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Horizontal wheel event by pixels (5.3 - 0) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 5.3, deltaY: 0.0, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: 5.3, deltaY: 0.0, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Vertical wheel event by pixels (5.3 - 1) #1",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 0.0, deltaY: 5.3, deltaZ: 0.0, isMomentum: false,
@ -989,23 +979,6 @@ function testContinuousTrustedEvents()
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Pixel only device's horizontal wheel event by pixels (5.3 - 0) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 5.3, deltaY: 0.0, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: 5.3, deltaY: 0.0, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Pixel only device's horizontal wheel event by pixels (5.3 - 0) #4",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 5.3, deltaY: 0.0, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
@ -1022,7 +995,6 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Pixel only device's Vertical wheel event by pixels (5.3 - 0) #1",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 0.0, deltaY: 5.3, deltaZ: 0.0, isMomentum: false,
@ -1074,7 +1046,24 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 5 } }
},
{ description: "Pixel only device's Vertical wheel event by pixels (5.3 - 1) #4",
{ description: "Pixel only device's Vertical wheel event by pixels (5.3 - 0) #4",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 0.0, deltaY: 1.3, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: 0.0, deltaY: 1.3, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 1 } }
},
{ description: "Pixel only device's Vertical wheel event by pixels (5.3 - 1) #5",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 0.0, deltaY: 5.3, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
@ -1103,7 +1092,7 @@ function testContinuousTrustedEvents()
deltaX: -5.3, deltaY: 0.0, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
horizontal: { expected: false, preventDefault: false, detail: -1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -5 },
@ -1127,23 +1116,6 @@ function testContinuousTrustedEvents()
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Pixel only device's horizontal wheel event by pixels (-5.3 - 0) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -5.3, deltaY: 0.0, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: -5.3, deltaY: 0.0, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -5 },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Pixel only device's horizontal wheel event by pixels (-5.3 - 0) #4",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -5.3, deltaY: 0.0, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
@ -1212,7 +1184,24 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: -5 } }
},
{ description: "Pixel only device's Vertical wheel event by pixels (-5.3 - -1) #4",
{ description: "Pixel only device's Vertical wheel event by pixels (-5.3 - 0) #4",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 0.0, deltaY: -1.3, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: 0.0, deltaY: -1.3, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: -1 } }
},
{ description: "Pixel only device's Vertical wheel event by pixels (-5.3 - -1) #5",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 0.0, deltaY: -5.3, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
@ -1266,23 +1255,6 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: true, preventDefault: false, detail: 4 } }
},
{ description: "Pixel only device's bottom-right wheel event by pixels (5.3/4.9 - 0/0) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 5.3, deltaY: 4.9, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: 5.3, deltaY: 4.9, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: true, preventDefault: false, detail: 4 } }
},
{ description: "Pixel only device's bottom-left wheel event by pixels (-5.3/4.9 - 0/0) #4",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -5.3, deltaY: 4.9, deltaZ: 0.0, isMomentum: false,
@ -1295,7 +1267,7 @@ function testContinuousTrustedEvents()
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -5 },
vertical: { expected: true, preventDefault: false, detail: 4 } }
@ -1303,20 +1275,20 @@ function testContinuousTrustedEvents()
// the accumulated X should be 0 here, but Y shouldn't be reset.
{ description: "Pixel only device's bottom-right wheel event by pixels (5.3/4.9 - 0/0) #5",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 5.3, deltaY: 4.9, deltaZ: 0.0, isMomentum: false,
deltaX: 5.3, deltaY: 1.9, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: 5.3, deltaY: 4.9, deltaZ: 0.0
deltaX: 5.3, deltaY: 1.9, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: 5 },
vertical: { expected: true, preventDefault: false, detail: 4 } }
vertical: { expected: true, preventDefault: false, detail: 1 } }
},
{ description: "Pixel only device's top-left wheel event by pixels (-5.3/-4.9 - 0/0) #1",
@ -1353,24 +1325,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: -5 },
vertical: { expected: true, preventDefault: false, detail: -4 } }
},
{ description: "Pixel only device's top-left wheel event by pixels (-5.3/-4.9 - 0/0) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -5.3, deltaY: -4.9, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: -5.3, deltaY: -4.9, deltaZ: 0.0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -5 },
vertical: { expected: true, preventDefault: false, detail: -4 } }
},
{ description: "Pixel only device's bottom-left wheel event by pixels (5.3/-4.9 - 0/0) #4",
{ description: "Pixel only device's bottom-left wheel event by pixels (-5.3/4.9 - 0/0) #4",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -5.3, deltaY: 4.9, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
@ -1388,7 +1343,7 @@ function testContinuousTrustedEvents()
vertical: { expected: true, preventDefault: false, detail: 4 } }
},
// the accumulated Y should be 0 here, but X shouldn't be reset.
{ description: "Pixel only device's top-left wheel event by pixels (5.3/4.9 - 0/0) #5",
{ description: "Pixel only device's top-left wheel event by pixels (-5.3/-4.9 - 0/0) #5",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -5.3, deltaY: -4.9, deltaZ: 0.0, isMomentum: false,
lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isPixelOnlyDevice: true,
@ -1421,7 +1376,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: gHorizontalLine },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Simple horizontal wheel event by lines (1.0 - 1) #2",
@ -1438,7 +1393,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: gHorizontalLine },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
@ -1456,7 +1411,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: -1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: -gHorizontalLine },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "Simple horizontal wheel event by lines (-1.0 - -1) #2",
@ -1473,7 +1428,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: -1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: -gHorizontalLine },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
@ -1562,7 +1517,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 3) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 3) },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "High resolution horizontal wheel event by lines (0.333... - 0) #2",
@ -1579,7 +1534,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 3) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 3) },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "High resolution horizontal wheel event by lines (0.333... - 1) #3",
@ -1596,7 +1551,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 3) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 3) },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
@ -1614,7 +1569,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -Math.floor(gLineHeight / 3) },
horizontal: { expected: true, preventDefault: false, detail: -Math.floor(gHorizontalLine / 3) },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "High resolution horizontal wheel event by lines (-0.333... - 0) #2",
@ -1631,7 +1586,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -Math.floor(gLineHeight / 3) },
horizontal: { expected: true, preventDefault: false, detail: -Math.floor(gHorizontalLine / 3) },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
{ description: "High resolution horizontal wheel event by lines (-0.333... - -1) #3",
@ -1648,7 +1603,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: -1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -Math.floor(gLineHeight / 3) },
horizontal: { expected: true, preventDefault: false, detail: -Math.floor(gHorizontalLine / 3) },
vertical: { expected: false, preventDefault: false, detail: 0 } }
},
@ -1771,7 +1726,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: -1 },
vertical: { expected: true, preventDefault: false, detail: 2 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: -gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: -gHorizontalLine },
vertical: { expected: true, preventDefault: false, detail: gLineHeight * 2 } }
},
@ -1789,7 +1744,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: -2 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: false, detail: -gLineHeight * 2 } }
},
@ -1807,7 +1762,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 3) } }
},
{ description: "High resolution oblique wheel event by lines (0.5/0.333.../-0.8 - 1/0) #2",
@ -1824,7 +1779,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 3) } }
},
{ description: "High resolution oblique wheel event by lines (0.5/0.333.../-0.8 - 0/1) #3",
@ -1841,7 +1796,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 3) } }
},
@ -2316,7 +2271,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: true, detail: 1 },
vertical: { expected: true, preventDefault: true, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: true, detail: gLineHeight },
horizontal: { expected: true, preventDefault: true, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: true, detail: gLineHeight } },
},
{ description: "preventDefault() shouldn't prevent other legacy events (page)",
@ -2422,7 +2377,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: true, detail: gLineHeight },
horizontal: { expected: true, preventDefault: true, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: true, detail: gLineHeight } },
},
{ description: "modifier key tests (shift, page)",
@ -2474,7 +2429,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: true, detail: gLineHeight },
horizontal: { expected: true, preventDefault: true, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: true, detail: gLineHeight } },
},
{ description: "modifier key tests (ctrl, page)",
@ -2526,7 +2481,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: true, detail: gLineHeight },
horizontal: { expected: true, preventDefault: true, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: true, detail: gLineHeight } },
},
{ description: "modifier key tests (alt, page)",
@ -2578,7 +2533,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: true, detail: gLineHeight },
horizontal: { expected: true, preventDefault: true, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: true, detail: gLineHeight } },
},
{ description: "modifier key tests (meta, page)",
@ -2648,7 +2603,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: false, detail: gLineHeight } },
},
{ description: "Momentum scroll should cause legacy events (line, momentum)",
@ -2665,7 +2620,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: gLineHeight },
horizontal: { expected: true, preventDefault: false, detail: gHorizontalLine },
vertical: { expected: true, preventDefault: false, detail: gLineHeight } },
},
{ description: "Momentum scroll should cause legacy events (page, not momentum)",
@ -2710,53 +2665,53 @@ function testContinuousTrustedEvents()
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_y", 300);
},
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: gLineHeight / 4, deltaY: gLineHeight / 8, deltaZ: 0,
deltaX: gHorizontalLine / 4, deltaY: gLineHeight / 8, deltaZ: 0,
lineOrPageDeltaX: 3, lineOrPageDeltaY: 5, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: gLineHeight / 4 * 2, deltaY: gLineHeight / 8 * 3, deltaZ: 0
deltaX: gHorizontalLine / 4 * 2, deltaY: gLineHeight / 8 * 3, deltaZ: 0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 4 * 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine / 4 * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight / 8 * 3) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (pixel) #2",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: gLineHeight / 4 + 1, deltaY: gLineHeight / 8 + 1, deltaZ: 0,
deltaX: gHorizontalLine / 4 + 1, deltaY: gLineHeight / 8 + 1, deltaZ: 0,
lineOrPageDeltaX: 3, lineOrPageDeltaY: 5, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: (gLineHeight / 4 + 1) * 2, deltaY: (gLineHeight / 8 + 1) * 3, deltaZ: 0
deltaX: (gHorizontalLine / 4 + 1) * 2, deltaY: (gLineHeight / 8 + 1) * 3, deltaZ: 0
},
DOMMouseScroll: {
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor((gLineHeight / 4 + 1) * 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor((gHorizontalLine / 4 + 1) * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor((gLineHeight / 8 + 1) * 3) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (pixel) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: gLineHeight / 4 + 1, deltaY: gLineHeight / 8 + 1, deltaZ: 0,
deltaX: gHorizontalLine / 4 + 1, deltaY: gLineHeight / 8 + 1, deltaZ: 0,
lineOrPageDeltaX: 3, lineOrPageDeltaY: 5, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: (gLineHeight / 4 + 1) * 2, deltaY: (gLineHeight / 8 + 1) * 3, deltaZ: 0
deltaX: (gHorizontalLine / 4 + 1) * 2, deltaY: (gLineHeight / 8 + 1) * 3, deltaZ: 0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor((gLineHeight / 4 + 1) * 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor((gHorizontalLine / 4 + 1) * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor((gLineHeight / 8 + 1) * 3) } },
finished: function () {
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", 100);
@ -2770,53 +2725,53 @@ function testContinuousTrustedEvents()
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_y", 300);
},
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -gLineHeight / 4, deltaY: -gLineHeight / 8, deltaZ: 0,
deltaX: -gHorizontalLine / 4, deltaY: -gLineHeight / 8, deltaZ: 0,
lineOrPageDeltaX: -3, lineOrPageDeltaY: -5, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: -gLineHeight / 4 * 2, deltaY: -gLineHeight / 8 * 3, deltaZ: 0
deltaX: -gHorizontalLine / 4 * 2, deltaY: -gLineHeight / 8 * 3, deltaZ: 0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-gLineHeight / 4 * 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-gHorizontalLine / 4 * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.ceil(-gLineHeight / 8 * 3) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (pixel, negative, shift) #2",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -(gLineHeight / 4 + 1), deltaY: -(gLineHeight / 8 + 1), deltaZ: 0,
deltaX: -(gHorizontalLine / 4 + 1), deltaY: -(gLineHeight / 8 + 1), deltaZ: 0,
lineOrPageDeltaX: -3, lineOrPageDeltaY: -5, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: -(gLineHeight / 4 + 1) * 2, deltaY: -(gLineHeight / 8 + 1) * 3, deltaZ: 0
deltaX: -(gHorizontalLine / 4 + 1) * 2, deltaY: -(gLineHeight / 8 + 1) * 3, deltaZ: 0
},
DOMMouseScroll: {
horizontal: { expected: true, preventDefault: false, detail: -1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-(gLineHeight / 4 + 1) * 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-(gHorizontalLine / 4 + 1) * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.ceil(-(gLineHeight / 8 + 1) * 3) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (pixel, negative, shift) #3",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -(gLineHeight / 4 + 1), deltaY: -(gLineHeight / 8 + 1), deltaZ: 0,
deltaX: -(gHorizontalLine / 4 + 1), deltaY: -(gLineHeight / 8 + 1), deltaZ: 0,
lineOrPageDeltaX: 3, lineOrPageDeltaY: 5, isPixelOnlyDevice: false,
isCustomizedByPrefs: false,
shiftKey: true, ctrlKey: false, altKey: false, metaKey: false },
wheel: {
expected: true, preventDefault: false,
deltaX: -(gLineHeight / 4 + 1) * 2, deltaY: -(gLineHeight / 8 + 1) * 3, deltaZ: 0
deltaX: -(gHorizontalLine / 4 + 1) * 2, deltaY: -(gLineHeight / 8 + 1) * 3, deltaZ: 0
},
DOMMouseScroll: {
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: -1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-(gLineHeight / 4 + 1) * 2) },
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-(gHorizontalLine / 4 + 1) * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.ceil(-(gLineHeight / 8 + 1) * 3) } },
finished: function () {
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_x", 100);
@ -2842,7 +2797,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.6) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine * 0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (line) #2",
@ -2859,7 +2814,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: 1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.6) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine * 0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (line) #3",
@ -2876,7 +2831,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.6) },
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine * 0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
finished: function () {
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", 100);
@ -2902,7 +2857,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gLineHeight * -0.6) },
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gHorizontalLine * -0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (line, negative) #2",
@ -2919,7 +2874,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: true, preventDefault: false, detail: -1 },
vertical: { expected: false, preventDefault: false, detail: 0 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gLineHeight * -0.6) },
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gHorizontalLine * -0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
},
{ description: "lineOrPageDelta should be recomputed by ESM (line, negative) #3",
@ -2936,7 +2891,7 @@ function testContinuousTrustedEvents()
horizontal: { expected: false, preventDefault: false, detail: 0 },
vertical: { expected: true, preventDefault: false, detail: 1 } },
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gLineHeight * -0.6) },
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gHorizontalLine * -0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
finished: function () {
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", 100);

View File

@ -8,7 +8,7 @@
</head>
<body>
<p id="display"></p>
<div id="scrollable" style="font-size: 16px; line-height: 1; overflow: auto; width: 200px; height: 200px;">
<div id="scrollable" style="font-family: monospace; font-size: 16px; line-height: 1; overflow: auto; width: 200px; height: 200px;">
<div id="scrolled" style="font-size: 64px; width: 5000px; height: 5000px;">
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text. Tere is a lot of text.<br>
@ -51,6 +51,7 @@ var gScrollableElement = document.getElementById("scrollable");
var gScrolledElement = document.getElementById("scrolled");
var gLineHeight = 0;
var gHorizontalLine = 0;
var gPageHeight = 0;
var gPageWidth = 0;
@ -70,6 +71,13 @@ function prepareScrollUnits()
gLineHeight = result;
ok(gLineHeight > 10 && gLineHeight < 25, "prepareScrollUnits: gLineHeight may be illegal value, got " + gLineHeight);
result = -1;
synthesizeWheel(gScrollableElement, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gHorizontalLine = result;
ok(gHorizontalLine > 5 && gHorizontalLine < 16, "prepareScrollUnits: gHorizontalLine may be illegal value, got " + gHorizontalLine);
result = -1;
synthesizeWheel(gScrollableElement, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_PAGE,
@ -160,13 +168,13 @@ function testDeltaMultiplierPrefs()
// use test_continuous_dom_wheel_event.html.
const kEvents = [
{ deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: gLineHeight, deltaY: gLineHeight, deltaZ: gLineHeight, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
deltaX: gHorizontalLine, deltaY: gLineHeight, deltaZ: gLineHeight, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
{ deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
{ deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: -gLineHeight, deltaY: -gLineHeight, deltaZ: -gLineHeight, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
deltaX: -gHorizontalLine, deltaY: -gLineHeight, deltaZ: -gLineHeight, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: -1.0, deltaZ: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
{ deltaMode: WheelEvent.DOM_DELTA_PAGE,
@ -239,7 +247,7 @@ function testDeltaMultiplierPrefs()
expectedDetail = isHorizontal ? currentEvent.deltaX : currentEvent.deltaY;
if (expectedDetail) {
if (currentEvent.deltaMode == WheelEvent.DOM_DELTA_LINE) {
expectedDetail *= gLineHeight;
expectedDetail *= (isHorizontal ? gHorizontalLine : gLineHeight);
} else if (currentEvent.deltaMode == WheelEvent.DOM_DELTA_PAGE) {
if (expectedDetail > 0) {
expectedDetail = (isHorizontal ? gPageWidth : gPageHeight);

View File

@ -96,6 +96,41 @@ function prepareScrollUnits()
gRoot.wheelLineHeight = result;
ok(result > 10 && result < gScrollable32.wheelLineHeight, "prepareScrollUnits: gRoot.wheelLineHeight may be illegal value, got " + result);
result = -1;
synthesizeWheel(gScrollable128, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gScrollable128.wheelHorizontalLine = result;
ok(result > 50 && result < 200, "prepareScrollUnits: gScrollable128.wheelHorizontalLine may be illegal value, got " + result);
result = -1;
synthesizeWheel(gScrollable96, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gScrollable96.wheelHorizontalLine = result;
ok(result > 30 && result < gScrollable128.wheelHorizontalLine, "prepareScrollUnits: gScrollable96.wheelHorizontalLine may be illegal value, got " + result);
result = -1;
synthesizeWheel(gScrollable64, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gScrollable64.wheelHorizontalLine = result;
ok(result > 20 && result < gScrollable96.wheelHorizontalLine, "prepareScrollUnits: gScrollable64.wheelHorizontalLine may be illegal value, got " + result);
result = -1;
synthesizeWheel(gScrollable32, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gScrollable32.wheelHorizontalLine = result;
ok(result > 12 && result < gScrollable64.wheelHorizontalLine, "prepareScrollUnits: gScrollable32.wheelHorizontalLine may be illegal value, got " + result);
result = -1;
synthesizeWheel(gRoot, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, lineOrPageDeltaX: 1 });
gRoot.wheelHorizontalLine = result;
ok(result > 5 && result < gScrollable32.wheelHorizontalLine, "prepareScrollUnits: gRoot.wheelHorizontalLine may be illegal value, got " + result);
result = -1;
synthesizeWheel(gScrollable128, 10, 10,
{ deltaMode: WheelEvent.DOM_DELTA_PAGE,
@ -1229,7 +1264,7 @@ function doTests()
var expectedDetail =
(currentTest.event.deltaMode == WheelEvent.DOM_DELTA_LINE) ?
(isHorizontal ? currentTest.expected.x.wheelLineHeight :
(isHorizontal ? currentTest.expected.x.wheelHorizontalLine :
currentTest.expected.y.wheelLineHeight) :
(isHorizontal ? currentTest.expected.x.wheelPageWidth :
currentTest.expected.y.wheelPageHeight);