RESOLVED FIXED 13670
Table misrender when one of the TDs has width=100%
https://bugs.webkit.org/show_bug.cgi?id=13670
Summary Table misrender when one of the TDs has width=100%
Bhagyalaxmi Dash
Reported 2007-05-10 17:35:52 PDT
Table misrenders, assumes some arbitrary width when one of the TDs has width=100%. Please see the reduction given below. In the reduction , the first TD has the width=100% and the second TD is blank(&nbsp). But, the table takes its width between 376 to 858 depending on the size of the browser window. In Firefox, table is occupying the entire width available to the browser window. In addition to that it is not taking any arbitrary value. This issue affects the rendering of certain tables in SAP NetWeaver portal that works perfectly in Firefox. <html> <head> <script> function f1() { var tab1=document.getElementById("table1"); alert("Table Width "+tab1.offsetWidth); var x=document.getElementById("tdid1"); alert("Width of first TD "+x.offsetWidth); } </script> </head> <body onload="javascript:f1()"> <table bgcolor="Red" border="1" id="table1"> <tr> <td id="tdid1" width="100%">&nbsp;</td> <td >&nbsp;</td> </tr> </table> </body> </html>
Attachments
Reduction for the issue. (404 bytes, text/html)
2007-05-10 17:37 PDT, Bhagyalaxmi Dash
no flags
Change the cap from 99% to >99.99% (177.08 KB, patch)
2007-08-10 07:09 PDT, mitz
darin: review+
Bhagyalaxmi Dash
Comment 1 2007-05-10 17:37:39 PDT
Created attachment 14479 [details] Reduction for the issue. This attachment contains the reduction for this issue.
Dave Hyatt
Comment 2 2007-05-11 00:12:35 PDT
What does WinIE do? What Firefox does is irrelevant when it comes to tables.
Bhagyalaxmi Dash
Comment 3 2007-05-14 17:39:28 PDT
In IE, the table is occupying the entire width available to the browser window. This is the same behavior as Firefox.
Darin Adler
Comment 4 2007-08-09 15:17:23 PDT
mitz
Comment 5 2007-08-09 15:59:25 PDT
The problem can be "made to go away" for most practical cases (i.e. as long as the container is not extremely wide) by taking advantage of the new support for non-integral percentage values. Currently anything above 99% is clamped down to 99%, but this can be changed to a much higher threshold. In AutoTableLayout::calcPrefWidths: maxNonPercent = (maxNonPercent * 100 + 50) * percentScaleFactor / max(remainingPercent, percentScaleFactor); can be changed to say 1 in the end instead of percentScaleFactor (currently 128), bringing the threshold to >99.99%. I will try to post a patch soon.
mitz
Comment 6 2007-08-10 07:09:44 PDT
Created attachment 15906 [details] Change the cap from 99% to >99.99% The patch also removes the "+ 50" which has been in the code since <http://trac.webkit.org/projects/webkit/changeset/3351>. This fixes a bug that has become even more apparent by raising the cap from 99% closer to 100%, and causes no regressions. I've included a test for the bug, where the new results match WinIE. I have a version that tests directly for the "0%" cases and uses INT_MAX as max width in those cases. It gives the same results in testing, but I think using INT_MAX is still a hack, and is perhaps more risky than this patch's approach.
Beth Dakin
Comment 7 2007-08-10 14:18:15 PDT
This looks good to me, but Hyatt should probably take a look too.
Darin Adler
Comment 8 2007-08-11 10:37:49 PDT
Comment on attachment 15906 [details] Change the cap from 99% to >99.99% r=me
Darin Adler
Comment 9 2007-08-11 10:39:24 PDT
I'll land this.
mitz
Comment 10 2007-08-11 11:28:00 PDT
Note You need to log in before you can comment on or make changes to this bug.