Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/gfx/layers/apz/test/mochitest/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 4 kB image not shown  

Quelle  helper_key_scroll.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/gfx/layers/apz/test/mochitest/helper_key_scroll.html


<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
-->

<head>
  <meta charset="utf-8">
  <title>Async key scrolling test, helper page</title>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script type="application/javascript">
    // --------------------------------------------------------------------
    // Async key scrolling test
    //
    // This test checks that a key scroll occurs asynchronously.
    //
    // The page contains a <div> that is large enough to make the page
    // scrollable. We first synthesize a page down to scroll to the bottom
    // of the page. Once we have reached the bottom of the page, we synthesize
    // a page up to get us back to the top of the page.
    //
    // Once at the top, we request test data from APZ, rebuild the APZC tree
    // structure, and use it to check that async key scrolling happened.
    // --------------------------------------------------------------------

    async function test() {
      // Sanity check
      is(checkHasAsyncKeyScrolled(), false, "expected no async key scrolling before test");

      // Send a key to initiate a page scroll to take us to the bottom of the
      // page. This scroll is done synchronously because APZ doesn't have
      // current focus state at page load.
      let scrollBottomPromise = new Promise(resolve => {
        let checkBottom = function() {
          if (window.scrollY < window.scrollMaxY) {
            return;
          }
          info("Reached final scroll position of sync KEY_End scroll");
          window.removeEventListener("scroll", checkBottom);
          resolve();
        };
        window.addEventListener("scroll", checkBottom);
      });

      window.synthesizeKey("KEY_End");
      await scrollBottomPromise;

      // Spin the refresh driver a few times, so that the AsyncScroll instance
      // that was running the main-thread scroll animation finishes up and
      // triggers any repaints that it needs to.
      var utils = SpecialPowers.DOMWindowUtils;
      for (var i = 0; i < 10; i++) {
        utils.advanceTimeAndRefresh(50);
      }
      utils.restoreNormalRefresh();

      // Wait for the APZ to reach a stable state as well, before dispatching
      // the next key input or the default action won't occur.
      await promiseApzFlushedRepaints();

      is(checkHasAsyncKeyScrolled(), false, "expected no async key scrolling before KEY_Home dispatch");

      // This scroll should be asynchronous now that the focus state is up to date.
      let scrollTopPromise = new Promise(resolve => {
        let checkTop = function() {
          if (window.scrollY > 0) {
            return;
          }
          info("Reached final scroll position of async KEY_Home scroll");
          window.removeEventListener("scroll", checkTop);
          resolve();
        };
        window.addEventListener("scroll", checkTop);
      });

      window.synthesizeKey("KEY_Home");
      await scrollTopPromise;

      // Wait for APZ to settle and then check that async scrolling happened.
      await promiseApzFlushedRepaints();
      is(checkHasAsyncKeyScrolled(), true, "expected async key scrolling after test");
    }

    function checkHasAsyncKeyScrolled() {
      // Reconstruct the APZC tree structure in the last paint.
      var apzcTree = getLastApzcTree();
      var rcd = findRcdNode(apzcTree);

      if (rcd) {
        return rcd.hasAsyncKeyScrolled === "1";
      }

      info("Last paint rcd is null");
      return false;
    }

    waitUntilApzStable()
      .then(forceLayerTreeToCompositor)
      .then(test)
      .then(subtestDone, subtestFailed);
  </script>
</head>
<body style="height: 500px; overflow: scroll">
  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1383365">Async key scrolling test</a>
  <!-- Put enough content into the page to make it have a nonzero scroll range -->
  <div style="height: 5000px"></div>
</body>
</html>

Messung V0.5
C=90 H=100 G=95

¤ Dauer der Verarbeitung: 0.23 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.