tor-browser

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

auto-scrollbars.html (1817B)


      1 <!doctype html>
      2 <title>CSS Container Queries Test: scrollbar stability for @container queries and overflow:auto</title>
      3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-queries">
      4 <link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-layout">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="support/cq-testcommon.js"></script>
      8 <style>
      9  #scroller {
     10    height: 100px;
     11    width: 100px;
     12    overflow-y: auto;
     13  }
     14  #container {
     15    container-type: inline-size;
     16  }
     17  #inner {
     18    height: 100px;
     19    border-bottom: 1px solid red;
     20  }
     21  @container (max-width: 99px) {
     22    #inner {
     23      height: 50px;
     24    }
     25  }
     26 </style>
     27 <div id="precondition" style="width:100px;height:100px;overflow:scroll"></div>
     28 <div id="scroller">
     29  <div id="container">
     30    <div id="inner"></div>
     31  </div>
     32 </div>
     33 <script>
     34  setup(() => {
     35    assert_implements_size_container_queries();
     36  });
     37 
     38  const has_overlay_scrollbars = precondition.clientWidth === 100;
     39  let initialScrollerWidth = scroller.clientWidth;
     40  test(() => {
     41    if (has_overlay_scrollbars) return;
     42    assert_equals(getComputedStyle(inner).height, "50px",
     43                  "Layout with a scrollbar means the container query applies");
     44  }, "Initial layout - expecting a scrollbar without overflowing content instead of overflowing content without a scrollbar");
     45 
     46  test(() => {
     47    if (has_overlay_scrollbars) return;
     48    inner.style.borderBottomWidth = "2px";
     49    assert_equals(scroller.clientWidth, initialScrollerWidth, "Scrollbar visibility is consistent after reflow.");
     50    assert_equals(getComputedStyle(inner).height, "50px",
     51                  "Layout with a scrollbar means the container query applies");
     52  }, "Same result after a reflow");
     53 
     54 </script>