Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <style> | |
| 2 td { padding: 10px } | |
|
dgrogan
2017/04/25 23:23:35
Could you explain more about why we need both test
| |
| 3 </style> | |
| 4 <div style="-webkit-writing-mode: vertical-rl; writing-mode: vertical-rl"> | |
| 5 <table style="margin: 50px"> | |
| 6 <tr id="tr1"> | |
| 7 <td id="td1a"><span id="s1a">1-A</span></td> | |
| 8 <td id="td1b"><span id="s1b">1-B</span></td> | |
| 9 <td id="td1c"><span id="s1c">1-C</span></td> | |
| 10 <td id="td1d"><span id="s1d">1-D</span></td> | |
| 11 <td id="td1e"><span id="s1e">1-E</span></td> | |
| 12 </tr> | |
| 13 <tr id="tr2"> | |
| 14 <td id="td2a"><span id="s2a">2-A</span></td> | |
| 15 <td id="td2b"><span id="s2b">2-B</span></td> | |
| 16 <td id="td2c"><span id="s2c">2-C</span></td> | |
| 17 <td id="td2d"><span id="s2d">2-D</span></td> | |
| 18 <td id="td2e"><span id="s2e">2-E</span></td> | |
| 19 </tr> | |
| 20 <tr id="tr3"> | |
| 21 <td id="td3a"><span id="s3a">3-A</span></td> | |
| 22 <td id="td3b"><span id="s3b">3-B</span></td> | |
| 23 <td id="td3c"><span id="s3c">3-C</span></td> | |
| 24 <td id="td3d"><span id="s3d">3-D</span></td> | |
| 25 <td id="td3e"><span id="s3e">3-E</span></td> | |
| 26 </tr> | |
| 27 <tr id="tr4"> | |
| 28 <td id="td4a"><span id="s4a">4-A</span></td> | |
| 29 <td id="td4b"><span id="s4b">4-B</span></td> | |
| 30 <td id="td4c"><span id="s4c">4-C</span></td> | |
| 31 <td id="td4d"><span id="s4d">4-D</span></td> | |
| 32 <td id="td4e"><span id="s4e">4-E</span></td> | |
| 33 </tr> | |
| 34 <tr id="tr5"> | |
| 35 <td id="td5a"><span id="s5a">5-A</span></td> | |
| 36 <td id="td5b"><span id="s5b">5-B</span></td> | |
| 37 <td id="td5c"><span id="s5c">5-C</span></td> | |
| 38 <td id="td5d"><span id="s5d">5-D</span></td> | |
| 39 <td id="td5e"><span id="s5e">5-E</span></td> | |
| 40 </tr> | |
| 41 </table> | |
| 42 <div style="padding: 100px"></div> | |
| 43 </div> | |
| 44 <script src="../../../resources/testharness.js"></script> | |
| 45 <script src="../../../resources/testharnessreport.js"></script> | |
| 46 <script> | |
| 47 function doesRectContainRect(parent, child) { | |
| 48 var margin = 0; | |
| 49 if (child.top < (parent.top - margin)) { | |
| 50 return false; | |
| 51 } | |
| 52 if (child.bottom > (parent.bottom + margin)) { | |
| 53 return false; | |
| 54 } | |
| 55 if (child.left < (parent.left - margin)) { | |
| 56 return false; | |
| 57 } | |
| 58 if (child.right > (parent.right + margin)) { | |
| 59 return false; | |
| 60 } | |
| 61 return true; | |
| 62 } | |
| 63 | |
| 64 function assert_contains(parent, child, description) { | |
| 65 assert_true(doesRectContainRect(parent, child), description); | |
| 66 } | |
| 67 | |
| 68 function checkRowColumn(row, column) { | |
| 69 var columnName = ["a", "b", "c", "d", "e"]; | |
| 70 var trId = "tr" + (row + 1); | |
| 71 var tr = document.getElementById(trId); | |
| 72 var trRect = tr.getBoundingClientRect(); | |
| 73 var name = (row + 1).toString() + "-" + columnName[column].toUpperCase(); | |
| 74 var tdId = "td" + (row + 1) + columnName[column]; | |
| 75 var td = document.getElementById(tdId); | |
| 76 var tdRect = td.getBoundingClientRect(); | |
| 77 assert_contains(trRect, tdRect, name); | |
| 78 } | |
| 79 | |
| 80 test(function() { | |
| 81 for (var i = 0; i < 5; i++) { | |
| 82 for (var j = 0; j < 5; j++) { | |
| 83 checkRowColumn(i, j); | |
| 84 } | |
| 85 } | |
| 86 }, "td should be inside of tr in vertical table"); | |
| 87 </script> | |
| OLD | NEW |