tor-browser

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

bounding-box-computation-2.html (3335B)


      1 <!doctype html>
      2 <script src='/resources/testharness.js'></script>
      3 <script src='/resources/testharnessreport.js'></script>
      4 <link rel='stylesheet' href='./support/base.css' />
      5 <link rel="help" href="https://drafts.csswg.org/css-tables-3/#bounding-box-assignment">
      6 <main>
      7 
      8    <h1>Bounding box computation</h1>
      9    <p>Checks that all table-internal boxes are positioned correctly</p>
     10 
     11    <hr/>
     12    <p>The all table-internal elements of this table shoud be 100px and 100px wide tall:</p>
     13    <p>Table size is 120px. There are two 10px borders, one at each side.</p>
     14    <x-table style="width: 120px; height: 120px; border: 10px solid transparent; box-sizing: border-box; background: yellow;">
     15        <x-colgroup><x-col></x-col></x-colgroup>
     16        <x-tbody>
     17            <x-tr>
     18                <x-td style="padding: 0; background: blue;"></x-td>
     19            </x-tr>
     20        </x-tbody>
     21    </x-table>
     22 
     23 </main>
     24 
     25 <script>
     26    while(true) {
     27        var xtd = document.querySelector('x-td[rowspan], x-td[colspan]'); if(!xtd) break;
     28        var td = document.createElement('td'); for(var i = xtd.attributes.length; i--;) { td.setAttribute(xtd.attributes[i].name,xtd.attributes[i].value) }
     29        xtd.parentNode.replaceChild(td,xtd);
     30    }
     31 
     32    var i = 1;
     33    generate_tests(assert_equals, [
     34        [
     35            "Control test: Table width is 120px",
     36            document.querySelector("x-table:nth-of-type("+(i++)+")").offsetWidth,
     37            120
     38        ],
     39        [
     40            "Control test: Table height is 120px",
     41            document.querySelector("x-table:nth-of-type("+(i-1)+")").offsetHeight,
     42            120
     43        ],
     44        [
     45            "Table-cell is 100px wide",
     46            document.querySelector("x-table:nth-of-type("+(i-1)+") x-td").offsetWidth,
     47            100
     48        ],
     49        [
     50            "Table-cell is 100px tall",
     51            document.querySelector("x-table:nth-of-type("+(i-1)+") x-td").offsetHeight,
     52            100
     53        ],
     54        [
     55            "Table-row is 100px wide",
     56            document.querySelector("x-table:nth-of-type("+(i-1)+") x-tr").offsetWidth,
     57            100
     58        ],
     59        [
     60            "Table-row is 100px tall",
     61            document.querySelector("x-table:nth-of-type("+(i-1)+") x-tr").offsetHeight,
     62            100
     63        ],
     64        [
     65            "Table-row-group is 100px wide",
     66            document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetWidth,
     67            100
     68        ],
     69        [
     70            "Table-row-group is 100px tall",
     71            document.querySelector("x-table:nth-of-type("+(i-1)+") x-tbody").offsetHeight,
     72            100
     73        ],
     74        [
     75            "Table-column is 100px wide",
     76            document.querySelector("x-table:nth-of-type("+(i-1)+") x-col").offsetWidth,
     77            100
     78        ],
     79        [
     80            "Table-column is 100px tall",
     81            document.querySelector("x-table:nth-of-type("+(i-1)+") x-col").offsetHeight,
     82            100
     83        ],
     84        [
     85            "Table-column-group is 100px wide",
     86            document.querySelector("x-table:nth-of-type("+(i-1)+") x-colgroup").offsetWidth,
     87            100
     88        ],
     89        [
     90            "Table-column-group is 100px tall",
     91            document.querySelector("x-table:nth-of-type("+(i-1)+") x-colgroup").offsetHeight,
     92            100
     93        ],
     94    ])
     95 
     96 </script>