tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_group_wheelevents.html (4057B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Various wheel-scrolling tests that spawn in new windows</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <script type="application/javascript" src="apz_test_utils.js"></script>
      8  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <script type="application/javascript">
     11 
     12 var prefs = [
     13  // turn off smooth scrolling so that we don't have to wait for
     14  // APZ animations to finish before sampling the scroll offset
     15  ["general.smoothScroll", false],
     16  // ensure that any mouse movement will trigger a new wheel transaction,
     17  // because in this test we move the mouse a bunch and want to recalculate
     18  // the target APZC after each such movement.
     19  ["mousewheel.transaction.ignoremovedelay", 0],
     20  ["mousewheel.transaction.timeout", 0],
     21 ];
     22 
     23 var wheel_transaction_prefs = [
     24  ["dom.event.wheel-event-groups.enabled", true],
     25  ["mousewheel.transaction.timeout", 10000],
     26  ["apz.test.mac.synth_wheel_input", true],
     27  ...getSmoothScrollPrefs("wheel"),
     28 ];
     29 
     30 // For helper_scroll_over_scrollbar, we need to set a pref to force
     31 // layerization of the scrollbar track to reproduce the bug being fixed.
     32 // Otherwise, the bug only manifests with overlay scrollbars on macOS,
     33 // or in a XUL RCD, both of which are hard to materialize in a test.
     34 var scrollbar_prefs = prefs.slice(); // make a copy
     35 scrollbar_prefs.push(["layout.scrollbars.always-layerize-track", true]);
     36 
     37 // For helper_overscroll_behavior_bug1425573, we need to set the APZ content
     38 // response timeout to 0, so we exercise the fallback codepath.
     39 var timeout_prefs = prefs.slice(); // make a copy
     40 timeout_prefs.push(["apz.content_response_timeout", 0]);
     41 
     42 var smoothness_prefs = getSmoothScrollPrefs("wheel");
     43 
     44 var subtests = [
     45  {"file": "helper_scroll_on_position_fixed.html", "prefs": prefs},
     46  {"file": "helper_bug1271432.html", "prefs": prefs},
     47  {"file": "helper_overscroll_behavior_bug1425573.html", "prefs": timeout_prefs},
     48  {"file": "helper_overscroll_behavior_bug1425603.html", "prefs": prefs},
     49  {"file": "helper_overscroll_behavior_bug1494440.html", "prefs": prefs},
     50  {"file": "helper_scroll_inactive_perspective.html", "prefs": prefs},
     51  {"file": "helper_scroll_inactive_zindex.html", "prefs": prefs},
     52  {"file": "helper_scroll_over_scrollbar.html", "prefs": scrollbar_prefs},
     53  {"file": "helper_scroll_tables_perspective.html", "prefs": prefs},
     54  {"file": "helper_transform_end_on_wheel_scroll.html",
     55    prefs: [["general.smoothScroll", false],
     56             ["apz.test.mac.synth_wheel_input", true]]},
     57  {"file": "helper_scroll_anchoring_on_wheel.html", prefs: smoothness_prefs},
     58  {"file": "helper_scroll_over_subframe.html?scroll=wheel", prefs: wheel_transaction_prefs},
     59  {"file": "helper_scroll_over_subframe.html?oop=true&scroll=wheel", prefs: wheel_transaction_prefs},
     60  {"file": "helper_custom_scrolling_bug1932985.html", prefs: [
     61    ["general.smoothScroll", true],
     62    ...smoothness_prefs
     63  ]},
     64  {"file": "helper_custom_scrolling_bug1932985.html?touchpad", prefs: [
     65    ["general.smoothScroll", true],
     66    ...smoothness_prefs
     67  ]}
     68 ];
     69 
     70 subtests.push(...buildRelativeScrollSmoothnessVariants("wheel", ["scrollBy", "scrollTo", "scrollTop"]));
     71 
     72 // Only Windows has the test api implemented for this test.
     73 if (getPlatform() == "windows") {
     74  subtests.push(
     75    {"file": "helper_dommousescroll.html", "prefs": prefs}
     76  );
     77 } else if (getPlatform() == "mac") {
     78  // TODO: Bug 1904439 tracks re-enabling these checks.
     79  subtests.push(...[
     80    {"file": "helper_scroll_over_subframe.html?scroll=pan", prefs: wheel_transaction_prefs},
     81    {"file": "helper_scroll_over_subframe.html?oop=true&scroll=pan", prefs: wheel_transaction_prefs},
     82  ]);
     83 }
     84 
     85 if (isApzEnabled()) {
     86  SimpleTest.waitForExplicitFinish();
     87  window.onload = function() {
     88    runSubtestsSeriallyInFreshWindows(subtests)
     89    .then(SimpleTest.finish, SimpleTest.finishWithFailure);
     90  };
     91 }
     92 
     93  </script>
     94 </head>
     95 <body>
     96 </body>
     97 </html>