tor-browser

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

scrollbar-gutter-propagation-003.html (1736B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSS Overflow: scrollbar-gutter on the root with overflow:auto, not scrolling</title>
      4 <link rel="author" title="Felipe Erias Morandeira" href="mailto:felipeerias@igalia.com" />
      5 <link rel="help" href="https://drafts.csswg.org/css-overflow-4/#scrollbar-gutter-property" />
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="/css/support/parsing-testcommon.js"></script>
      9 <style>
     10  body,
     11  html {
     12    margin: 0;
     13    padding: 0;
     14    border: none;
     15  }
     16 
     17  :root {
     18    scrollbar-gutter: stable;
     19    overflow: auto;
     20  }
     21 
     22  #content {
     23    background: green;
     24    width: 100%;
     25    height: 100px;
     26  }
     27 </style>
     28 
     29 <body>
     30 
     31  <div id="content"></div>
     32 
     33  <script type="text/javascript">
     34    setup({ explicit_done: true });
     35 
     36    test(function () {
     37      let root = document.documentElement;
     38      let body = document.body;
     39      let content = document.getElementById('content');
     40 
     41      // Note: as per the spec, the clientWidth of the root element is
     42      // "viewport width excluding the size of a rendered scroll bar (if any)"
     43      // which does not take scrollbar-gutter into account.
     44      // Since no such special case exists for offsetWidth, this means that here
     45      // root.clientWidth is greater than root.offsetWidth (!!!).
     46 
     47      assert_less_than(root.offsetWidth, window.innerWidth, "viewport has gutter");
     48      assert_equals(body.offsetWidth, root.offsetWidth, "body matches root");
     49      assert_equals(body.clientWidth, body.offsetWidth, "body has no gutter");
     50      assert_equals(content.offsetWidth, body.clientWidth, "content matches body");
     51    }, "viewport has gutter, others do not");
     52 
     53    done();
     54 
     55  </script>
     56 </body>