[new TESTCASE] khtml and table widths
Vadim Plessky
lucy-ples at mtu-net.ru
Thu Jul 18 11:48:28 BST 2002
On Thursday 18 July 2002 11:57 am, Ladislav Strojil wrote:
|
| Hi,
| recent commits by Dirk Mueller broke table rendering for me.
|
| See the test case at http://www.strojil.cz/khtml_testcase.html
|
You have mistakes/wrong assumption in your code.
<table border=1>
<tr>
<td colspan="3">Does your KHTML get it right?</td>
</tr>
<tr>
<td style="width: 20%;">This should be 20%</td>
<td style="width: 20%;">This too</td>
<td>And this should be the rest (say 60%).</td>
</tr>
</table>
Correct code:
<table width="100%" border=1>
<tr>
<td style="width: 20%;">This should be 20%</td>
<td style="width: 20%;">This is also 20%</td>
<td>And this should be the rest (say 60%).</td>
</tr>
<tr>
<td colspan="3">Does your KHTML get it right?</td>
</tr>
</table>
1) there is no *default* width for the table if you do not specify its width
adding width=100% fixes misunderstanding.
2) Browser (userAgent) calculates widths of cells (columns) using *first row*
(you may want to chekc the specs)
So, you testcase with
<tr>
<td colspan="3">Does your KHTML get it right?</td>
</tr>
is very confusing. No info what should be cell's widths...
Changing order of <tr></tr> fixes many cases of *unclear* rendering, too.
Please check attached (corrected) testcase, it renders similary in Mozilla and
Konqueror.
(NOTE: I tested with KDE 3.0.2, *without* Dirk's fixes!...)
| It seems to me, that the widht is calculated by:
| a) making columns without width specified as small as possible
| b) taking the sum of the remaining sums and distributing the remaining
| space in specified ratios.
|
| So if you have three columns, two with 20% and one without width
| specified, those two get 50% of what is left each.
|
| The problem seems to be in
| void RenderTable::calcColMinMax()
| in khtml/rendering/render_table.cpp
|
| This is a bug, isn't it? :-))
|
| Cheers,
| Lada
--
Vadim Plessky
http://kde2.newmail.ru (English)
33 Window Decorations and 6 Widget Styles for KDE
http://kde2.newmail.ru/kde_themes.html
KDE mini-Themes
http://kde2.newmail.ru/themes/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20020718/2de88212/attachment.html>
More information about the kfm-devel
mailing list