commit-queue@webkit.org | 8df5c93 | 2012-11-12 19:20:26 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <script src="../../resources/check-layout.js"></script> |
| 5 | <script> |
| 6 | function test() |
| 7 | { |
| 8 | checkLayout('.tableContentBox'); |
| 9 | checkLayout('.tablePaddingBox'); |
| 10 | checkLayout('.tableBorderBox'); |
| 11 | } |
| 12 | </script> |
| 13 | <style> |
| 14 | .tableContentBox, .tablePaddingBox, .tableBorderBox { |
| 15 | display: table; |
| 16 | padding-left: 100px; |
| 17 | border: 3px solid teal; |
| 18 | font-family: ahem; |
| 19 | } |
| 20 | .tableContentBox { |
| 21 | -webkit-box-sizing: content-box; |
| 22 | box-sizing: content-box; |
| 23 | } |
| 24 | .tablePaddingBox { |
| 25 | -webkit-box-sizing: padding-box; |
| 26 | box-sizing: padding-box; |
| 27 | } |
| 28 | .tableBorderBox { |
| 29 | -webkit-box-sizing: border-box; |
| 30 | box-sizing: border-box; |
| 31 | } |
| 32 | .tablerow { |
| 33 | display: table-row; |
| 34 | } |
| 35 | .tablecell { |
| 36 | display: table-cell; |
| 37 | } |
| 38 | </style> |
| 39 | </head> |
| 40 | <body onload="test()"> |
| 41 | <div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=77028"> 77028</a> Specified width CSS tables should not include border and padding as part of that width.</div> |
| 42 | <div>For a CSS table with a specified width, border and padding should not be included as part of its width (for the content-box model).</div> |
| 43 | <div style="width: 600px; border: solid 1px black;"> |
| 44 | <!-- For box-sizing: content-box --> |
| 45 | <div style="width: 50%;" class="tableContentBox" data-expected-width="406"> |
| 46 | <div class="tablerow"> |
| 47 | <div class="tablecell">50%, content-box</div> |
| 48 | </div> |
| 49 | </div> |
| 50 | <div style="width: 300px;" class="tableContentBox" data-expected-width="406"> |
| 51 | <div class="tablerow"> |
| 52 | <div class="tablecell">300px, content-box</div> |
| 53 | </div> |
| 54 | </div> |
| 55 | <div style="width: 50vw;" class="tableContentBox" data-expected-width="506"> |
| 56 | <div class="tablerow"> |
| 57 | <div class="tablecell">50vw, content-box</div> |
| 58 | </div> |
| 59 | </div> |
| 60 | <div style="width: 30em;" class="tableContentBox" data-expected-width="586"> |
| 61 | <div class="tablerow"> |
| 62 | <div class="tablecell">30em, content-box</div> |
| 63 | </div> |
| 64 | </div> |
| 65 | <!-- For box-sizing: border-box --> |
| 66 | <div style="width: 50%;" class="tableBorderBox" data-expected-width="300"> |
| 67 | <div class="tablerow"> |
| 68 | <div class="tablecell">50%, border-box</div> |
| 69 | </div> |
| 70 | </div> |
| 71 | <div style="width: 300px;" class="tableBorderBox" data-expected-width="300"> |
| 72 | <div class="tablerow"> |
| 73 | <div class="tablecell">300px, border-box</div> |
| 74 | </div> |
| 75 | </div> |
| 76 | <div style="width: 50vw;" class="tableBorderBox" data-expected-width="400"> |
| 77 | <div class="tablerow"> |
| 78 | <div class="tablecell">50vw, border-box</div> |
| 79 | </div> |
| 80 | </div> |
| 81 | <div style="width: 30em;" class="tableBorderBox" data-expected-width="480"> |
| 82 | <div class="tablerow"> |
| 83 | <div class="tablecell">30em, border-box</div> |
| 84 | </div> |
| 85 | </div> |
| 86 | <!-- For box-sizing: padding-box. Currently not supported hence the following expected values are incorrect. |
| 87 | The expected width value for each of the following tables should be lesser by 100px. |
| 88 | This is because in case of padding-box, padding is included as part of the specified |
| 89 | width but border or margin are not. --> |
| 90 | <div style="width: 50%;" class="tablePaddingBox" data-expected-width="406"> |
| 91 | <div class="tablerow"> |
| 92 | <div class="tablecell">50%, padding-box</div> |
| 93 | </div> |
| 94 | </div> |
| 95 | <div style="width: 300px;" class="tablePaddingBox" data-expected-width="406"> |
| 96 | <div class="tablerow"> |
| 97 | <div class="tablecell">300px, padding-box</div> |
| 98 | </div> |
| 99 | </div> |
| 100 | <div style="width: 50vw;" class="tablePaddingBox" data-expected-width="506"> |
| 101 | <div class="tablerow"> |
| 102 | <div class="tablecell">50vw, padding-box</div> |
| 103 | </div> |
| 104 | </div> |
| 105 | <div style="width: 30em;" class="tablePaddingBox" data-expected-width="586"> |
| 106 | <div class="tablerow"> |
| 107 | <div class="tablecell">30em, padding-box</div> |
| 108 | </div> |
| 109 | </div> |
| 110 | </div> |
| 111 | </body> |
| 112 | </html> |