tor-browser

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

new-content-transform-position-fixed.html (1962B)


      1 <!DOCTYPE html>
      2 <html class=reftest-wait>
      3 <title>View transitions: computed transform for position fixed elements doesn't include scroll pos</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
      5 <link rel="author" title="Matt Woodrow" href="mailto:mattwoodrow@apple.com">
      6 <link rel="match" href="new-content-transform-position-fixed-ref.html">
      7 <script src="/common/rendering-utils.js"></script>
      8 <script src="/common/reftest-wait.js"></script>
      9 <script src="../../../../../resources/ui-helper.js"></script>
     10 <style>
     11 :root {
     12  background: lightpink;
     13  box-shadow: 10px 0 0 0 inset red;
     14 }
     15 
     16 .box {
     17  background: lightblue;
     18  width: 100px;
     19  height: 100px;
     20  position: fixed;
     21  view-transition-name: target;
     22 }
     23 
     24 /* We're verifying what we capture, so just display the new contents for 5 minutes.  */
     25 html::view-transition-group(*) { animation-duration: 300s; }
     26 html::view-transition-new(*) { animation: unset; opacity: 1; }
     27 html::view-transition-old(*) { animation: unset; opacity: 0; }
     28 /* hide the root so we show transition background to ensure we're in a transition */
     29 html::view-transition-group(root) { animation: unset; opacity: 0; }
     30 html::view-transition { background: lightpink; }
     31 </style>
     32 <div class=box></div>
     33 <div style="height: 1000px;"></div>
     34 <script>
     35 failIfNot(document.startViewTransition, "Missing document.startViewTransition");
     36 
     37 async function runTest() {
     38  await waitForAtLeastOneFrame();
     39 
     40  /* Scroll the doc, target element's element-to-screen transform should not change */
     41  await new Promise((resolve) => {
     42    addEventListener("scroll", () => {
     43      requestAnimationFrame(() => requestAnimationFrame(resolve));
     44    }, { once: true, capture: true });
     45 
     46    document.documentElement.scrollTop = 500;
     47  });
     48  let t = document.startViewTransition(() => {
     49    requestAnimationFrame(() => requestAnimationFrame(takeScreenshot));
     50  });
     51 }
     52 onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
     53 </script>