tor-browser

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

textarea-scrollbar-sizing-001.html (1806B)


      1 <!DOCTYPE html>
      2 <link rel="help" href="https://html.spec.whatwg.org/C/#the-textarea-element-2">
      3 <title>Test textarea width and height accounting for scrollbars</title>
      4 <meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <body>
      8 <textarea id="rows1" rows="1"></textarea>
      9 <textarea id="rows1Hidden" rows="1" style="overflow-x: hidden"></textarea>
     10 <textarea id="rows1Scroll" rows="1" style="overflow-x: scroll"></textarea>
     11 <textarea id="cols3" cols="3"></textarea>
     12 <textarea id="cols3Hidden" cols="3" style="overflow-y: hidden"></textarea>
     13 <textarea id="cols3Scroll" cols="3" style="overflow-y: scroll"></textarea>
     14 <div id="scrollableDiv" style="overflow:scroll"></div>
     15 
     16 <script>
     17 const scrollbarsHaveThickness = (scrollableDiv.offsetHeight != 0);
     18 test(() => {
     19  assert_equals(rows1.offsetWidth, rows1Hidden.offsetWidth);
     20  assert_equals(rows1.offsetHeight, rows1Hidden.offsetHeight);
     21 }, 'rows=1 doesnt include scrollbar thickness');
     22 
     23 test(() => {
     24  assert_equals(rows1.offsetWidth, rows1Scroll.offsetWidth);
     25  if (scrollbarsHaveThickness) {
     26    assert_less_than(rows1.offsetHeight, rows1Scroll.offsetHeight);
     27  } else {
     28    assert_equals(rows1.offsetHeight, rows1Scroll.offsetHeight);
     29  }
     30 }, 'rows=1 overflow scroll includes scrollbar thickness');
     31 
     32 test(() => {
     33  assert_equals(cols3.offsetWidth, cols3Scroll.offsetWidth);
     34  if (scrollbarsHaveThickness) {
     35    assert_greater_than(cols3.offsetWidth, cols3Hidden.offsetWidth);
     36  } else {
     37    assert_equals(cols3.offsetWidth, cols3Hidden.offsetWidth);
     38  }
     39  assert_equals(cols3.offsetHeight, cols3Scroll.offsetHeight);
     40  assert_equals(cols3.offsetHeight, cols3Hidden.offsetHeight);
     41 }, 'cols=3 includes scrollbar thickness');
     42 </script>