2 <script src=
"../../resources/js-test.js"></script>
25 .height-percent-test {
31 <table><tr><td class=
"width-test" style=
"width: 100px;">control width:
100px
</td></tr></table>
32 <table><tr><td class=
"width-test" style=
"width: calc(100px);">simple
100px
</td></tr></table>
33 <table><tr><td class=
"width-test" style=
"width: calc(25px * 4);">25px *
4</td></tr></table>
34 <table><tr><td class=
"height-test" style=
"height: 100px;">control height:
100px
</td></tr></table>
35 <table><tr><td class=
"height-test" style=
"height: calc(100px);">simple
100px
</td></tr></table>
36 <table><tr><td class=
"height-test" style=
"height: calc(25px * 4);">25px *
4</td></tr></table>
37 <div style=
"width:400px;">
38 <table><tr><td class=
"width-percent-test" style=
"width: 25%;">control width:
25%
</td><td class=
"dummy"/></tr></table>
39 <table><tr><td class=
"width-percent-test" style=
"width: calc(25%);">simple calc(
25%)
</td><td class=
"dummy"/></tr></table>
40 <table><tr><td class=
"width-percent-test" style=
"width: calc(10% * 2 + 5%);">calc(
10% *
2 +
5%)
</td><td class=
"dummy"/></tr></table>
42 <div style=
"height: 400px">
43 <table style=
"height: 25%"><tr><td class=
"height-percent-test">control height:
25%
</td></tr></table>
45 <div style=
"height: 400px">
46 <table style=
"height: calc(25%);"><tr><td class=
"height-percent-test">simple calc(
25%)
</td></tr></table>
48 <div style=
"height: 400px">
49 <table style=
"height: calc(10% * 2 + 5%);"><tr><td class=
"height-percent-test">calc(
10% *
2 +
5%)
</td></tr></table>
53 description("Tests that CSS3 calc() can be used in tables");
55 var cells
= document
.getElementById("test").getElementsByTagName("td");
56 for (var i
= 0; i
< cells
.length
; ++i
) {
58 if (cell
.className
== 'dummy')
60 var width
= cell
.offsetWidth
;
61 var height
= cell
.offsetHeight
;
63 shouldEvaluateTo("cell.offsetWidth", 100);
64 shouldEvaluateTo("cell.offsetHeight", 100);
68 error
.push("width was not 100");
70 error
.push("height was not 100");
73 cell
.style
.backgroundColor
= "green";
74 cell
.innerHTML
+= " => PASS";
76 cell
.style
.backgroundColor
= "red";
77 cell
.innerHTML
+= " => FAIL: " + error
.join(", ");
80 if (window
.testRunner
)
81 document
.body
.removeChild(document
.getElementById("test"));