window_wheel_default_action.html 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Test for default action of WheelEvent</title>
  5. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  6. <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  7. <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
  8. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  9. </head>
  10. <body>
  11. <p id="display"></p>
  12. <div id="scrollable" style="overflow: auto; width: 200px; height: 200px;">
  13. <div id="clipper" style="margin: 0; padding: 0; overflow: hidden; width: 3000px; height: 3000px;">
  14. <div id="scrolled" style="width: 5000px; height: 5000px;">
  15. 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>
  16. 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>
  17. 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>
  18. 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>
  19. 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>
  20. 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>
  21. 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>
  22. 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>
  23. 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>
  24. 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>
  25. 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>
  26. 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>
  27. 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>
  28. 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>
  29. 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>
  30. 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>
  31. 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>
  32. 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>
  33. 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>
  34. 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>
  35. 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>
  36. 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>
  37. 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>
  38. 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>
  39. 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>
  40. 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>
  41. </div>
  42. </div>
  43. </div>
  44. <div id="spacerForBody"></div>
  45. <div id="content" style="display: none">
  46. </div>
  47. <pre id="test">
  48. <script type="application/javascript">
  49. SimpleTest.waitForFocus(runTests, window);
  50. SimpleTest.requestFlakyTimeout("untriaged");
  51. var winUtils = SpecialPowers.getDOMWindowUtils(window);
  52. // grab refresh driver
  53. winUtils.advanceTimeAndRefresh(100);
  54. var gScrollableElement = document.getElementById("scrollable");
  55. var gScrolledElement = document.getElementById("scrolled");
  56. var gSpacerForBodyElement = document.getElementById("spacerForBody");
  57. function is()
  58. {
  59. window.opener.is.apply(window.opener, arguments);
  60. }
  61. function ok()
  62. {
  63. window.opener.ok.apply(window.opener, arguments);
  64. }
  65. function sendWheelAndWait(aX, aY, aEvent, aCallback)
  66. {
  67. sendWheelAndPaint(gScrollableElement, aX, aY, aEvent, aCallback);
  68. }
  69. function hitEventLoop(aFunc, aTimes)
  70. {
  71. winUtils.advanceTimeAndRefresh(100);
  72. if (--aTimes) {
  73. setTimeout(hitEventLoop, 0, aFunc, aTimes);
  74. } else {
  75. setTimeout(aFunc, 20);
  76. }
  77. }
  78. const zoomResetTopic = "browser-fullZoom:zoomReset";
  79. SpecialPowers.registerObservers(zoomResetTopic);
  80. function onZoomReset(aCallback) {
  81. var specialPowersTopic = "specialpowers-" + zoomResetTopic;
  82. SpecialPowers.addObserver(function observe() {
  83. SpecialPowers.removeObserver(observe, specialPowersTopic);
  84. SimpleTest.executeSoon(aCallback);
  85. }, specialPowersTopic, false);
  86. }
  87. function setDeltaMultiplierSettings(aSettings, aCallback)
  88. {
  89. SpecialPowers.pushPrefEnv({"set": [
  90. ["mousewheel.default.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
  91. ["mousewheel.default.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
  92. ["mousewheel.default.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
  93. ["mousewheel.with_alt.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
  94. ["mousewheel.with_alt.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
  95. ["mousewheel.with_alt.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
  96. ["mousewheel.with_control.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
  97. ["mousewheel.with_control.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
  98. ["mousewheel.with_control.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
  99. ["mousewheel.with_meta.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
  100. ["mousewheel.with_meta.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
  101. ["mousewheel.with_meta.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
  102. ["mousewheel.with_shift.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
  103. ["mousewheel.with_shift.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
  104. ["mousewheel.with_shift.delta_multiplier_z", aSettings.deltaMultiplierZ * 100],
  105. ["mousewheel.with_win.delta_multiplier_x", aSettings.deltaMultiplierX * 100],
  106. ["mousewheel.with_win.delta_multiplier_y", aSettings.deltaMultiplierY * 100],
  107. ["mousewheel.with_win.delta_multiplier_z", aSettings.deltaMultiplierZ * 100]
  108. ]}, aCallback);
  109. }
  110. function doTestScroll(aSettings, aCallback)
  111. {
  112. const kNoScroll = 0x00;
  113. const kScrollUp = 0x01;
  114. const kScrollDown = 0x02;
  115. const kScrollLeft = 0x04;
  116. const kScrollRight = 0x08;
  117. const kTests = [
  118. { description: "Scroll to bottom by pixel scroll even if lineOrPageDelta is 0",
  119. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  120. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  121. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  122. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  123. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  124. expected: kScrollDown },
  125. { description: "Scroll to bottom by pixel scroll when lineOrPageDelta is 1",
  126. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  127. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  128. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
  129. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  130. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  131. expected: kScrollDown },
  132. { description: "Scroll to top by pixel scroll even if lineOrPageDelta is 0",
  133. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  134. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  135. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  136. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  137. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  138. expected: kScrollUp },
  139. { description: "Scroll to top by pixel scroll when lineOrPageDelta is -1",
  140. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  141. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  142. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
  143. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  144. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  145. expected: kScrollUp },
  146. { description: "Scroll to right by pixel scroll even if lineOrPageDelta is 0",
  147. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  148. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  149. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  150. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  151. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  152. expected: kScrollRight },
  153. { description: "Scroll to right by pixel scroll when lineOrPageDelta is 1",
  154. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  155. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  156. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
  157. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  158. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  159. expected: kScrollRight },
  160. { description: "Scroll to left by pixel scroll even if lineOrPageDelta is 0",
  161. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  162. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  163. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  164. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  165. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  166. expected: kScrollLeft },
  167. { description: "Scroll to left by pixel scroll when lineOrPageDelta is -1",
  168. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  169. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  170. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
  171. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  172. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  173. expected: kScrollLeft },
  174. { description: "Scroll to bottom-right by pixel scroll",
  175. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  176. deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
  177. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  178. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  179. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  180. expected: kScrollDown | kScrollRight },
  181. { description: "Scroll to bottom-left by pixel scroll",
  182. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  183. deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
  184. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  185. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  186. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  187. expected: kScrollDown | kScrollLeft },
  188. { description: "Scroll to top-left by pixel scroll",
  189. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  190. deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
  191. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  192. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  193. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  194. expected: kScrollUp | kScrollLeft },
  195. { description: "Scroll to top-right by pixel scroll",
  196. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  197. deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
  198. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  199. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  200. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  201. expected: kScrollUp | kScrollRight },
  202. { description: "Not Scroll by pixel scroll for z",
  203. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  204. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  205. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  206. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  207. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  208. expected: kNoScroll },
  209. { description: "Scroll to bottom by line scroll even if lineOrPageDelta is 0",
  210. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  211. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  212. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
  213. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  214. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  215. expected: kScrollDown },
  216. { description: "Scroll to bottom by line scroll when lineOrPageDelta is 1",
  217. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  218. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  219. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
  220. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  221. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  222. expected: kScrollDown },
  223. { description: "Scroll to top by line scroll even if lineOrPageDelta is 0",
  224. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  225. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  226. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  227. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  228. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  229. expected: kScrollUp },
  230. { description: "Scroll to top by line scroll when lineOrPageDelta is -1",
  231. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  232. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  233. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
  234. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  235. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  236. expected: kScrollUp },
  237. { description: "Scroll to right by line scroll even if lineOrPageDelta is 0",
  238. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  239. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  240. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  241. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  242. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  243. expected: kScrollRight },
  244. { description: "Scroll to right by line scroll when lineOrPageDelta is 1",
  245. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  246. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  247. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
  248. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  249. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  250. expected: kScrollRight },
  251. { description: "Scroll to left by line scroll even if lineOrPageDelta is 0",
  252. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  253. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  254. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  255. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  256. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  257. expected: kScrollLeft },
  258. { description: "Scroll to left by line scroll when lineOrPageDelta is -1",
  259. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  260. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  261. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
  262. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  263. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  264. expected: kScrollLeft },
  265. { description: "Scroll to bottom-right by line scroll",
  266. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  267. deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
  268. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  269. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  270. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  271. expected: kScrollDown | kScrollRight },
  272. { description: "Scroll to bottom-left by line scroll",
  273. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  274. deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
  275. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  276. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  277. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  278. expected: kScrollDown | kScrollLeft },
  279. { description: "Scroll to top-left by line scroll",
  280. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  281. deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
  282. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  283. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  284. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  285. expected: kScrollUp | kScrollLeft },
  286. { description: "Scroll to top-right by line scroll",
  287. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  288. deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
  289. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  290. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  291. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  292. expected: kScrollUp | kScrollRight },
  293. { description: "Not Scroll by line scroll for z",
  294. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  295. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  296. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  297. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  298. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  299. expected: kNoScroll },
  300. { description: "Scroll to bottom by page scroll even if lineOrPageDelta is 0",
  301. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  302. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  303. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
  304. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  305. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  306. expected: kScrollDown },
  307. { description: "Scroll to bottom by page scroll when lineOrPageDelta is 1",
  308. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  309. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  310. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: false,
  311. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  312. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  313. expected: kScrollDown },
  314. { description: "Scroll to top by page scroll even if lineOrPageDelta is 0",
  315. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  316. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  317. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  318. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  319. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  320. expected: kScrollUp },
  321. { description: "Scroll to top by page scroll when lineOrPageDelta is -1",
  322. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  323. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  324. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: false,
  325. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  326. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  327. expected: kScrollUp },
  328. { description: "Scroll to right by page scroll even if lineOrPageDelta is 0",
  329. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  330. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  331. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  332. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  333. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  334. expected: kScrollRight },
  335. { description: "Scroll to right by page scroll when lineOrPageDelta is 1",
  336. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  337. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  338. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: false,
  339. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  340. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  341. expected: kScrollRight },
  342. { description: "Scroll to left by page scroll even if lineOrPageDelta is 0",
  343. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  344. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  345. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  346. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  347. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  348. expected: kScrollLeft },
  349. { description: "Scroll to left by page scroll when lineOrPageDelta is -1",
  350. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  351. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  352. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: false,
  353. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  354. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  355. expected: kScrollLeft },
  356. { description: "Scroll to bottom-right by page scroll",
  357. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  358. deltaX: 0.5, deltaY: 0.5, deltaZ: 0.0,
  359. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  360. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  361. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  362. expected: kScrollDown | kScrollRight },
  363. { description: "Scroll to bottom-left by page scroll",
  364. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  365. deltaX: -0.5, deltaY: 0.5, deltaZ: 0.0,
  366. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  367. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  368. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  369. expected: kScrollDown | kScrollLeft },
  370. { description: "Scroll to top-left by page scroll",
  371. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  372. deltaX: -0.5, deltaY: -0.5, deltaZ: 0.0,
  373. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  374. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  375. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  376. expected: kScrollUp | kScrollLeft },
  377. { description: "Scroll to top-right by page scroll",
  378. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  379. deltaX: 0.5, deltaY: -0.5, deltaZ: 0.0,
  380. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  381. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  382. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  383. expected: kScrollUp | kScrollRight },
  384. { description: "Not Scroll by page scroll for z",
  385. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  386. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  387. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: false,
  388. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  389. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  390. expected: kNoScroll },
  391. // special cases.
  392. // momentum scroll should cause scroll even if the action is zoom, but if the default action is none,
  393. // shouldn't do it.
  394. { description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
  395. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  396. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  397. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  398. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  399. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  400. expected: kScrollDown },
  401. { description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 1, even if the action is zoom",
  402. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  403. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  404. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: true,
  405. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  406. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  407. expected: kScrollDown },
  408. { description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
  409. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  410. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  411. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  412. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  413. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  414. expected: kScrollUp },
  415. { description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is -1, even if the action is zoom",
  416. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  417. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  418. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: true,
  419. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  420. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  421. expected: kScrollUp },
  422. { description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
  423. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  424. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  425. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  426. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  427. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  428. expected: kScrollRight },
  429. { description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 1, even if the action is zoom",
  430. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  431. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  432. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: true,
  433. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  434. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  435. expected: kScrollRight },
  436. { description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is 0, even if the action is zoom",
  437. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  438. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  439. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  440. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  441. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  442. expected: kScrollLeft },
  443. { description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is -1, even if the action is zoom",
  444. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  445. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  446. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: true,
  447. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  448. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  449. expected: kScrollLeft },
  450. { description: "Scroll to bottom-right by momentum pixel scroll even if the action is zoom",
  451. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  452. deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
  453. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  454. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  455. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  456. expected: kScrollDown | kScrollRight },
  457. { description: "Scroll to bottom-left by momentum pixel scroll even if the action is zoom",
  458. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  459. deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
  460. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  461. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  462. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  463. expected: kScrollDown | kScrollLeft },
  464. { description: "Scroll to top-left by momentum pixel scroll even if the action is zoom",
  465. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  466. deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
  467. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  468. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  469. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  470. expected: kScrollUp | kScrollLeft },
  471. { description: "Scroll to top-right by momentum pixel scroll even if the action is zoom",
  472. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  473. deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
  474. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  475. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  476. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  477. expected: kScrollUp | kScrollRight },
  478. { description: "Not Scroll by momentum pixel scroll for z (action is zoom)",
  479. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  480. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  481. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  482. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  483. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  484. expected: kNoScroll },
  485. { description: "Not Scroll by momentum pixel scroll if default action is none (action is zoom)",
  486. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  487. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  488. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  489. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  490. shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
  491. expected: kNoScroll,
  492. prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
  493. cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
  494. // momentum scroll should cause scroll even if the action is history, but if the default action is none,
  495. // shouldn't do it.
  496. { description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
  497. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  498. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  499. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  500. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  501. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  502. expected: kScrollDown },
  503. { description: "Scroll to bottom by momentum pixel scroll when lineOrPageDelta is 1, even if the action is history",
  504. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  505. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  506. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1, isMomentum: true,
  507. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  508. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  509. expected: kScrollDown },
  510. { description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
  511. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  512. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  513. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  514. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  515. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  516. expected: kScrollUp },
  517. { description: "Scroll to top by momentum pixel scroll when lineOrPageDelta is -1, even if the action is history",
  518. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  519. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  520. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1, isMomentum: true,
  521. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  522. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  523. expected: kScrollUp },
  524. { description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
  525. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  526. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  527. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  528. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  529. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  530. expected: kScrollRight },
  531. { description: "Scroll to right by momentum pixel scroll when lineOrPageDelta is 1, even if the action is history",
  532. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  533. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  534. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0, isMomentum: true,
  535. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  536. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  537. expected: kScrollRight },
  538. { description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is 0, even if the action is history",
  539. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  540. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  541. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  542. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  543. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  544. expected: kScrollLeft },
  545. { description: "Scroll to left by momentum pixel scroll when lineOrPageDelta is -1, even if the action is history",
  546. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  547. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  548. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0, isMomentum: true,
  549. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  550. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  551. expected: kScrollLeft },
  552. { description: "Scroll to bottom-right by momentum pixel scroll even if the action is history",
  553. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  554. deltaX: 8.0, deltaY: 8.0, deltaZ: 0.0,
  555. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  556. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  557. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  558. expected: kScrollDown | kScrollRight },
  559. { description: "Scroll to bottom-left by momentum pixel scroll even if the action is history",
  560. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  561. deltaX: -8.0, deltaY: 8.0, deltaZ: 0.0,
  562. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  563. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  564. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  565. expected: kScrollDown | kScrollLeft },
  566. { description: "Scroll to top-left by momentum pixel scroll even if the action is history",
  567. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  568. deltaX: -8.0, deltaY: -8.0, deltaZ: 0.0,
  569. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  570. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  571. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  572. expected: kScrollUp | kScrollLeft },
  573. { description: "Scroll to top-right by momentum pixel scroll even if the action is history",
  574. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  575. deltaX: 8.0, deltaY: -8.0, deltaZ: 0.0,
  576. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  577. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  578. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  579. expected: kScrollUp | kScrollRight },
  580. { description: "Not Scroll by momentum pixel scroll for z (action is history)",
  581. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  582. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  583. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  584. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  585. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  586. expected: kNoScroll },
  587. { description: "Not Scroll by momentum pixel scroll if default action is none (action is history)",
  588. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  589. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  590. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0, isMomentum: true,
  591. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  592. shiftKey: true, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  593. expected: kNoScroll,
  594. prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
  595. cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
  596. // Don't scroll along axis whose overflow style is hidden.
  597. { description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden",
  598. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  599. deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
  600. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  601. expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
  602. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  603. expected: kScrollDown,
  604. prepare: function(cb) { gScrollableElement.style.overflowX = "hidden"; cb(); } },
  605. { description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden",
  606. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  607. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  608. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  609. expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
  610. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  611. expected: kScrollDown },
  612. { description: "Scroll to only bottom by oblique page wheel event with overflow-x: hidden",
  613. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  614. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  615. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  616. expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
  617. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  618. expected: kScrollDown },
  619. { description: "Scroll to only top by oblique pixel wheel event with overflow-x: hidden",
  620. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  621. deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
  622. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  623. expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
  624. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  625. expected: kScrollUp },
  626. { description: "Scroll to only top by oblique line wheel event with overflow-x: hidden",
  627. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  628. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  629. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  630. expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
  631. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  632. expected: kScrollUp },
  633. { description: "Scroll to only top by oblique page wheel event with overflow-x: hidden",
  634. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  635. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  636. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  637. expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
  638. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  639. expected: kScrollUp,
  640. cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
  641. { description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden",
  642. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  643. deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
  644. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  645. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
  646. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  647. expected: kScrollRight,
  648. prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
  649. { description: "Scroll to only right by oblique line wheel event with overflow-y: hidden",
  650. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  651. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  652. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  653. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
  654. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  655. expected: kScrollRight },
  656. { description: "Scroll to only right by oblique page wheel event with overflow-y: hidden",
  657. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  658. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  659. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  660. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
  661. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  662. expected: kScrollRight },
  663. { description: "Scroll to only left by oblique pixel wheel event with overflow-y: hidden",
  664. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  665. deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
  666. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  667. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
  668. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  669. expected: kScrollLeft },
  670. { description: "Scroll to only top by oblique line wheel event with overflow-y: hidden",
  671. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  672. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  673. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  674. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
  675. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  676. expected: kScrollLeft },
  677. { description: "Scroll to only top by oblique page wheel event with overflow-y: hidden",
  678. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  679. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  680. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  681. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
  682. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  683. expected: kScrollLeft,
  684. cleanup: function (cb) { gScrollableElement.style.overflowY = "auto"; cb(); } },
  685. { description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
  686. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  687. deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
  688. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  689. expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
  690. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  691. expected: kNoScroll,
  692. prepare: function(cb) { gScrollableElement.style.overflow = "hidden"; cb(); } },
  693. { description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
  694. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  695. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  696. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  697. expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
  698. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  699. expected: kNoScroll },
  700. { description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
  701. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  702. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  703. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  704. expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
  705. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  706. expected: kNoScroll },
  707. { description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
  708. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  709. deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
  710. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  711. expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
  712. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  713. expected: kNoScroll },
  714. { description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
  715. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  716. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  717. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  718. expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
  719. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  720. expected: kNoScroll },
  721. { description: "Don't be scrolled by oblique page wheel event with overflow: hidden",
  722. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  723. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  724. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  725. expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
  726. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  727. expected: kNoScroll,
  728. cleanup: function (cb) { gScrollableElement.style.overflow = "auto"; cb(); } },
  729. // Don't scroll along axis whose overflow style is hidden and overflow delta values should
  730. // be zero if there is ancestor scrollable element.
  731. { description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
  732. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  733. deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
  734. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  735. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  736. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  737. expected: kScrollDown,
  738. prepare: function(cb) {
  739. gScrollableElement.style.overflowX = "hidden";
  740. gScrollableElement.style.position = "fixed";
  741. gScrollableElement.style.top = "30px";
  742. gScrollableElement.style.left = "30px";
  743. // Make body element scrollable.
  744. gSpacerForBodyElement.style.width = "5000px";
  745. gSpacerForBodyElement.style.height = "5000px";
  746. document.documentElement.scrollTop = 500;
  747. document.documentElement.scrollLeft = 500;
  748. cb();
  749. } },
  750. { description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden (body is scrollable)",
  751. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  752. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  753. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  754. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  755. expected: kScrollDown },
  756. { description: "Scroll to only bottom by oblique page wheel event with overflow-x: hidden (body is scrollable)",
  757. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  758. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  759. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  760. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  761. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  762. expected: kScrollDown },
  763. { description: "Scroll to only top by oblique pixel wheel event with overflow-x: hidden (body is scrollable)",
  764. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  765. deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
  766. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  767. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  768. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  769. expected: kScrollUp },
  770. { description: "Scroll to only top by oblique line wheel event with overflow-x: hidden (body is scrollable)",
  771. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  772. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  773. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  774. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  775. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  776. expected: kScrollUp },
  777. { description: "Scroll to only top by oblique page wheel event with overflow-x: hidden (body is scrollable)",
  778. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  779. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  780. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  781. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  782. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  783. expected: kScrollUp,
  784. cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
  785. { description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
  786. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  787. deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
  788. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  789. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  790. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  791. expected: kScrollRight,
  792. prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
  793. { description: "Scroll to only right by oblique line wheel event with overflow-y: hidden (body is scrollable)",
  794. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  795. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  796. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  797. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  798. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  799. expected: kScrollRight },
  800. { description: "Scroll to only right by oblique page wheel event with overflow-y: hidden (body is scrollable)",
  801. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  802. deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
  803. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1,
  804. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  805. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  806. expected: kScrollRight },
  807. { description: "Scroll to only left by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
  808. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  809. deltaX: -16.0, deltaY: -16.0, deltaZ: 0.0,
  810. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  811. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  812. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  813. expected: kScrollLeft },
  814. { description: "Scroll to only top by oblique line wheel event with overflow-y: hidden (body is scrollable)",
  815. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  816. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  817. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  818. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  819. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  820. expected: kScrollLeft },
  821. { description: "Scroll to only top by oblique page wheel event with overflow-y: hidden (body is scrollable)",
  822. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  823. deltaX: -1.0, deltaY: -1.0, deltaZ: 0.0,
  824. lineOrPageDeltaX: -1, lineOrPageDeltaY: -1,
  825. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
  826. shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
  827. expected: kScrollLeft,
  828. cleanup: function (cb) {
  829. gScrollableElement.style.overflowY = "auto";
  830. gScrollableElement.style.position = "static";
  831. gSpacerForBodyElement.style.width = "";
  832. gSpacerForBodyElement.style.height = "";
  833. cb();
  834. } },
  835. ];
  836. var description;
  837. var currentTestIndex = -1;
  838. var isXReverted = (aSettings.deltaMultiplierX < 0);
  839. var isYReverted = (aSettings.deltaMultiplierY < 0);
  840. function doNextTest()
  841. {
  842. if (++currentTestIndex >= kTests.length) {
  843. SimpleTest.executeSoon(aCallback);
  844. return;
  845. }
  846. gScrollableElement.scrollTop = 1000;
  847. gScrollableElement.scrollLeft = 1000;
  848. var currentTest = kTests[currentTestIndex];
  849. description = "doTestScroll(aSettings=" + aSettings.description + "), " + currentTest.description + ": ";
  850. if (currentTest.prepare) {
  851. currentTest.prepare(doTestCurrentScroll);
  852. } else {
  853. doTestCurrentScroll();
  854. }
  855. }
  856. function doTestCurrentScroll() {
  857. var currentTest = kTests[currentTestIndex];
  858. sendWheelAndWait(10, 10, currentTest.event, function () {
  859. if (currentTest.expected == kNoScroll) {
  860. is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
  861. is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
  862. } else {
  863. var scrollUp = !isYReverted ? (currentTest.expected & kScrollUp) :
  864. (currentTest.expected & kScrollDown);
  865. var scrollDown = !isYReverted ? (currentTest.expected & kScrollDown) :
  866. (currentTest.expected & kScrollUp);
  867. if (scrollUp) {
  868. ok(gScrollableElement.scrollTop < 1000, description + "not scrolled up, got " + gScrollableElement.scrollTop);
  869. } else if (scrollDown) {
  870. ok(gScrollableElement.scrollTop > 1000, description + "not scrolled down, got " + gScrollableElement.scrollTop);
  871. } else {
  872. is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
  873. }
  874. var scrollLeft = !isXReverted ? (currentTest.expected & kScrollLeft) :
  875. (currentTest.expected & kScrollRight);
  876. var scrollRight = !isXReverted ? (currentTest.expected & kScrollRight) :
  877. (currentTest.expected & kScrollLeft);
  878. if (scrollLeft) {
  879. ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
  880. } else if (scrollRight) {
  881. ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
  882. } else {
  883. is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
  884. }
  885. }
  886. if (currentTest.cleanup) {
  887. currentTest.cleanup(nextStep);
  888. } else {
  889. nextStep();
  890. }
  891. function nextStep() {
  892. winUtils.advanceTimeAndRefresh(100);
  893. doNextTest();
  894. }
  895. });
  896. }
  897. doNextTest();
  898. }
  899. function doTestZoom(aSettings, aCallback)
  900. {
  901. if ((aSettings.deltaMultiplierX != 1.0 && aSettings.deltaMultiplierX != -1.0) ||
  902. (aSettings.deltaMultiplierY != 1.0 && aSettings.deltaMultiplierY != -1.0)) {
  903. todo(false, "doTestZoom doesn't support to test with aSettings=" + aSettings.description);
  904. SimpleTest.executeSoon(aCallback);
  905. return;
  906. }
  907. const kNone = 0x00;
  908. const kPositive = 0x01;
  909. const kNegative = 0x02;
  910. const kUseX = 0x10;
  911. const kUseY = 0x20;
  912. const kTests = [
  913. { description: "by vertical/positive pixel event when its lineOrPageDeltaY is 0",
  914. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  915. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  916. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  917. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  918. expected: kNone },
  919. { description: "by vertical/positive pixel event when its lineOrPageDeltaY is 1",
  920. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  921. deltaX: 0.0, deltaY: 8.0, deltaZ: 0.0,
  922. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
  923. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  924. expected: kPositive | kUseY },
  925. { description: "by vertical/negative pixel event when its lineOrPageDeltaY is 0",
  926. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  927. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  928. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  929. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  930. expected: kNone },
  931. { description: "by vertical/negative pixel event when its lineOrPageDeltaY is -1",
  932. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  933. deltaX: 0.0, deltaY: -8.0, deltaZ: 0.0,
  934. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
  935. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  936. expected: kNegative | kUseY },
  937. { description: "by horizotal/positive pixel event when its lineOrPageDeltaX is 0",
  938. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  939. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  940. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  941. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  942. expected: kNone },
  943. { description: "by horizotal/positive pixel event when its lineOrPageDeltaX is 1",
  944. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  945. deltaX: 8.0, deltaY: 0.0, deltaZ: 0.0,
  946. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
  947. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  948. expected: kPositive | kUseX },
  949. { description: "by horizotal/negative pixel event when its lineOrPageDeltaX is 0",
  950. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  951. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  952. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  953. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  954. expected: kNone },
  955. { description: "by horizotal/negative pixel event when its lineOrPageDeltaX is -1",
  956. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  957. deltaX: -8.0, deltaY: 0.0, deltaZ: 0.0,
  958. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
  959. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  960. expected: kNegative | kUseX },
  961. { description: "by z pixel event",
  962. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  963. deltaX: 0.0, deltaY: 0.0, deltaZ: 16.0,
  964. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  965. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  966. expected: kNone },
  967. { description: "by vertical/positive line event when its lineOrPageDeltaY is 0",
  968. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  969. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  970. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  971. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  972. expected: kNone },
  973. { description: "by vertical/positive line event when its lineOrPageDeltaY is 1",
  974. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  975. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  976. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
  977. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  978. expected: kPositive | kUseY },
  979. { description: "by vertical/negative line event when its lineOrPageDeltaY is 0",
  980. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  981. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  982. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  983. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  984. expected: kNone },
  985. { description: "by vertical/negative line event when its lineOrPageDeltaY is -1",
  986. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  987. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  988. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
  989. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  990. expected: kNegative | kUseY },
  991. { description: "by horizotal/positive line event when its lineOrPageDeltaX is 0",
  992. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  993. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  994. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  995. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  996. expected: kNone },
  997. { description: "by horizotal/positive line event when its lineOrPageDeltaX is 1",
  998. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  999. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  1000. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
  1001. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1002. expected: kPositive | kUseX },
  1003. { description: "by horizotal/negative line event when its lineOrPageDeltaX is 0",
  1004. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1005. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  1006. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1007. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1008. expected: kNone },
  1009. { description: "by horizotal/negative line event when its lineOrPageDeltaX is -1",
  1010. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1011. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  1012. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
  1013. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1014. expected: kNegative | kUseX },
  1015. { description: "by z line event",
  1016. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1017. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  1018. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1019. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1020. expected: kNone },
  1021. { description: "by vertical/positive page event when its lineOrPageDeltaY is 0",
  1022. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1023. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  1024. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1025. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1026. expected: kNone },
  1027. { description: "by vertical/positive page event when its lineOrPageDeltaY is 1",
  1028. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1029. deltaX: 0.0, deltaY: 0.5, deltaZ: 0.0,
  1030. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1,
  1031. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1032. expected: kPositive | kUseY },
  1033. { description: "by vertical/negative page event when its lineOrPageDeltaY is 0",
  1034. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1035. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  1036. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1037. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1038. expected: kNone },
  1039. { description: "by vertical/negative page event when its lineOrPageDeltaY is -1",
  1040. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1041. deltaX: 0.0, deltaY: -0.5, deltaZ: 0.0,
  1042. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1,
  1043. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1044. expected: kNegative | kUseY },
  1045. { description: "by horizotal/positive page event when its lineOrPageDeltaX is 0",
  1046. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1047. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  1048. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1049. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1050. expected: kNone },
  1051. { description: "by horizotal/positive page event when its lineOrPageDeltaX is 1",
  1052. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1053. deltaX: 0.5, deltaY: 0.0, deltaZ: 0.0,
  1054. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0,
  1055. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1056. expected: kPositive | kUseX },
  1057. { description: "by horizotal/negative page event when its lineOrPageDeltaX is 0",
  1058. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1059. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  1060. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1061. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1062. expected: kNone },
  1063. { description: "by horizotal/negative page event when its lineOrPageDeltaX is -1",
  1064. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1065. deltaX: -0.5, deltaY: 0.0, deltaZ: 0.0,
  1066. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0,
  1067. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1068. expected: kNegative | kUseX },
  1069. { description: "by z page event",
  1070. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1071. deltaX: 0.0, deltaY: 0.0, deltaZ: 1.0,
  1072. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0,
  1073. expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0 },
  1074. expected: kNone },
  1075. ];
  1076. var description, currentTest;
  1077. var currentTestIndex = -1;
  1078. var isXReverted = (aSettings.deltaMultiplierX < 0);
  1079. var isYReverted = (aSettings.deltaMultiplierY < 0);
  1080. function doNextTest()
  1081. {
  1082. if (++currentTestIndex >= kTests.length) {
  1083. SimpleTest.executeSoon(aCallback);
  1084. return;
  1085. }
  1086. gScrollableElement.scrollTop = 1000;
  1087. gScrollableElement.scrollLeft = 1000;
  1088. currentTest = kTests[currentTestIndex];
  1089. description = "doTestZoom(aSettings=" + aSettings.description + "), ";
  1090. if (currentTest.expected == kNone) {
  1091. description += "Shouldn't ";
  1092. } else {
  1093. description += "Should ";
  1094. }
  1095. description += "zoom " + currentTest.description + ": ";
  1096. var event = currentTest.event;
  1097. event.ctrlKey = true;
  1098. // NOTE: Zooming might change scrollTop and scrollLeft by rounding fraction.
  1099. // This test assume that zoom happens synchronously and scrolling
  1100. // happens asynchronously.
  1101. var scrollTop = gScrollableElement.scrollTop;
  1102. var scrollLeft = gScrollableElement.scrollLeft;
  1103. sendWheelAndWait(10, 10, event, function () {
  1104. is(gScrollableElement.scrollTop, scrollTop, description + "scrolled vertical");
  1105. is(gScrollableElement.scrollLeft, scrollLeft, description + "scrolled horizontal");
  1106. if (!(currentTest.expected & (kNegative | kPositive))) {
  1107. is(SpecialPowers.getFullZoom(window), 1.0, description + "zoomed");
  1108. } else {
  1109. var isReverted = (currentTest.expected & kUseX) ? isXReverted :
  1110. (currentTest.expected & kUseY) ? isYReverted : false;
  1111. if ((!isReverted && (currentTest.expected & kNegative)) ||
  1112. (isReverted && (currentTest.expected & kPositive))) {
  1113. ok(SpecialPowers.getFullZoom(window) > 1.0,
  1114. description + "not zoomed in, got " + SpecialPowers.getFullZoom(window));
  1115. } else {
  1116. ok(SpecialPowers.getFullZoom(window) < 1.0,
  1117. description + "not zoomed out, got " + SpecialPowers.getFullZoom(window));
  1118. }
  1119. }
  1120. synthesizeKey("0", { accelKey: true });
  1121. onZoomReset(function () {
  1122. hitEventLoop(doNextTest, 20);
  1123. });
  1124. });
  1125. }
  1126. doNextTest();
  1127. }
  1128. function doTestZoomedScroll(aCallback)
  1129. {
  1130. var zoom = 1.0;
  1131. function setFullZoom(aWindow, aZoom)
  1132. {
  1133. zoom = aZoom;
  1134. SpecialPowers.setFullZoom(aWindow, aZoom);
  1135. }
  1136. function prepareTestZoomedPixelScroll()
  1137. {
  1138. // Reset zoom and store the scroll amount into the data.
  1139. synthesizeKey("0", { accelKey: true });
  1140. zoom = 1.0;
  1141. onZoomReset(testZoomedPixelScroll);
  1142. }
  1143. function testZoomedPixelScroll()
  1144. {
  1145. gScrollableElement.scrollTop = 1000;
  1146. gScrollableElement.scrollLeft = 1000;
  1147. // Ensure not to be in reflow.
  1148. hitEventLoop(function () {
  1149. function mousePixelScrollHandler(aEvent)
  1150. {
  1151. if (aEvent.axis == MouseScrollEvent.HORIZONTAL_AXIS) {
  1152. is(aEvent.detail, 16,
  1153. "doTestZoomedScroll: The detail of horizontal MozMousePixelScroll for pixel wheel event is wrong");
  1154. } else if (aEvent.axis == MouseScrollEvent.VERTICAL_AXIS) {
  1155. is(aEvent.detail, 16,
  1156. "doTestZoomedScroll: The detail of vertical MozMousePixelScroll for pixel wheel event is wrong");
  1157. } else {
  1158. ok(false, "doTestZoomedScroll: The axis of MozMousePixelScroll for pixel wheel event is invalid, got " + aEvent.axis);
  1159. }
  1160. }
  1161. function wheelHandler(aEvent)
  1162. {
  1163. is(aEvent.deltaX, 16.0 / zoom,
  1164. "doTestZoomedScroll: The deltaX of wheel for pixel is wrong");
  1165. is(aEvent.deltaY, 16.0 / zoom,
  1166. "doTestZoomedScroll: The deltaY of wheel for pixel is wrong");
  1167. }
  1168. window.addEventListener("MozMousePixelScroll", mousePixelScrollHandler, true);
  1169. window.addEventListener("wheel", wheelHandler, true);
  1170. var event = {
  1171. deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1172. deltaX: 16.0,
  1173. deltaY: 16.0,
  1174. lineOrPageDeltaX: 0,
  1175. lineOrPageDeltaY: 0
  1176. };
  1177. // wait scrolled actually.
  1178. sendWheelAndWait(10, 10, event, function () {
  1179. var scrolledX = gScrollableElement.scrollLeft;
  1180. var scrolledY = gScrollableElement.scrollTop;
  1181. ok(scrolledX > 1000,
  1182. "doTestZoomedScroll: scrolledX must be larger than 1000 for pixel wheel event, got " + scrolledX);
  1183. ok(scrolledY > 1000,
  1184. "doTestZoomedScroll: scrolledY must be larger than 1000 for pixel wheel event, got " + scrolledY);
  1185. // Zoom
  1186. setFullZoom(window, 2.0);
  1187. // Ensure not to be in reflow.
  1188. hitEventLoop(function () {
  1189. gScrollableElement.scrollTop = 1000;
  1190. gScrollableElement.scrollLeft = 1000;
  1191. var event = {
  1192. deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1193. deltaX: 16.0,
  1194. deltaY: 16.0,
  1195. lineOrPageDeltaX: 0,
  1196. lineOrPageDeltaY: 0
  1197. };
  1198. // wait scrolled actually.
  1199. sendWheelAndWait(10, 10, event, function () {
  1200. ok(Math.abs(gScrollableElement.scrollLeft - (1000 + (scrolledX - 1000) / 2)) <= 1,
  1201. "doTestZoomedScroll: zoomed horizontal scroll amount by pixel wheel event is different from normal, scrollLeft=" +
  1202. gScrollableElement.scrollLeft + ", scrolledX=" + scrolledX);
  1203. ok(Math.abs(gScrollableElement.scrollTop - (1000 + (scrolledY - 1000) / 2)) <= 1,
  1204. "doTestZoomedScroll: zoomed vertical scroll amount by pixel wheel event is different from normal, scrollTop=" +
  1205. gScrollableElement.scrollTop + ", scrolledY=" + scrolledY);
  1206. window.removeEventListener("MozMousePixelScroll", mousePixelScrollHandler, true);
  1207. window.removeEventListener("wheel", wheelHandler, true);
  1208. synthesizeKey("0", { accelKey: true });
  1209. onZoomReset(prepareTestZoomedLineScroll);
  1210. });
  1211. }, 20);
  1212. });
  1213. }, 20);
  1214. }
  1215. function prepareTestZoomedLineScroll()
  1216. {
  1217. // Reset zoom and store the scroll amount into the data.
  1218. synthesizeKey("0", { accelKey: true });
  1219. zoom = 1.0;
  1220. onZoomReset(testZoomedLineScroll);
  1221. }
  1222. function testZoomedLineScroll()
  1223. {
  1224. gScrollableElement.scrollTop = 1000;
  1225. gScrollableElement.scrollLeft = 1000;
  1226. // Ensure not to be in reflow.
  1227. hitEventLoop(function () {
  1228. var lineHeightX, lineHeightY;
  1229. function handler(aEvent)
  1230. {
  1231. if (aEvent.axis == MouseScrollEvent.HORIZONTAL_AXIS) {
  1232. if (lineHeightX == undefined) {
  1233. lineHeightX = aEvent.detail;
  1234. } else {
  1235. ok(Math.abs(aEvent.detail - lineHeightX) <= 1,
  1236. "doTestZoomedScroll: The detail of horizontal MozMousePixelScroll for line wheel event is wrong, aEvent.detail=" +
  1237. aEvent.detail + ", lineHeightX=" + lineHeightX);
  1238. }
  1239. } else if (aEvent.axis == MouseScrollEvent.VERTICAL_AXIS) {
  1240. if (lineHeightY == undefined) {
  1241. lineHeightY = aEvent.detail;
  1242. } else {
  1243. ok(Math.abs(aEvent.detail - lineHeightY) <= 1,
  1244. "doTestZoomedScroll: The detail of vertical MozMousePixelScroll for line wheel event is wrong, aEvent.detail=" +
  1245. aEvent.detail + ", lineHeightY=" + lineHeightY);
  1246. }
  1247. } else {
  1248. ok(false, "doTestZoomedScroll: The axis of MozMousePixelScroll for line wheel event is invalid, got " + aEvent.axis);
  1249. }
  1250. }
  1251. window.addEventListener("MozMousePixelScroll", handler, true);
  1252. var event = {
  1253. deltaMode: WheelEvent.DOM_DELTA_LINE,
  1254. deltaX: 1.0,
  1255. deltaY: 1.0,
  1256. lineOrPageDeltaX: 1,
  1257. lineOrPageDeltaY: 1
  1258. };
  1259. // wait scrolled actually.
  1260. sendWheelAndWait(10, 10, event, function () {
  1261. var scrolledX = gScrollableElement.scrollLeft;
  1262. var scrolledY = gScrollableElement.scrollTop;
  1263. ok(scrolledX > 1000,
  1264. "doTestZoomedScroll: scrolledX must be larger than 1000 for line wheel event, got " + scrolledX);
  1265. ok(scrolledY > 1000,
  1266. "doTestZoomedScroll: scrolledY must be larger than 1000 for line wheel event, got " + scrolledY);
  1267. // Zoom
  1268. setFullZoom(window, 2.0);
  1269. // Ensure not to be in reflow.
  1270. hitEventLoop(function () {
  1271. gScrollableElement.scrollTop = 1000;
  1272. gScrollableElement.scrollLeft = 1000;
  1273. var event = {
  1274. deltaMode: WheelEvent.DOM_DELTA_LINE,
  1275. deltaX: 1.0,
  1276. deltaY: 1.0,
  1277. lineOrPageDeltaX: 1,
  1278. lineOrPageDeltaY: 1
  1279. };
  1280. // wait scrolled actually.
  1281. sendWheelAndWait(10, 10, event, function () {
  1282. ok(Math.abs(gScrollableElement.scrollLeft - scrolledX) <= 1,
  1283. "doTestZoomedScroll: zoomed horizontal scroll amount by line wheel event is different from normal, scrollLeft=" +
  1284. gScrollableElement.scrollLeft + ", scrolledX=" + scrolledX);
  1285. ok(Math.abs(gScrollableElement.scrollTop - scrolledY) <= 1,
  1286. "doTestZoomedScroll: zoomed vertical scroll amount by line wheel event is different from normal, scrollTop=" +
  1287. gScrollableElement.scrollTop + ", scrolledY=" + scrolledY);
  1288. window.removeEventListener("MozMousePixelScroll", handler, true);
  1289. synthesizeKey("0", { accelKey: true });
  1290. onZoomReset(aCallback);
  1291. });
  1292. }, 20);
  1293. });
  1294. }, 20);
  1295. }
  1296. // XXX It's too difficult to test page scroll because the page scroll amount
  1297. // is computed by complex logic.
  1298. prepareTestZoomedPixelScroll();
  1299. }
  1300. function doTestWholeScroll(aCallback)
  1301. {
  1302. SpecialPowers.pushPrefEnv({"set": [
  1303. ["mousewheel.default.delta_multiplier_x", 999999],
  1304. ["mousewheel.default.delta_multiplier_y", 999999]]},
  1305. function() { doTestWholeScroll2(aCallback); });
  1306. }
  1307. function doTestWholeScroll2(aCallback)
  1308. {
  1309. const kTests = [
  1310. { description: "try whole-scroll to top (line)",
  1311. prepare: function () {
  1312. gScrollableElement.scrollTop = 1000;
  1313. gScrollableElement.scrollLeft = 1000;
  1314. },
  1315. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1316. deltaX: 0.0, deltaY: -1.0,
  1317. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
  1318. expectedScrollTop: 0,
  1319. expectedScrollLeft: 1000
  1320. },
  1321. { description: "try whole-scroll to top when scrollTop is already top-most (line)",
  1322. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1323. deltaX: 0.0, deltaY: -1.0,
  1324. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
  1325. expectedScrollTop: 0,
  1326. expectedScrollLeft: 1000
  1327. },
  1328. { description: "try whole-scroll to bottom (line)",
  1329. prepare: function () {
  1330. gScrollableElement.scrollTop = 1000;
  1331. gScrollableElement.scrollLeft = 1000;
  1332. },
  1333. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1334. deltaX: 0.0, deltaY: 1.0,
  1335. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
  1336. expectedScrollTop: gScrollableElement.scrollTopMax,
  1337. expectedScrollLeft: 1000
  1338. },
  1339. { description: "try whole-scroll to bottom when scrollTop is already bottom-most (line)",
  1340. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1341. deltaX: 0, deltaY: 1.0,
  1342. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
  1343. expectedScrollTop: gScrollableElement.scrollTopMax,
  1344. expectedScrollLeft: 1000
  1345. },
  1346. { description: "try whole-scroll to left (line)",
  1347. prepare: function () {
  1348. gScrollableElement.scrollTop = 1000;
  1349. gScrollableElement.scrollLeft = 1000;
  1350. },
  1351. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1352. deltaX: -1.0, deltaY: 0.0,
  1353. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
  1354. expectedScrollTop: 1000,
  1355. expectedScrollLeft: 0
  1356. },
  1357. { description: "try whole-scroll to left when scrollLeft is already left-most (line)",
  1358. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1359. deltaX: -1.0, deltaY: 0,
  1360. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
  1361. expectedScrollTop: 1000,
  1362. expectedScrollLeft: 0
  1363. },
  1364. { description: "try whole-scroll to right (line)",
  1365. prepare: function () {
  1366. gScrollableElement.scrollTop = 1000;
  1367. gScrollableElement.scrollLeft = 1000;
  1368. },
  1369. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1370. deltaX: 1.0, deltaY: 0.0,
  1371. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
  1372. expectedScrollTop: 1000,
  1373. expectedScrollLeft: gScrollableElement.scrollLeftMax
  1374. },
  1375. { description: "try whole-scroll to right when scrollLeft is already right-most (line)",
  1376. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1377. deltaX: 1.0, deltaY: 0.0,
  1378. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
  1379. expectedScrollTop: 1000,
  1380. expectedScrollLeft: gScrollableElement.scrollLeftMax
  1381. },
  1382. { description: "try whole-scroll to top (pixel)",
  1383. prepare: function () {
  1384. gScrollableElement.scrollTop = 1000;
  1385. gScrollableElement.scrollLeft = 1000;
  1386. },
  1387. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1388. deltaX: 0.0, deltaY: -1.0,
  1389. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1390. expectedScrollTop: 0,
  1391. expectedScrollLeft: 1000
  1392. },
  1393. { description: "try whole-scroll to top when scrollTop is already top-most (pixel)",
  1394. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1395. deltaX: 0.0, deltaY: -1.0,
  1396. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1397. expectedScrollTop: 0,
  1398. expectedScrollLeft: 1000
  1399. },
  1400. { description: "try whole-scroll to bottom (pixel)",
  1401. prepare: function () {
  1402. gScrollableElement.scrollTop = 1000;
  1403. gScrollableElement.scrollLeft = 1000;
  1404. },
  1405. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1406. deltaX: 0.0, deltaY: 1.0,
  1407. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1408. expectedScrollTop: gScrollableElement.scrollTopMax,
  1409. expectedScrollLeft: 1000
  1410. },
  1411. { description: "try whole-scroll to bottom when scrollTop is already bottom-most (pixel)",
  1412. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1413. deltaX: 0, deltaY: 1.0,
  1414. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1415. expectedScrollTop: gScrollableElement.scrollTopMax,
  1416. expectedScrollLeft: 1000
  1417. },
  1418. { description: "try whole-scroll to left (pixel)",
  1419. prepare: function () {
  1420. gScrollableElement.scrollTop = 1000;
  1421. gScrollableElement.scrollLeft = 1000;
  1422. },
  1423. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1424. deltaX: -1.0, deltaY: 0.0,
  1425. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1426. expectedScrollTop: 1000,
  1427. expectedScrollLeft: 0
  1428. },
  1429. { description: "try whole-scroll to left when scrollLeft is already left-most (pixel)",
  1430. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1431. deltaX: -1.0, deltaY: 0,
  1432. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1433. expectedScrollTop: 1000,
  1434. expectedScrollLeft: 0
  1435. },
  1436. { description: "try whole-scroll to right (pixel)",
  1437. prepare: function () {
  1438. gScrollableElement.scrollTop = 1000;
  1439. gScrollableElement.scrollLeft = 1000;
  1440. },
  1441. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1442. deltaX: 1.0, deltaY: 0.0,
  1443. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1444. expectedScrollTop: 1000,
  1445. expectedScrollLeft: gScrollableElement.scrollLeftMax
  1446. },
  1447. { description: "try whole-scroll to right when scrollLeft is already right-most (pixel)",
  1448. event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
  1449. deltaX: 1.0, deltaY: 0.0,
  1450. lineOrPageDeltaX: 0, lineOrPageDeltaY: 0 },
  1451. expectedScrollTop: 1000,
  1452. expectedScrollLeft: gScrollableElement.scrollLeftMax
  1453. },
  1454. { description: "try whole-scroll to top (page)",
  1455. prepare: function () {
  1456. gScrollableElement.scrollTop = 1000;
  1457. gScrollableElement.scrollLeft = 1000;
  1458. },
  1459. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1460. deltaX: 0.0, deltaY: -1.0,
  1461. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
  1462. expectedScrollTop: 0,
  1463. expectedScrollLeft: 1000
  1464. },
  1465. { description: "try whole-scroll to top when scrollTop is already top-most (page)",
  1466. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1467. deltaX: 0.0, deltaY: -1.0,
  1468. lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
  1469. expectedScrollTop: 0,
  1470. expectedScrollLeft: 1000
  1471. },
  1472. { description: "try whole-scroll to bottom (page)",
  1473. prepare: function () {
  1474. gScrollableElement.scrollTop = 1000;
  1475. gScrollableElement.scrollLeft = 1000;
  1476. },
  1477. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1478. deltaX: 0.0, deltaY: 1.0,
  1479. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
  1480. expectedScrollTop: gScrollableElement.scrollTopMax,
  1481. expectedScrollLeft: 1000
  1482. },
  1483. { description: "try whole-scroll to bottom when scrollTop is already bottom-most (page)",
  1484. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1485. deltaX: 0, deltaY: 1.0,
  1486. lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
  1487. expectedScrollTop: gScrollableElement.scrollTopMax,
  1488. expectedScrollLeft: 1000
  1489. },
  1490. { description: "try whole-scroll to left (page)",
  1491. prepare: function () {
  1492. gScrollableElement.scrollTop = 1000;
  1493. gScrollableElement.scrollLeft = 1000;
  1494. },
  1495. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1496. deltaX: -1.0, deltaY: 0.0,
  1497. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
  1498. expectedScrollTop: 1000,
  1499. expectedScrollLeft: 0
  1500. },
  1501. { description: "try whole-scroll to left when scrollLeft is already left-most (page)",
  1502. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1503. deltaX: -1.0, deltaY: 0,
  1504. lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
  1505. expectedScrollTop: 1000,
  1506. expectedScrollLeft: 0
  1507. },
  1508. { description: "try whole-scroll to right (page)",
  1509. prepare: function () {
  1510. gScrollableElement.scrollTop = 1000;
  1511. gScrollableElement.scrollLeft = 1000;
  1512. },
  1513. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1514. deltaX: 1.0, deltaY: 0.0,
  1515. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
  1516. expectedScrollTop: 1000,
  1517. expectedScrollLeft: gScrollableElement.scrollLeftMax
  1518. },
  1519. { description: "try whole-scroll to right when scrollLeft is already right-most (page)",
  1520. event: { deltaMode: WheelEvent.DOM_DELTA_PAGE,
  1521. deltaX: 1.0, deltaY: 0.0,
  1522. lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
  1523. expectedScrollTop: 1000,
  1524. expectedScrollLeft: gScrollableElement.scrollLeftMax
  1525. },
  1526. ];
  1527. var index = 0;
  1528. function doIt()
  1529. {
  1530. const kTest = kTests[index];
  1531. if (kTest.prepare) {
  1532. kTest.prepare();
  1533. }
  1534. sendWheelAndWait(10, 10, kTest.event, function () {
  1535. is(gScrollableElement.scrollTop, kTest.expectedScrollTop,
  1536. "doTestWholeScroll, " + kTest.description + ": unexpected scrollTop");
  1537. is(gScrollableElement.scrollLeft, kTest.expectedScrollLeft,
  1538. "doTestWholeScroll, " + kTest.description + ": unexpected scrollLeft");
  1539. if (++index == kTests.length) {
  1540. SimpleTest.executeSoon(aCallback);
  1541. } else {
  1542. doIt();
  1543. }
  1544. });
  1545. }
  1546. doIt();
  1547. }
  1548. function doTestActionOverride(aCallback)
  1549. {
  1550. const kNoScroll = 0x00;
  1551. const kScrollUp = 0x01;
  1552. const kScrollDown = 0x02;
  1553. const kScrollLeft = 0x04;
  1554. const kScrollRight = 0x08;
  1555. const kTests = [
  1556. { action: 1, override_x: -1,
  1557. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1558. deltaX: 1.0, deltaY: 1.0,
  1559. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1560. expected: kScrollDown | kScrollRight
  1561. },
  1562. { action: 1, override_x: 0,
  1563. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1564. deltaX: 1.0, deltaY: 1.0,
  1565. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1566. expected: kScrollDown | kScrollRight
  1567. },
  1568. { action: 1, override_x: 1,
  1569. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1570. deltaX: 1.0, deltaY: 1.0,
  1571. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1572. expected: kScrollDown | kScrollRight
  1573. },
  1574. { action: 0, override_x: -1,
  1575. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1576. deltaX: 1.0, deltaY: 1.0,
  1577. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1578. expected: kNoScroll
  1579. },
  1580. { action: 0, override_x: 0,
  1581. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1582. deltaX: 1.0, deltaY: 1.0,
  1583. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1584. expected: kNoScroll
  1585. },
  1586. { action: 0, override_x: 1,
  1587. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1588. deltaX: 1.0, deltaY: 1.0,
  1589. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1590. expected: kNoScroll
  1591. },
  1592. { action: 1, override_x: -1,
  1593. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1594. deltaX: 1.0, deltaY: 0.5,
  1595. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1596. expected: kScrollDown | kScrollRight
  1597. },
  1598. { action: 1, override_x: 0,
  1599. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1600. deltaX: 1.0, deltaY: 0.5,
  1601. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1602. expected: kNoScroll
  1603. },
  1604. { action: 1, override_x: 1,
  1605. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1606. deltaX: 1.0, deltaY: 0.5,
  1607. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1608. expected: kScrollDown | kScrollRight
  1609. },
  1610. { action: 0, override_x: -1,
  1611. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1612. deltaX: 1.0, deltaY: 0.5,
  1613. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1614. expected: kNoScroll
  1615. },
  1616. { action: 0, override_x: 0,
  1617. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1618. deltaX: 1.0, deltaY: 0.5,
  1619. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1620. expected: kNoScroll
  1621. },
  1622. { action: 0, override_x: 1,
  1623. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1624. deltaX: 1.0, deltaY: 0.5,
  1625. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1626. expected: kScrollDown | kScrollRight
  1627. },
  1628. { action: 1, override_x: -1,
  1629. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1630. deltaX: 0.5, deltaY: 1.0,
  1631. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1632. expected: kScrollDown | kScrollRight
  1633. },
  1634. { action: 1, override_x: 0,
  1635. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1636. deltaX: 0.5, deltaY: 1.0,
  1637. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1638. expected: kScrollDown | kScrollRight
  1639. },
  1640. { action: 1, override_x: 1,
  1641. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1642. deltaX: 0.5, deltaY: 1.0,
  1643. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1644. expected: kScrollDown | kScrollRight
  1645. },
  1646. { action: 0, override_x: -1,
  1647. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1648. deltaX: 0.5, deltaY: 1.0,
  1649. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1650. expected: kNoScroll
  1651. },
  1652. { action: 0, override_x: 0,
  1653. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1654. deltaX: 0.5, deltaY: 1.0,
  1655. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1656. expected: kNoScroll
  1657. },
  1658. { action: 0, override_x: 1,
  1659. event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
  1660. deltaX: 0.5, deltaY: 1.0,
  1661. lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
  1662. expected: kNoScroll
  1663. },
  1664. ];
  1665. var index = 0;
  1666. function doIt()
  1667. {
  1668. const kTest = kTests[index];
  1669. SpecialPowers.pushPrefEnv({"set": [
  1670. ["mousewheel.default.action", kTest.action],
  1671. ["mousewheel.default.action.override_x", kTest.override_x]]},
  1672. doIt2
  1673. );
  1674. }
  1675. function doIt2()
  1676. {
  1677. const kTest = kTests[index];
  1678. description = "doTestActionOverride(action=" + kTest.action + ", " +
  1679. "override_x=" + kTest.override_x + ", " +
  1680. "deltaX=" + kTest.event.deltaX + ", " +
  1681. "deltaY=" + kTest.event.deltaY + "): ";
  1682. gScrollableElement.scrollTop = 1000;
  1683. gScrollableElement.scrollLeft = 1000;
  1684. sendWheelAndWait(10, 10, kTest.event, function () {
  1685. if (kTest.expected & kScrollUp) {
  1686. ok(gScrollableElement.scrollTop < 1000, description + "not scrolled up, got " + gScrollableElement.scrollTop);
  1687. } else if (kTest.expected & kScrollDown) {
  1688. ok(gScrollableElement.scrollTop > 1000, description + "not scrolled down, got " + gScrollableElement.scrollTop);
  1689. } else {
  1690. is(gScrollableElement.scrollTop, 1000, description + "scrolled vertical");
  1691. }
  1692. if (kTest.expected & kScrollLeft) {
  1693. ok(gScrollableElement.scrollLeft < 1000, description + "not scrolled to left, got " + gScrollableElement.scrollLeft);
  1694. } else if (kTest.expected & kScrollRight) {
  1695. ok(gScrollableElement.scrollLeft > 1000, description + "not scrolled to right, got " + gScrollableElement.scrollLeft);
  1696. } else {
  1697. is(gScrollableElement.scrollLeft, 1000, description + "scrolled horizontal");
  1698. }
  1699. if (++index == kTests.length) {
  1700. SimpleTest.executeSoon(aCallback);
  1701. } else {
  1702. doIt();
  1703. }
  1704. });
  1705. }
  1706. doIt();
  1707. }
  1708. function runTests()
  1709. {
  1710. SpecialPowers.pushPrefEnv({"set": [
  1711. ["test.events.async.enabled", true],
  1712. ["general.smoothScroll", false],
  1713. ["mousewheel.default.action", 1], // scroll
  1714. ["mousewheel.default.action.override_x", -1],
  1715. ["mousewheel.with_shift.action", 2], // history
  1716. ["mousewheel.with_shift.action.override_x", -1],
  1717. ["mousewheel.with_control.action", 3], // zoom
  1718. ["mousewheel.with_control.action.override_x", -1]]},
  1719. runTests2);
  1720. }
  1721. function runTests2()
  1722. {
  1723. const kSettings = [
  1724. { description: "all delta values are not customized",
  1725. deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
  1726. { description: "deltaX is reverted",
  1727. deltaMultiplierX: -1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
  1728. { description: "deltaY is reverted",
  1729. deltaMultiplierX: 1.0, deltaMultiplierY: -1.0, deltaMultiplierZ: 1.0 },
  1730. { description: "deltaZ is reverted",
  1731. deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: -1.0 },
  1732. { description: "deltaX is 2.0",
  1733. deltaMultiplierX: 2.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
  1734. { description: "deltaY is 2.0",
  1735. deltaMultiplierX: 1.0, deltaMultiplierY: 2.0, deltaMultiplierZ: 1.0 },
  1736. { description: "deltaZ is 2.0",
  1737. deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 2.0 },
  1738. { description: "deltaX is -2.0",
  1739. deltaMultiplierX: -2.0, deltaMultiplierY: 1.0, deltaMultiplierZ: 1.0 },
  1740. { description: "deltaY is -2.0",
  1741. deltaMultiplierX: 1.0, deltaMultiplierY: -2.0, deltaMultiplierZ: 1.0 },
  1742. { description: "deltaZ is -2.0",
  1743. deltaMultiplierX: 1.0, deltaMultiplierY: 1.0, deltaMultiplierZ: -2.0 },
  1744. ];
  1745. var index = 0;
  1746. function doTest() {
  1747. setDeltaMultiplierSettings(kSettings[index], function () {
  1748. doTestScroll(kSettings[index], function () {
  1749. doTestZoom(kSettings[index], function() {
  1750. if (++index == kSettings.length) {
  1751. setDeltaMultiplierSettings(kSettings[0], function() {
  1752. doTestZoomedScroll(function() {
  1753. doTestWholeScroll(function() {
  1754. doTestActionOverride(function() {
  1755. finishTests();
  1756. });
  1757. });
  1758. });
  1759. });
  1760. } else {
  1761. doTest();
  1762. }
  1763. });
  1764. });
  1765. });
  1766. }
  1767. doTest();
  1768. }
  1769. function finishTests()
  1770. {
  1771. winUtils.restoreNormalRefresh();
  1772. window.opener.finish();
  1773. }
  1774. </script>
  1775. </pre>
  1776. </body>
  1777. </html>