author James Teh <>
Wed, 01 Feb 2023 05:02:01 +0000
changeset 651150 dd0fdd1daa69783be36acd5c50544f3694eaa8f9
parent 568166 73824cc3c66a3aa170d3b0c688e7dee58d06f1d7
permissions -rw-r--r--
Bug 1813980: Check IsDoc before Parent in RemoteAccessibleBase::ApplyCrossDocOffset. r=morgan We call this function on every ancestor when calculating bounds. RemoteParent() currently requires a hash lookup, so it's more efficient to early return for !IsDoc() first. This is a micro-optimisation, but it might have some impact given that we call this on every ancestor, especially when hit testing, where we call Bounds() a lot. As a bit of drive-by cleanup, use RemoteParent() rather than calling Parent() and IsRemote/AsRemote(). Differential Revision:

  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Inactive iframe with overscroll-behavior</title>
  <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>
  <iframe id="scroll" srcdoc="<!doctype html><html style='overscroll-behavior:none; overflow: auto;'><div style='width:100px;height:2000px;'>">
  <div style="height: 5000px;"></div><!-- So the page is scrollable as well -->

  <script type="application/javascript">

async function test() {
  var iframe = document.getElementById("scroll");
  var iframeWindow = iframe.contentWindow;

  // scroll the iframe to the bottom, such that a subsequent scroll on it
  // _would_ hand off to the page if overscroll-behavior allowed it
  iframeWindow.scrollTo(0, iframeWindow.scrollMaxY);
  await promiseApzFlushedRepaints();
  is(iframeWindow.scrollY, iframeWindow.scrollMaxY, "iframe has scrolled to the bottom");

  // Scroll over the iframe, and make sure that the page
  // does not scroll.
  // We can't wait for a "scroll" event unconditionally, since if the platform
  // behaviour we are testing is correct (overscroll-behavior is respected),
  // one will never arrive.
  var waitForScroll = false;
  await promiseMoveMouseAndScrollWheelOver(iframeWindow, 100, 100, waitForScroll);
  // However, we need to give a potential "scroll" event a chance to be dispatched,
  // so that if the platform behaviour we are testing is incorrect (overscroll-behavior)
  // is not respected, we catch it.
  await promiseApzFlushedRepaints();
  is(window.scrollY, 0, "overscroll-behavior was respected");

.then(subtestDone, subtestFailed);

    #scroll {
      width: 200px;
      height: 500px;