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 2 kB image not shown  

Quelle  helper_tap_passive.html   Sprache: HTML

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


<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Ensure APZ doesn't wait for passive listeners
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript">

var touchdownTime;

async function longPressLink() {
  await synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
    dump("Finished synthesizing touch-start, waiting for events...\n");
  });
}

var touchstartReceived = false;
function recordEvent(e) {
  if (!touchstartReceived) {
    touchstartReceived = true;
    is(e.type, "touchstart""Got a touchstart");
    e.preventDefault(); // should be a no-op because it's a passive listener
    return;
  }

  // If APZ decides to wait for the content response on a particular input block,
  // it needs to wait until both the touchstart and touchmove event are handled
  // by the main thread. In this case there is no touchmove at all, so APZ would
  // end up waiting indefinitely and time out the test. The fact that we get this
  // contextmenu event (mouselongtap on Windows) at all means that APZ decided
  // not to wait for the content response, which is the desired behaviour, since
  // the touchstart listener was registered as a passive listener.
  if (getPlatform() == "windows") {
    is(e.type, "mouselongtap""Got a mouselongtap");
  } else {
    is(e.type, "contextmenu""Got a contextmenu");
  }
  e.preventDefault();

  setTimeout(async () => {
    // On Windows below TOUCH_REMOVE event triggers opening a context menu, we
    // need to prevent it.
    const contextmenuPromise = promiseOneEvent(window, "contextmenu", event => {
      event.preventDefault();
      return true;
    });
    const touchendPromise = promiseOneEvent(window, "touchend", () => {
      return true;
    });
    await synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
      dump("Finished synthesizing touch-end to clear state; finishing test...\n");
    });

    await touchendPromise;
    if (getPlatform() == "windows") {
      await contextmenuPromise;
    }
    subtestDone();
  }, 0);
}

window.addEventListener("touchstart", recordEvent, { passive: true, capture: true });
if (getPlatform() == "windows") {
  SpecialPowers.addChromeEventListener("mouselongtap", recordEvent, true);
} else {
  window.addEventListener("contextmenu", recordEvent, true);
}

waitUntilApzStable()
.then(longPressLink);

  </script>
</head>
<body>
 <a id="b" href="#">Link to nowhere</a>
</body>
</html>

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

¤ Dauer der Verarbeitung: 0.25 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.