3 <title> webkit.org/b/29447: Replaced elements squeezed when width is specified as percentage inside a table with Auto layout</title>
4 <script src="../js/resources/js-test-pre.js"></script>
6 if (window.layoutTestController) {
7 layoutTestController.waitUntilDone();
8 layoutTestController.dumpAsText();
11 function getComputedStyleForElement(element, cssPropertyName)
16 if (window.getComputedStyle) {
17 return window.getComputedStyle(element, '').getPropertyValue(cssPropertyName.replace(/([A-Z])/g, "-$1").toLowerCase());
19 if (element.currentStyle) {
20 return element.currentStyle[cssPropertyName];
27 return getComputedStyleForElement(document.getElementById(id), 'width');
30 function getHeight(id)
32 return getComputedStyleForElement(document.getElementById(id), 'height');
35 function parsePixelValue(str)
37 if (typeof str != "string" || str.length < 3 || str.substr(str.length - 2) != "px") {
38 testFailed(str + " is unparsable.");
41 return parseFloat(str);
46 description("This test checks that a replaced element with percentage width (and no height specified) within a table cell is squeezed to the dimensions of the table cell.<br>See bug #29447.");
48 shouldBe("getWidth('img-1')", "'105px'");
49 shouldBe("getHeight('img-1')", "'105px'");
50 shouldBe("getWidth('img-2')", "'98px'");
51 shouldBe("getHeight('img-2')", "'98px'");
52 shouldBe("getWidth('img-3')", "'40px'");
53 shouldBe("getHeight('img-3')", "'40px'");
54 shouldBe("getWidth('img-4')", "'36px'");
55 shouldBe("getHeight('img-4')", "'36px'");
56 shouldBe("getWidth('img-5')", "'40px'");
57 shouldBe("getHeight('img-5')", "'36px'");
59 isSuccessfullyParsed();
61 if (window.layoutTestController) {
62 layoutTestController.notifyDone();
67 <body onload="test()">
71 <img id="img-1" src="resources/square-blue-100x100.png" width="100%" align="LEFT" border="1">
79 <img id="img-2" src="resources/square-blue-100x100.png" height="100%" align="LEFT" border="1">
84 <table height="50" width="50" border="1">
87 <img id="img-3" src="resources/square-blue-100x100.png" width="100%" align="LEFT" border="1">
92 <table height="50" width="50" border="1">
95 <img id="img-4" src="resources/square-blue-100x100.png" height="100%" align="LEFT" border="1">
100 <table height="50" width="50" border="1">
103 <img id="img-5" src="resources/square-blue-100x100.png" width="100%" height="100%" align="LEFT" border="1">
108 <p id="description"></p>
109 <div id="console"></div>