1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/events/test/test_moz_mouse_pixel_scroll_event.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,1348 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test for MozMousePixelScroll events</title> 1.8 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.11 + <style> 1.12 + .scrollable { 1.13 + overflow: auto; 1.14 + line-height: 1; 1.15 + margin: 15px; 1.16 + } 1.17 + .scrollable > div { 1.18 + width: 1000px; 1.19 + height: 1000px; 1.20 + font-size: 1000px; 1.21 + line-height: 1; 1.22 + } 1.23 + </style> 1.24 +</head> 1.25 +<body> 1.26 +<p id="display"></p> 1.27 +<div id="Scrollable128" class="scrollable" style="font-size: 128px; width: 100px; height: 100px;"> 1.28 + <div> 1.29 + <div id="Scrollable96" class="scrollable" style="font-size: 96px; width: 150px; height: 150px;"> 1.30 + <div> 1.31 + <div id="Scrollable64" class="scrollable" style="font-size: 64px; width: 200px; height: 200px;"> 1.32 + <div> 1.33 + </div> 1.34 + </div> 1.35 + </div> 1.36 + </div> 1.37 + </div> 1.38 +</div> 1.39 +<div id="Scrollable32" class="scrollable" style="font-size: 32px; width: 50px; height: 50px;"> 1.40 + <div> 1.41 + </div> 1.42 +</div> 1.43 +<div id="content" style="display: none"> 1.44 + 1.45 +</div> 1.46 +<pre id="test"> 1.47 +<script type="application/javascript"> 1.48 + 1.49 +SimpleTest.waitForExplicitFinish(); 1.50 +SimpleTest.waitForFocus(runTests, window); 1.51 + 1.52 +var gScrollable128 = document.getElementById("Scrollable128"); 1.53 +var gScrollable96 = document.getElementById("Scrollable96"); 1.54 +var gScrollable64 = document.getElementById("Scrollable64"); 1.55 +var gScrollable32 = document.getElementById("Scrollable32"); 1.56 +var gRoot = document.documentElement; 1.57 + 1.58 +function prepareScrollUnits() 1.59 +{ 1.60 + var result = -1; 1.61 + function handler(aEvent) 1.62 + { 1.63 + result = aEvent.detail; 1.64 + aEvent.preventDefault(); 1.65 + } 1.66 + window.addEventListener("MozMousePixelScroll", handler, true); 1.67 + 1.68 + synthesizeWheel(gScrollable128, 10, 10, 1.69 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.70 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.71 + gScrollable128.wheelLineHeight = result; 1.72 + ok(result > 96 && result < 200, "prepareScrollUnits: gScrollable128.wheelLineHeight may be illegal value, got " + result); 1.73 + 1.74 + result = -1; 1.75 + synthesizeWheel(gScrollable96, 10, 10, 1.76 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.77 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.78 + gScrollable96.wheelLineHeight = result; 1.79 + ok(result > 64 && result < gScrollable128.wheelLineHeight, "prepareScrollUnits: gScrollable96.wheelLineHeight may be illegal value, got " + result); 1.80 + 1.81 + result = -1; 1.82 + synthesizeWheel(gScrollable64, 10, 10, 1.83 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.84 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.85 + gScrollable64.wheelLineHeight = result; 1.86 + ok(result > 32 && result < gScrollable96.wheelLineHeight, "prepareScrollUnits: gScrollable64.wheelLineHeight may be illegal value, got " + result); 1.87 + 1.88 + result = -1; 1.89 + synthesizeWheel(gScrollable32, 10, 10, 1.90 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.91 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.92 + gScrollable32.wheelLineHeight = result; 1.93 + ok(result > 16 && result < gScrollable64.wheelLineHeight, "prepareScrollUnits: gScrollable32.wheelLineHeight may be illegal value, got " + result); 1.94 + 1.95 + result = -1; 1.96 + synthesizeWheel(gRoot, 10, 10, 1.97 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.98 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.99 + gRoot.wheelLineHeight = result; 1.100 + ok(result > 10 && result < gScrollable32.wheelLineHeight, "prepareScrollUnits: gRoot.wheelLineHeight may be illegal value, got " + result); 1.101 + 1.102 + result = -1; 1.103 + synthesizeWheel(gScrollable128, 10, 10, 1.104 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.105 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.106 + gScrollable128.wheelHorizontalLine = result; 1.107 + ok(result > 50 && result < 200, "prepareScrollUnits: gScrollable128.wheelHorizontalLine may be illegal value, got " + result); 1.108 + 1.109 + result = -1; 1.110 + synthesizeWheel(gScrollable96, 10, 10, 1.111 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.112 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.113 + gScrollable96.wheelHorizontalLine = result; 1.114 + ok(result > 30 && result < gScrollable128.wheelHorizontalLine, "prepareScrollUnits: gScrollable96.wheelHorizontalLine may be illegal value, got " + result); 1.115 + 1.116 + result = -1; 1.117 + synthesizeWheel(gScrollable64, 10, 10, 1.118 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.119 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.120 + gScrollable64.wheelHorizontalLine = result; 1.121 + ok(result > 20 && result < gScrollable96.wheelHorizontalLine, "prepareScrollUnits: gScrollable64.wheelHorizontalLine may be illegal value, got " + result); 1.122 + 1.123 + result = -1; 1.124 + synthesizeWheel(gScrollable32, 10, 10, 1.125 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.126 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.127 + gScrollable32.wheelHorizontalLine = result; 1.128 + ok(result > 12 && result < gScrollable64.wheelHorizontalLine, "prepareScrollUnits: gScrollable32.wheelHorizontalLine may be illegal value, got " + result); 1.129 + 1.130 + result = -1; 1.131 + synthesizeWheel(gRoot, 10, 10, 1.132 + { deltaMode: WheelEvent.DOM_DELTA_LINE, 1.133 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.134 + gRoot.wheelHorizontalLine = result; 1.135 + ok(result > 5 && result < gScrollable32.wheelHorizontalLine, "prepareScrollUnits: gRoot.wheelHorizontalLine may be illegal value, got " + result); 1.136 + 1.137 + result = -1; 1.138 + synthesizeWheel(gScrollable128, 10, 10, 1.139 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.140 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.141 + gScrollable128.wheelPageHeight = result; 1.142 + ok(result >= (100 - gScrollable128.wheelLineHeight * 2) && result <= 100, 1.143 + "prepareScrollUnits: gScrollable128.wheelLineHeight is strange value, got " + result); 1.144 + 1.145 + result = -1; 1.146 + synthesizeWheel(gScrollable96, 10, 10, 1.147 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.148 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.149 + gScrollable96.wheelPageHeight = result; 1.150 + ok(result >= (150 - gScrollable96.wheelLineHeight * 2) && result <= 150, 1.151 + "prepareScrollUnits: gScrollable96.wheelLineHeight is strange value, got " + result); 1.152 + 1.153 + result = -1; 1.154 + synthesizeWheel(gScrollable64, 10, 10, 1.155 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.156 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.157 + gScrollable64.wheelPageHeight = result; 1.158 + ok(result >= (200 - gScrollable64.wheelLineHeight * 2) && result <= 200, 1.159 + "prepareScrollUnits: gScrollable64.wheelLineHeight is strange value, got " + result); 1.160 + 1.161 + result = -1; 1.162 + synthesizeWheel(gScrollable32, 10, 10, 1.163 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.164 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.165 + gScrollable32.wheelPageHeight = result; 1.166 + ok(result >= (50 - gScrollable32.wheelLineHeight * 2) && result <= 50, 1.167 + "prepareScrollUnits: gScrollable32.wheelLineHeight is strange value, got " + result); 1.168 + 1.169 + result = -1; 1.170 + synthesizeWheel(gRoot, 10, 10, 1.171 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.172 + deltaY: 1.0, lineOrPageDeltaY: 1 }); 1.173 + gRoot.wheelPageHeight = result; 1.174 + ok(window.innerHeight - result < 100 && window.innerHeight - result > 0, 1.175 + "prepareScrollUnits: gRoot.wheelLineHeight is strange value, got " + result); 1.176 + 1.177 + 1.178 + result = -1; 1.179 + synthesizeWheel(gScrollable128, 10, 10, 1.180 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.181 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.182 + gScrollable128.wheelPageWidth = result; 1.183 + ok(result >= (100 - gScrollable128.wheelLineHeight * 2) && result <= 100, 1.184 + "prepareScrollUnits: gScrollable128.wheelPageWidth is strange value, got " + result); 1.185 + 1.186 + result = -1; 1.187 + synthesizeWheel(gScrollable96, 10, 10, 1.188 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.189 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.190 + gScrollable96.wheelPageWidth = result; 1.191 + ok(result >= (150 - gScrollable96.wheelLineHeight * 2) && result <= 150, 1.192 + "prepareScrollUnits: gScrollable96.wheelPageWidth is strange value, got " + result); 1.193 + 1.194 + result = -1; 1.195 + synthesizeWheel(gScrollable64, 10, 10, 1.196 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.197 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.198 + gScrollable64.wheelPageWidth = result; 1.199 + ok(result >= (200 - gScrollable64.wheelLineHeight * 2) && result <= 200, 1.200 + "prepareScrollUnits: gScrollable64.wheelPageWidth is strange value, got " + result); 1.201 + 1.202 + result = -1; 1.203 + synthesizeWheel(gScrollable32, 10, 10, 1.204 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.205 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.206 + gScrollable32.wheelPageWidth = result; 1.207 + ok(result >= (50 - gScrollable32.wheelLineHeight * 2) && result <= 50, 1.208 + "prepareScrollUnits: gScrollable32.wheelPageWidth is strange value, got " + result); 1.209 + 1.210 + result = -1; 1.211 + synthesizeWheel(gRoot, 10, 10, 1.212 + { deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.213 + deltaX: 1.0, lineOrPageDeltaX: 1 }); 1.214 + gRoot.wheelPageWidth = result; 1.215 + ok(window.innerWidth - result < 100 && window.innerWidth - result > 0, 1.216 + "prepareScrollUnits: gRoot.wheelPageWidth is strange value, got " + result); 1.217 + 1.218 + window.removeEventListener("MozMousePixelScroll", handler, true); 1.219 +} 1.220 + 1.221 +function doTests() 1.222 +{ 1.223 + const kTests = [ 1.224 + // DOM_DELTA_LINE 1.225 + { description: "Should be computed from nearest scrollable element, 128", 1.226 + target: gScrollable128, 1.227 + event: { 1.228 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.229 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.230 + prepare: function () { 1.231 + gScrollable128.scrollLeft = 0; 1.232 + gScrollable128.scrollTop = 0; 1.233 + }, 1.234 + cleanup: function () { 1.235 + }, 1.236 + expected: { 1.237 + x: gScrollable128, y: gScrollable128 1.238 + } 1.239 + }, 1.240 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction", 1.241 + target: gScrollable128, 1.242 + event: { 1.243 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.244 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.245 + prepare: function () { 1.246 + gScrollable128.scrollLeft = 0; 1.247 + gScrollable128.scrollTop = 0; 1.248 + }, 1.249 + cleanup: function () { 1.250 + }, 1.251 + expected: { 1.252 + x: gScrollable128, y: gScrollable128 1.253 + } 1.254 + }, 1.255 + { description: "Should be computed from nearest scrollable element, 96", 1.256 + target: gScrollable96, 1.257 + event: { 1.258 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.259 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.260 + prepare: function () { 1.261 + gScrollable96.scrollLeft = 0; 1.262 + gScrollable96.scrollTop = 0; 1.263 + }, 1.264 + cleanup: function () { 1.265 + }, 1.266 + expected: { 1.267 + x: gScrollable96, y: gScrollable96 1.268 + } 1.269 + }, 1.270 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 96", 1.271 + target: gScrollable96, 1.272 + event: { 1.273 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.274 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.275 + prepare: function () { 1.276 + gScrollable96.scrollLeft = 0; 1.277 + gScrollable96.scrollTop = 0; 1.278 + }, 1.279 + cleanup: function () { 1.280 + }, 1.281 + expected: { 1.282 + x: gScrollable96, y: gScrollable96 1.283 + } 1.284 + }, 1.285 + { description: "Should be computed from nearest scrollable element, 64", 1.286 + target: gScrollable64, 1.287 + event: { 1.288 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.289 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.290 + prepare: function () { 1.291 + gScrollable64.scrollLeft = 0; 1.292 + gScrollable64.scrollTop = 0; 1.293 + }, 1.294 + cleanup: function () { 1.295 + }, 1.296 + expected: { 1.297 + x: gScrollable64, y: gScrollable64 1.298 + } 1.299 + }, 1.300 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 64", 1.301 + target: gScrollable64, 1.302 + event: { 1.303 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.304 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.305 + prepare: function () { 1.306 + gScrollable64.scrollLeft = 0; 1.307 + gScrollable64.scrollTop = 0; 1.308 + }, 1.309 + cleanup: function () { 1.310 + }, 1.311 + expected: { 1.312 + x: gScrollable64, y: gScrollable64 1.313 + } 1.314 + }, 1.315 + { description: "Should be computed from nearest scrollable element, 32", 1.316 + target: gScrollable32, 1.317 + event: { 1.318 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.319 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.320 + prepare: function () { 1.321 + gScrollable32.scrollLeft = 0; 1.322 + gScrollable32.scrollTop = 0; 1.323 + }, 1.324 + cleanup: function () { 1.325 + }, 1.326 + expected: { 1.327 + x: gScrollable32, y: gScrollable32 1.328 + } 1.329 + }, 1.330 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 32", 1.331 + target: gScrollable32, 1.332 + event: { 1.333 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.334 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.335 + prepare: function () { 1.336 + gScrollable32.scrollLeft = 0; 1.337 + gScrollable32.scrollTop = 0; 1.338 + }, 1.339 + cleanup: function () { 1.340 + }, 1.341 + expected: { 1.342 + x: gScrollable32, y: gScrollable32 1.343 + } 1.344 + }, 1.345 + { description: "Should be computed from root element if there is no scrollable element, root", 1.346 + target: gRoot, 1.347 + event: { 1.348 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.349 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.350 + prepare: function () { 1.351 + }, 1.352 + cleanup: function () { 1.353 + }, 1.354 + expected: { 1.355 + x: gRoot, y: gRoot 1.356 + } 1.357 + }, 1.358 + { description: "Should be computed from root element, even if there is no scrollable element, root", 1.359 + target: gRoot, 1.360 + event: { 1.361 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.362 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.363 + prepare: function () { 1.364 + }, 1.365 + cleanup: function () { 1.366 + }, 1.367 + expected: { 1.368 + x: gRoot, y: gRoot 1.369 + } 1.370 + }, 1.371 + { description: "Should be computed from nearest scrollable element, 128", 1.372 + target: gScrollable128, 1.373 + event: { 1.374 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.375 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.376 + prepare: function () { 1.377 + gScrollable128.scrollLeft = 0; 1.378 + gScrollable128.scrollTop = 0; 1.379 + }, 1.380 + cleanup: function () { 1.381 + }, 1.382 + expected: { 1.383 + x: null, y: gScrollable128 1.384 + } 1.385 + }, 1.386 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction", 1.387 + target: gScrollable128, 1.388 + event: { 1.389 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.390 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.391 + prepare: function () { 1.392 + gScrollable128.scrollLeft = 0; 1.393 + gScrollable128.scrollTop = 0; 1.394 + }, 1.395 + cleanup: function () { 1.396 + }, 1.397 + expected: { 1.398 + x: null, y: gScrollable128 1.399 + } 1.400 + }, 1.401 + { description: "Should be computed from nearest scrollable element, 96", 1.402 + target: gScrollable96, 1.403 + event: { 1.404 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.405 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.406 + prepare: function () { 1.407 + gScrollable96.scrollLeft = 0; 1.408 + gScrollable96.scrollTop = 0; 1.409 + }, 1.410 + cleanup: function () { 1.411 + }, 1.412 + expected: { 1.413 + x: null, y: gScrollable96 1.414 + } 1.415 + }, 1.416 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 96", 1.417 + target: gScrollable96, 1.418 + event: { 1.419 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.420 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.421 + prepare: function () { 1.422 + gScrollable96.scrollLeft = 0; 1.423 + gScrollable96.scrollTop = 0; 1.424 + }, 1.425 + cleanup: function () { 1.426 + }, 1.427 + expected: { 1.428 + x: null, y: gScrollable96 1.429 + } 1.430 + }, 1.431 + { description: "Should be computed from nearest scrollable element, 64", 1.432 + target: gScrollable64, 1.433 + event: { 1.434 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.435 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.436 + prepare: function () { 1.437 + gScrollable64.scrollLeft = 0; 1.438 + gScrollable64.scrollTop = 0; 1.439 + }, 1.440 + cleanup: function () { 1.441 + }, 1.442 + expected: { 1.443 + x: null, y: gScrollable64 1.444 + } 1.445 + }, 1.446 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 64", 1.447 + target: gScrollable64, 1.448 + event: { 1.449 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.450 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.451 + prepare: function () { 1.452 + gScrollable64.scrollLeft = 0; 1.453 + gScrollable64.scrollTop = 0; 1.454 + }, 1.455 + cleanup: function () { 1.456 + }, 1.457 + expected: { 1.458 + x: null, y: gScrollable64 1.459 + } 1.460 + }, 1.461 + { description: "Should be computed from nearest scrollable element, 32", 1.462 + target: gScrollable32, 1.463 + event: { 1.464 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.465 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.466 + prepare: function () { 1.467 + gScrollable32.scrollLeft = 0; 1.468 + gScrollable32.scrollTop = 0; 1.469 + }, 1.470 + cleanup: function () { 1.471 + }, 1.472 + expected: { 1.473 + x: null, y: gScrollable32 1.474 + } 1.475 + }, 1.476 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 32", 1.477 + target: gScrollable32, 1.478 + event: { 1.479 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.480 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.481 + prepare: function () { 1.482 + gScrollable32.scrollLeft = 0; 1.483 + gScrollable32.scrollTop = 0; 1.484 + }, 1.485 + cleanup: function () { 1.486 + }, 1.487 + expected: { 1.488 + x: null, y: gScrollable32 1.489 + } 1.490 + }, 1.491 + { description: "Should be computed from root element if there is no scrollable element, root", 1.492 + target: gRoot, 1.493 + event: { 1.494 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.495 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.496 + prepare: function () { 1.497 + }, 1.498 + cleanup: function () { 1.499 + }, 1.500 + expected: { 1.501 + x: null, y: gRoot 1.502 + } 1.503 + }, 1.504 + { description: "Should be computed from root element, even if there is no scrollable element, root", 1.505 + target: gRoot, 1.506 + event: { 1.507 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.508 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.509 + prepare: function () { 1.510 + }, 1.511 + cleanup: function () { 1.512 + }, 1.513 + expected: { 1.514 + x: null, y: gRoot 1.515 + } 1.516 + }, 1.517 + { description: "Should be computed from nearest scrollable element, 128", 1.518 + target: gScrollable128, 1.519 + event: { 1.520 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.521 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.522 + prepare: function () { 1.523 + gScrollable128.scrollLeft = 0; 1.524 + gScrollable128.scrollTop = 0; 1.525 + }, 1.526 + cleanup: function () { 1.527 + }, 1.528 + expected: { 1.529 + x: gScrollable128, y: null 1.530 + } 1.531 + }, 1.532 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction", 1.533 + target: gScrollable128, 1.534 + event: { 1.535 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.536 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.537 + prepare: function () { 1.538 + gScrollable128.scrollLeft = 0; 1.539 + gScrollable128.scrollTop = 0; 1.540 + }, 1.541 + cleanup: function () { 1.542 + }, 1.543 + expected: { 1.544 + x: gScrollable128, y: null 1.545 + } 1.546 + }, 1.547 + { description: "Should be computed from nearest scrollable element, 96", 1.548 + target: gScrollable96, 1.549 + event: { 1.550 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.551 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.552 + prepare: function () { 1.553 + gScrollable96.scrollLeft = 0; 1.554 + gScrollable96.scrollTop = 0; 1.555 + }, 1.556 + cleanup: function () { 1.557 + }, 1.558 + expected: { 1.559 + x: gScrollable96, y: null 1.560 + } 1.561 + }, 1.562 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 96", 1.563 + target: gScrollable96, 1.564 + event: { 1.565 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.566 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.567 + prepare: function () { 1.568 + gScrollable96.scrollLeft = 0; 1.569 + gScrollable96.scrollTop = 0; 1.570 + }, 1.571 + cleanup: function () { 1.572 + }, 1.573 + expected: { 1.574 + x: gScrollable96, y: null 1.575 + } 1.576 + }, 1.577 + { description: "Should be computed from nearest scrollable element, 64", 1.578 + target: gScrollable64, 1.579 + event: { 1.580 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.581 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.582 + prepare: function () { 1.583 + gScrollable64.scrollLeft = 0; 1.584 + gScrollable64.scrollTop = 0; 1.585 + }, 1.586 + cleanup: function () { 1.587 + }, 1.588 + expected: { 1.589 + x: gScrollable64, y: null 1.590 + } 1.591 + }, 1.592 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 64", 1.593 + target: gScrollable64, 1.594 + event: { 1.595 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.596 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.597 + prepare: function () { 1.598 + gScrollable64.scrollLeft = 0; 1.599 + gScrollable64.scrollTop = 0; 1.600 + }, 1.601 + cleanup: function () { 1.602 + }, 1.603 + expected: { 1.604 + x: gScrollable64, y: null 1.605 + } 1.606 + }, 1.607 + { description: "Should be computed from nearest scrollable element, 32", 1.608 + target: gScrollable32, 1.609 + event: { 1.610 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.611 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.612 + prepare: function () { 1.613 + gScrollable32.scrollLeft = 0; 1.614 + gScrollable32.scrollTop = 0; 1.615 + }, 1.616 + cleanup: function () { 1.617 + }, 1.618 + expected: { 1.619 + x: gScrollable32, y: null 1.620 + } 1.621 + }, 1.622 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 32", 1.623 + target: gScrollable32, 1.624 + event: { 1.625 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.626 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.627 + prepare: function () { 1.628 + gScrollable32.scrollLeft = 0; 1.629 + gScrollable32.scrollTop = 0; 1.630 + }, 1.631 + cleanup: function () { 1.632 + }, 1.633 + expected: { 1.634 + x: gScrollable32, y: null 1.635 + } 1.636 + }, 1.637 + { description: "Should be computed from root element if there is no scrollable element, root", 1.638 + target: gRoot, 1.639 + event: { 1.640 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.641 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.642 + prepare: function () { 1.643 + }, 1.644 + cleanup: function () { 1.645 + }, 1.646 + expected: { 1.647 + x: gRoot, y: null 1.648 + } 1.649 + }, 1.650 + { description: "Should be computed from root element, even if there is no scrollable element, root", 1.651 + target: gRoot, 1.652 + event: { 1.653 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.654 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.655 + prepare: function () { 1.656 + }, 1.657 + cleanup: function () { 1.658 + }, 1.659 + expected: { 1.660 + x: gRoot, y: null 1.661 + } 1.662 + }, 1.663 + 1.664 + // DOM_DELTA_PAGE 1.665 + { description: "Should be computed from nearest scrollable element, 128", 1.666 + target: gScrollable128, 1.667 + event: { 1.668 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.669 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.670 + prepare: function () { 1.671 + gScrollable128.scrollLeft = 0; 1.672 + gScrollable128.scrollTop = 0; 1.673 + }, 1.674 + cleanup: function () { 1.675 + }, 1.676 + expected: { 1.677 + x: gScrollable128, y: gScrollable128 1.678 + } 1.679 + }, 1.680 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction", 1.681 + target: gScrollable128, 1.682 + event: { 1.683 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.684 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.685 + prepare: function () { 1.686 + gScrollable128.scrollLeft = 0; 1.687 + gScrollable128.scrollTop = 0; 1.688 + }, 1.689 + cleanup: function () { 1.690 + }, 1.691 + expected: { 1.692 + x: gScrollable128, y: gScrollable128 1.693 + } 1.694 + }, 1.695 + { description: "Should be computed from nearest scrollable element, 96", 1.696 + target: gScrollable96, 1.697 + event: { 1.698 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.699 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.700 + prepare: function () { 1.701 + gScrollable96.scrollLeft = 0; 1.702 + gScrollable96.scrollTop = 0; 1.703 + }, 1.704 + cleanup: function () { 1.705 + }, 1.706 + expected: { 1.707 + x: gScrollable96, y: gScrollable96 1.708 + } 1.709 + }, 1.710 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 96", 1.711 + target: gScrollable96, 1.712 + event: { 1.713 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.714 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.715 + prepare: function () { 1.716 + gScrollable96.scrollLeft = 0; 1.717 + gScrollable96.scrollTop = 0; 1.718 + }, 1.719 + cleanup: function () { 1.720 + }, 1.721 + expected: { 1.722 + x: gScrollable96, y: gScrollable96 1.723 + } 1.724 + }, 1.725 + { description: "Should be computed from nearest scrollable element, 64", 1.726 + target: gScrollable64, 1.727 + event: { 1.728 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.729 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.730 + prepare: function () { 1.731 + gScrollable64.scrollLeft = 0; 1.732 + gScrollable64.scrollTop = 0; 1.733 + }, 1.734 + cleanup: function () { 1.735 + }, 1.736 + expected: { 1.737 + x: gScrollable64, y: gScrollable64 1.738 + } 1.739 + }, 1.740 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 64", 1.741 + target: gScrollable64, 1.742 + event: { 1.743 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.744 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.745 + prepare: function () { 1.746 + gScrollable64.scrollLeft = 0; 1.747 + gScrollable64.scrollTop = 0; 1.748 + }, 1.749 + cleanup: function () { 1.750 + }, 1.751 + expected: { 1.752 + x: gScrollable64, y: gScrollable64 1.753 + } 1.754 + }, 1.755 + { description: "Should be computed from nearest scrollable element, 32", 1.756 + target: gScrollable32, 1.757 + event: { 1.758 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.759 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.760 + prepare: function () { 1.761 + gScrollable32.scrollLeft = 0; 1.762 + gScrollable32.scrollTop = 0; 1.763 + }, 1.764 + cleanup: function () { 1.765 + }, 1.766 + expected: { 1.767 + x: gScrollable32, y: gScrollable32 1.768 + } 1.769 + }, 1.770 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 32", 1.771 + target: gScrollable32, 1.772 + event: { 1.773 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.774 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.775 + prepare: function () { 1.776 + gScrollable32.scrollLeft = 0; 1.777 + gScrollable32.scrollTop = 0; 1.778 + }, 1.779 + cleanup: function () { 1.780 + }, 1.781 + expected: { 1.782 + x: gScrollable32, y: gScrollable32 1.783 + } 1.784 + }, 1.785 + { description: "Should be computed from root element if there is no scrollable element, root", 1.786 + target: gRoot, 1.787 + event: { 1.788 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.789 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.790 + prepare: function () { 1.791 + }, 1.792 + cleanup: function () { 1.793 + }, 1.794 + expected: { 1.795 + x: gRoot, y: gRoot 1.796 + } 1.797 + }, 1.798 + { description: "Should be computed from root element, even if there is no scrollable element, root", 1.799 + target: gRoot, 1.800 + event: { 1.801 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.802 + deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 }, 1.803 + prepare: function () { 1.804 + }, 1.805 + cleanup: function () { 1.806 + }, 1.807 + expected: { 1.808 + x: gRoot, y: gRoot 1.809 + } 1.810 + }, 1.811 + { description: "Should be computed from nearest scrollable element, 128", 1.812 + target: gScrollable128, 1.813 + event: { 1.814 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.815 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.816 + prepare: function () { 1.817 + gScrollable128.scrollLeft = 0; 1.818 + gScrollable128.scrollTop = 0; 1.819 + }, 1.820 + cleanup: function () { 1.821 + }, 1.822 + expected: { 1.823 + x: null, y: gScrollable128 1.824 + } 1.825 + }, 1.826 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction", 1.827 + target: gScrollable128, 1.828 + event: { 1.829 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.830 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.831 + prepare: function () { 1.832 + gScrollable128.scrollLeft = 0; 1.833 + gScrollable128.scrollTop = 0; 1.834 + }, 1.835 + cleanup: function () { 1.836 + }, 1.837 + expected: { 1.838 + x: null, y: gScrollable128 1.839 + } 1.840 + }, 1.841 + { description: "Should be computed from nearest scrollable element, 96", 1.842 + target: gScrollable96, 1.843 + event: { 1.844 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.845 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.846 + prepare: function () { 1.847 + gScrollable96.scrollLeft = 0; 1.848 + gScrollable96.scrollTop = 0; 1.849 + }, 1.850 + cleanup: function () { 1.851 + }, 1.852 + expected: { 1.853 + x: null, y: gScrollable96 1.854 + } 1.855 + }, 1.856 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 96", 1.857 + target: gScrollable96, 1.858 + event: { 1.859 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.860 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.861 + prepare: function () { 1.862 + gScrollable96.scrollLeft = 0; 1.863 + gScrollable96.scrollTop = 0; 1.864 + }, 1.865 + cleanup: function () { 1.866 + }, 1.867 + expected: { 1.868 + x: null, y: gScrollable96 1.869 + } 1.870 + }, 1.871 + { description: "Should be computed from nearest scrollable element, 64", 1.872 + target: gScrollable64, 1.873 + event: { 1.874 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.875 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.876 + prepare: function () { 1.877 + gScrollable64.scrollLeft = 0; 1.878 + gScrollable64.scrollTop = 0; 1.879 + }, 1.880 + cleanup: function () { 1.881 + }, 1.882 + expected: { 1.883 + x: null, y: gScrollable64 1.884 + } 1.885 + }, 1.886 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 64", 1.887 + target: gScrollable64, 1.888 + event: { 1.889 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.890 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.891 + prepare: function () { 1.892 + gScrollable64.scrollLeft = 0; 1.893 + gScrollable64.scrollTop = 0; 1.894 + }, 1.895 + cleanup: function () { 1.896 + }, 1.897 + expected: { 1.898 + x: null, y: gScrollable64 1.899 + } 1.900 + }, 1.901 + { description: "Should be computed from nearest scrollable element, 32", 1.902 + target: gScrollable32, 1.903 + event: { 1.904 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.905 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.906 + prepare: function () { 1.907 + gScrollable32.scrollLeft = 0; 1.908 + gScrollable32.scrollTop = 0; 1.909 + }, 1.910 + cleanup: function () { 1.911 + }, 1.912 + expected: { 1.913 + x: null, y: gScrollable32 1.914 + } 1.915 + }, 1.916 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 32", 1.917 + target: gScrollable32, 1.918 + event: { 1.919 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.920 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.921 + prepare: function () { 1.922 + gScrollable32.scrollLeft = 0; 1.923 + gScrollable32.scrollTop = 0; 1.924 + }, 1.925 + cleanup: function () { 1.926 + }, 1.927 + expected: { 1.928 + x: null, y: gScrollable32 1.929 + } 1.930 + }, 1.931 + { description: "Should be computed from root element if there is no scrollable element, root", 1.932 + target: gRoot, 1.933 + event: { 1.934 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.935 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.936 + prepare: function () { 1.937 + }, 1.938 + cleanup: function () { 1.939 + }, 1.940 + expected: { 1.941 + x: null, y: gRoot 1.942 + } 1.943 + }, 1.944 + { description: "Should be computed from root element, even if there is no scrollable element, root", 1.945 + target: gRoot, 1.946 + event: { 1.947 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.948 + deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 }, 1.949 + prepare: function () { 1.950 + }, 1.951 + cleanup: function () { 1.952 + }, 1.953 + expected: { 1.954 + x: null, y: gRoot 1.955 + } 1.956 + }, 1.957 + { description: "Should be computed from nearest scrollable element, 128", 1.958 + target: gScrollable128, 1.959 + event: { 1.960 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.961 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.962 + prepare: function () { 1.963 + gScrollable128.scrollLeft = 0; 1.964 + gScrollable128.scrollTop = 0; 1.965 + }, 1.966 + cleanup: function () { 1.967 + }, 1.968 + expected: { 1.969 + x: gScrollable128, y: null 1.970 + } 1.971 + }, 1.972 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction", 1.973 + target: gScrollable128, 1.974 + event: { 1.975 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.976 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.977 + prepare: function () { 1.978 + gScrollable128.scrollLeft = 0; 1.979 + gScrollable128.scrollTop = 0; 1.980 + }, 1.981 + cleanup: function () { 1.982 + }, 1.983 + expected: { 1.984 + x: gScrollable128, y: null 1.985 + } 1.986 + }, 1.987 + { description: "Should be computed from nearest scrollable element, 96", 1.988 + target: gScrollable96, 1.989 + event: { 1.990 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.991 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.992 + prepare: function () { 1.993 + gScrollable96.scrollLeft = 0; 1.994 + gScrollable96.scrollTop = 0; 1.995 + }, 1.996 + cleanup: function () { 1.997 + }, 1.998 + expected: { 1.999 + x: gScrollable96, y: null 1.1000 + } 1.1001 + }, 1.1002 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 96", 1.1003 + target: gScrollable96, 1.1004 + event: { 1.1005 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1006 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.1007 + prepare: function () { 1.1008 + gScrollable96.scrollLeft = 0; 1.1009 + gScrollable96.scrollTop = 0; 1.1010 + }, 1.1011 + cleanup: function () { 1.1012 + }, 1.1013 + expected: { 1.1014 + x: gScrollable96, y: null 1.1015 + } 1.1016 + }, 1.1017 + { description: "Should be computed from nearest scrollable element, 64", 1.1018 + target: gScrollable64, 1.1019 + event: { 1.1020 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1021 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.1022 + prepare: function () { 1.1023 + gScrollable64.scrollLeft = 0; 1.1024 + gScrollable64.scrollTop = 0; 1.1025 + }, 1.1026 + cleanup: function () { 1.1027 + }, 1.1028 + expected: { 1.1029 + x: gScrollable64, y: null 1.1030 + } 1.1031 + }, 1.1032 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 64", 1.1033 + target: gScrollable64, 1.1034 + event: { 1.1035 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1036 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.1037 + prepare: function () { 1.1038 + gScrollable64.scrollLeft = 0; 1.1039 + gScrollable64.scrollTop = 0; 1.1040 + }, 1.1041 + cleanup: function () { 1.1042 + }, 1.1043 + expected: { 1.1044 + x: gScrollable64, y: null 1.1045 + } 1.1046 + }, 1.1047 + { description: "Should be computed from nearest scrollable element, 32", 1.1048 + target: gScrollable32, 1.1049 + event: { 1.1050 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1051 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.1052 + prepare: function () { 1.1053 + gScrollable32.scrollLeft = 0; 1.1054 + gScrollable32.scrollTop = 0; 1.1055 + }, 1.1056 + cleanup: function () { 1.1057 + }, 1.1058 + expected: { 1.1059 + x: gScrollable32, y: null 1.1060 + } 1.1061 + }, 1.1062 + { description: "Should be computed from nearest scrollable element, even if not scrollable to the direction, 32", 1.1063 + target: gScrollable32, 1.1064 + event: { 1.1065 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1066 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.1067 + prepare: function () { 1.1068 + gScrollable32.scrollLeft = 0; 1.1069 + gScrollable32.scrollTop = 0; 1.1070 + }, 1.1071 + cleanup: function () { 1.1072 + }, 1.1073 + expected: { 1.1074 + x: gScrollable32, y: null 1.1075 + } 1.1076 + }, 1.1077 + { description: "Should be computed from root element if there is no scrollable element, root", 1.1078 + target: gRoot, 1.1079 + event: { 1.1080 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1081 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.1082 + prepare: function () { 1.1083 + }, 1.1084 + cleanup: function () { 1.1085 + }, 1.1086 + expected: { 1.1087 + x: gRoot, y: null 1.1088 + } 1.1089 + }, 1.1090 + { description: "Should be computed from root element, even if there is no scrollable element, root", 1.1091 + target: gRoot, 1.1092 + event: { 1.1093 + deltaMode: WheelEvent.DOM_DELTA_PAGE, 1.1094 + deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 }, 1.1095 + prepare: function () { 1.1096 + }, 1.1097 + cleanup: function () { 1.1098 + }, 1.1099 + expected: { 1.1100 + x: gRoot, y: null 1.1101 + } 1.1102 + }, 1.1103 + 1.1104 + // Overflow: hidden; boxes shouldn't be ignored. 1.1105 + { description: "Should be computed from nearest scrollable element even if it hides overflow content, 64", 1.1106 + target: gScrollable64, 1.1107 + event: { 1.1108 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1109 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.1110 + prepare: function () { 1.1111 + gScrollable64.style.overflow = "hidden"; 1.1112 + gScrollable96.scrollLeft = 0; 1.1113 + gScrollable96.scrollTop = 0; 1.1114 + gScrollable64.scrollLeft = 0; 1.1115 + gScrollable64.scrollTop = 0; 1.1116 + }, 1.1117 + cleanup: function () { 1.1118 + gScrollable64.style.overflow = "auto"; 1.1119 + }, 1.1120 + expected: { 1.1121 + x: gScrollable64, y: gScrollable64 1.1122 + } 1.1123 + }, 1.1124 + { description: "Should be computed from nearest scrollable element even if it hides overflow content (X), 64", 1.1125 + target: gScrollable64, 1.1126 + event: { 1.1127 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1128 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.1129 + prepare: function () { 1.1130 + gScrollable64.style.overflowX = "hidden"; 1.1131 + gScrollable96.scrollLeft = 0; 1.1132 + gScrollable96.scrollTop = 0; 1.1133 + gScrollable64.scrollLeft = 0; 1.1134 + gScrollable64.scrollTop = 0; 1.1135 + }, 1.1136 + cleanup: function () { 1.1137 + gScrollable64.style.overflow = "auto"; 1.1138 + }, 1.1139 + expected: { 1.1140 + x: gScrollable64, y: gScrollable64 1.1141 + } 1.1142 + }, 1.1143 + { description: "Should be computed from nearest scrollable element even if it hides overflow content (Y), 64", 1.1144 + target: gScrollable64, 1.1145 + event: { 1.1146 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1147 + deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 }, 1.1148 + prepare: function () { 1.1149 + gScrollable64.style.overflowY = "hidden"; 1.1150 + gScrollable96.scrollLeft = 0; 1.1151 + gScrollable96.scrollTop = 0; 1.1152 + gScrollable64.scrollLeft = 0; 1.1153 + gScrollable64.scrollTop = 0; 1.1154 + }, 1.1155 + cleanup: function () { 1.1156 + gScrollable64.style.overflow = "auto"; 1.1157 + }, 1.1158 + expected: { 1.1159 + x: gScrollable64, y: gScrollable64 1.1160 + } 1.1161 + }, 1.1162 + { description: "Should be computed from nearest scrollable element even if it hides overflow content (X), 64", 1.1163 + target: gScrollable64, 1.1164 + event: { 1.1165 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1166 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.1167 + prepare: function () { 1.1168 + gScrollable64.style.overflowX = "hidden"; 1.1169 + gScrollable96.scrollLeft = 0; 1.1170 + gScrollable96.scrollTop = 0; 1.1171 + gScrollable64.scrollLeft = 0; 1.1172 + gScrollable64.scrollTop = 0; 1.1173 + }, 1.1174 + cleanup: function () { 1.1175 + gScrollable64.style.overflow = "auto"; 1.1176 + }, 1.1177 + expected: { 1.1178 + x: null, y: gScrollable64 1.1179 + } 1.1180 + }, 1.1181 + { description: "Should be computed from nearest scrollable element even if it hides overflow content (Y), 64", 1.1182 + target: gScrollable64, 1.1183 + event: { 1.1184 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1185 + deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 }, 1.1186 + prepare: function () { 1.1187 + gScrollable64.style.overflowY = "hidden"; 1.1188 + gScrollable96.scrollLeft = 0; 1.1189 + gScrollable96.scrollTop = 0; 1.1190 + gScrollable64.scrollLeft = 0; 1.1191 + gScrollable64.scrollTop = 0; 1.1192 + }, 1.1193 + cleanup: function () { 1.1194 + gScrollable64.style.overflow = "auto"; 1.1195 + }, 1.1196 + expected: { 1.1197 + x: null, y: gScrollable64 1.1198 + } 1.1199 + }, 1.1200 + { description: "Should be computed from nearest scrollable element even if it hides overflow content (X), 64", 1.1201 + target: gScrollable64, 1.1202 + event: { 1.1203 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1204 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.1205 + prepare: function () { 1.1206 + gScrollable64.style.overflowX = "hidden"; 1.1207 + gScrollable96.scrollLeft = 0; 1.1208 + gScrollable96.scrollTop = 0; 1.1209 + gScrollable64.scrollLeft = 0; 1.1210 + gScrollable64.scrollTop = 0; 1.1211 + }, 1.1212 + cleanup: function () { 1.1213 + gScrollable64.style.overflow = "auto"; 1.1214 + }, 1.1215 + expected: { 1.1216 + x: gScrollable64, y: null 1.1217 + } 1.1218 + }, 1.1219 + { description: "Should be computed from nearest scrollable element even if it hides overflow content (Y), 64", 1.1220 + target: gScrollable64, 1.1221 + event: { 1.1222 + deltaMode: WheelEvent.DOM_DELTA_LINE, 1.1223 + deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 }, 1.1224 + prepare: function () { 1.1225 + gScrollable64.style.overflowY = "hidden"; 1.1226 + gScrollable96.scrollLeft = 0; 1.1227 + gScrollable96.scrollTop = 0; 1.1228 + gScrollable64.scrollLeft = 0; 1.1229 + gScrollable64.scrollTop = 0; 1.1230 + }, 1.1231 + cleanup: function () { 1.1232 + gScrollable64.style.overflow = "auto"; 1.1233 + }, 1.1234 + expected: { 1.1235 + x: gScrollable64, y: null 1.1236 + } 1.1237 + }, 1.1238 + ]; 1.1239 + 1.1240 + var currentTest, description, firedX, firedY; 1.1241 + 1.1242 + function handler(aEvent) 1.1243 + { 1.1244 + aEvent.preventDefault(); 1.1245 + 1.1246 + if (aEvent.axis != MouseScrollEvent.HORIZONTAL_AXIS && 1.1247 + aEvent.axis != MouseScrollEvent.VERTICAL_AXIS) { 1.1248 + ok(false, 1.1249 + description + "The event had invalid axis (" + aEvent.axis + ")"); 1.1250 + return; 1.1251 + } 1.1252 + 1.1253 + var isHorizontal = (aEvent.axis == MouseScrollEvent.HORIZONTAL_AXIS); 1.1254 + if ((isHorizontal && !currentTest.expected.x) || 1.1255 + (!isHorizontal && !currentTest.expected.y)) { 1.1256 + ok(false, 1.1257 + description + "The event fired unexpectedly (" + 1.1258 + (isHorizontal ? "Horizontal" : "Vertical") + ")"); 1.1259 + return; 1.1260 + } 1.1261 + 1.1262 + if (isHorizontal) { 1.1263 + firedX = true; 1.1264 + } else { 1.1265 + firedY = true; 1.1266 + } 1.1267 + 1.1268 + var expectedDetail = 1.1269 + (currentTest.event.deltaMode == WheelEvent.DOM_DELTA_LINE) ? 1.1270 + (isHorizontal ? currentTest.expected.x.wheelHorizontalLine : 1.1271 + currentTest.expected.y.wheelLineHeight) : 1.1272 + (isHorizontal ? currentTest.expected.x.wheelPageWidth : 1.1273 + currentTest.expected.y.wheelPageHeight); 1.1274 + is(Math.abs(aEvent.detail), expectedDetail, 1.1275 + description + ((isHorizontal) ? "horizontal" : "vertical") + " event detail is wrong"); 1.1276 + } 1.1277 + 1.1278 + window.addEventListener("MozMousePixelScroll", handler, true); 1.1279 + 1.1280 + for (var i = 0; i < kTests.length; i++) { 1.1281 + currentTest = kTests[i]; 1.1282 + description = "doTests, " + currentTest.description + " (deltaMode: " + 1.1283 + (currentTest.event.deltaMode == WheelEvent.DOM_DELTA_LINE ? 1.1284 + "DOM_DELTA_LINE" : "DOM_DELTA_PAGE") + 1.1285 + ", deltaX: " + currentTest.event.deltaX + 1.1286 + ", deltaY: " + currentTest.event.deltaY + "): "; 1.1287 + currentTest.prepare(); 1.1288 + firedX = firedY = false; 1.1289 + synthesizeWheel(currentTest.target, 10, 10, currentTest.event); 1.1290 + if (currentTest.expected.x) { 1.1291 + ok(firedX, description + "Horizontla MozMousePixelScroll event wasn't fired"); 1.1292 + } 1.1293 + if (currentTest.expected.y) { 1.1294 + ok(firedY, description + "Vertical MozMousePixelScroll event wasn't fired"); 1.1295 + } 1.1296 + currentTest.cleanup(); 1.1297 + } 1.1298 + 1.1299 + window.removeEventListener("MozMousePixelScroll", handler, true); 1.1300 +} 1.1301 + 1.1302 +function runTests() 1.1303 +{ 1.1304 + SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", 100); 1.1305 + SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_y", 100); 1.1306 + SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_z", 100); 1.1307 + SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_x", 100); 1.1308 + SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_y", 100); 1.1309 + SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_z", 100); 1.1310 + SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_x", 100); 1.1311 + SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_y", 100); 1.1312 + SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_z", 100); 1.1313 + SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_x", 100); 1.1314 + SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_y", 100); 1.1315 + SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_z", 100); 1.1316 + SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_x", 100); 1.1317 + SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_y", 100); 1.1318 + SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_z", 100); 1.1319 + SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_x", 100); 1.1320 + SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_y", 100); 1.1321 + SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_z", 100); 1.1322 + 1.1323 + prepareScrollUnits(); 1.1324 + doTests(); 1.1325 + 1.1326 + SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_x"); 1.1327 + SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_y"); 1.1328 + SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_z"); 1.1329 + SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_x"); 1.1330 + SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_y"); 1.1331 + SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_z"); 1.1332 + SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_x"); 1.1333 + SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_y"); 1.1334 + SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_z"); 1.1335 + SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_x"); 1.1336 + SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_y"); 1.1337 + SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_z"); 1.1338 + SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_x"); 1.1339 + SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_y"); 1.1340 + SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_z"); 1.1341 + SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_x"); 1.1342 + SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_y"); 1.1343 + SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_z"); 1.1344 + 1.1345 + SimpleTest.finish(); 1.1346 +} 1.1347 + 1.1348 +</script> 1.1349 +</pre> 1.1350 +</body> 1.1351 +</html>