scrollbar-gutter-propagation-007.html (1388B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: scrollbar-gutter on the root, overflow:scroll on the body</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 } 20 21 body { 22 overflow: scroll; 23 } 24 25 #content { 26 background: green; 27 width: 100%; 28 height: 100px; 29 } 30 </style> 31 32 <body> 33 34 <div id="content"></div> 35 36 <script type="text/javascript"> 37 setup({ explicit_done: true }); 38 39 test(function () { 40 let root = document.documentElement; 41 let body = document.body; 42 let content = document.getElementById('content'); 43 44 assert_less_than(root.clientWidth, window.outerWidth, "viewport has scrollbars"); 45 assert_equals(body.offsetWidth, root.clientWidth, "body matches root"); 46 assert_equals(body.clientWidth, body.offsetWidth, "body has no gutter"); 47 assert_equals(content.offsetWidth, body.clientWidth, "content matches body"); 48 }, "viewport has fixed scrollbars"); 49 50 done(); 51 52 </script> 53 </body>