tor-browser

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

textarea-scrollbar-sizing-002.html (1888B)


      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, with vertical writing mode</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 <style>textarea { writing-mode: vertical-lr }</style>
      9 <textarea id="rows1" rows="1"></textarea>
     10 <textarea id="rows1Hidden" rows="1" style="overflow-y: hidden"></textarea>
     11 <textarea id="rows1Scroll" rows="1" style="overflow-y: scroll"></textarea>
     12 <textarea id="cols3" cols="3"></textarea>
     13 <textarea id="cols3Hidden" cols="3" style="overflow-x: hidden"></textarea>
     14 <textarea id="cols3Scroll" cols="3" style="overflow-x: scroll"></textarea>
     15 <div id="scrollableDiv" style="overflow:scroll"></div>
     16 
     17 <script>
     18 const scrollbarsHaveThickness = (scrollableDiv.offsetHeight != 0);
     19 test(() => {
     20  assert_equals(rows1.offsetHeight, rows1Hidden.offsetHeight);
     21  assert_equals(rows1.offsetWidth, rows1Hidden.offsetWidth);
     22 }, 'rows=1 doesnt include scrollbar thickness');
     23 
     24 test(() => {
     25  assert_equals(rows1.offsetHeight, rows1Scroll.offsetHeight);
     26  if (scrollbarsHaveThickness) {
     27    assert_less_than(rows1.offsetWidth, rows1Scroll.offsetWidth);
     28  } else {
     29    assert_equals(rows1.offsetWidth, rows1Scroll.offsetWidth);
     30  }
     31 }, 'rows=1 overflow scroll includes scrollbar thickness');
     32 
     33 test(() => {
     34  assert_equals(cols3.offsetHeight, cols3Scroll.offsetHeight);
     35  if (scrollbarsHaveThickness) {
     36    assert_greater_than(cols3.offsetHeight, cols3Hidden.offsetHeight);
     37  } else {
     38    assert_equals(cols3.offsetHeight, cols3Hidden.offsetHeight);
     39  }
     40  assert_equals(cols3.offsetWidth, cols3Scroll.offsetWidth);
     41  assert_equals(cols3.offsetWidth, cols3Hidden.offsetWidth);
     42 }, 'cols=3 includes scrollbar thickness');
     43 </script>