tor-browser

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

scroll-state-snapped-layout-change.html (1589B)


      1 <!DOCTYPE html>
      2 <title>@container: scroll-state(snapped) layout change</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#snapped">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
      7 <script src="/css/css-transitions/support/helper.js"></script>
      8 <style>
      9  :root {
     10    scroll-snap-type: block proximity;
     11  }
     12  body {
     13    margin: 0;
     14  }
     15  #filler-before {
     16    height: 10px;
     17  }
     18  #filler-after {
     19    height: 10000px;
     20  }
     21  #snapped {
     22    position: relative;
     23    top: 3000px; /* Should be enough to not snap for proximity */
     24    container-type: scroll-state;
     25    scroll-snap-align: start;
     26    width: 100px;
     27    height: 100px;
     28  }
     29  #target {
     30    --snapped: no;
     31    @container scroll-state(snapped) {
     32      --snapped: yes;
     33    }
     34  }
     35 </style>
     36 <div id="filler-before"></div>
     37 <div id="snapped" class="snapped">
     38  <span id="target">#target</span>
     39 </div>
     40 <div id="filler-after"></div>
     41 <script>
     42  setup(() => assert_implements_scroll_state_container_queries());
     43 
     44  promise_test(async t => {
     45    await waitForAnimationFrames(2);
     46    assert_equals(getComputedStyle(target).getPropertyValue("--snapped"), "no");
     47  }, "Check scroll-state(snapped) initially not matching");
     48 
     49  promise_test(async t => {
     50    snapped.style.top = "auto";
     51    await waitForAnimationFrames(2);
     52    assert_equals(getComputedStyle(target).getPropertyValue("--snapped"), "yes");
     53  }, "scroll-state(snapped) matching after relative position changed");
     54 
     55 </script>