3 <title> webkit.org/b/29447: Replaced elements squeezed when width is specified as percentage inside a table with Auto layout</title>
4 <link rel="stylesheet" href="../js/resources/js-test-style.css">
5 <script src="../js/resources/js-test-pre.js"></script>
6 <script src="../js/resources/js-test-post-function.js"></script>
8 if (window.layoutTestController) {
9 layoutTestController.waitUntilDone();
10 layoutTestController.dumpAsText();
13 function getComputedStyleForElement(element, cssPropertyName)
18 if (window.getComputedStyle) {
19 return window.getComputedStyle(element, '').getPropertyValue(cssPropertyName.replace(/([A-Z])/g, "-$1").toLowerCase());
21 if (element.currentStyle) {
22 return element.currentStyle[cssPropertyName];
29 return getComputedStyleForElement(document.getElementById(id), 'width');
32 function getHeight(id)
34 return getComputedStyleForElement(document.getElementById(id), 'height');
37 function parsePixelValue(str)
39 if (typeof str != "string" || str.length < 3 || str.substr(str.length - 2) != "px") {
40 testFailed(str + " is unparsable.");
43 return parseFloat(str);
48 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.");
50 shouldBe("getWidth('img-1')", "'105px'");
51 shouldBe("getHeight('img-1')", "'105px'");
52 shouldBe("getWidth('img-2')", "'98px'");
53 shouldBe("getHeight('img-2')", "'98px'");
54 shouldBe("getWidth('img-3')", "'40px'");
55 shouldBe("getHeight('img-3')", "'40px'");
56 shouldBe("getWidth('img-4')", "'36px'");
57 shouldBe("getHeight('img-4')", "'36px'");
58 shouldBe("getWidth('img-5')", "'40px'");
59 shouldBe("getHeight('img-5')", "'36px'");
61 isSuccessfullyParsed();
63 if (window.layoutTestController) {
64 layoutTestController.notifyDone();
68 var successfullyParsed = true;
71 <body onload="test()">
75 <img id="img-1" src="resources/square-blue-100x100.png" width="100%" align="LEFT" border="1">
83 <img id="img-2" src="resources/square-blue-100x100.png" height="100%" align="LEFT" border="1">
88 <table height="50" width="50" border="1">
91 <img id="img-3" src="resources/square-blue-100x100.png" width="100%" align="LEFT" border="1">
96 <table height="50" width="50" border="1">
99 <img id="img-4" src="resources/square-blue-100x100.png" height="100%" align="LEFT" border="1">
104 <table height="50" width="50" border="1">
107 <img id="img-5" src="resources/square-blue-100x100.png" width="100%" height="100%" align="LEFT" border="1">
112 <p id="description"></p>
113 <div id="console"></div>