[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: [new TESTCASE] khtml and table widths
From: Vadim Plessky <lucy-ples () mtu-net ! ru>
Date: 2002-07-18 10:48:28
[Download RAW message or body]
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/
["table_testcase-percentage-3.html" (text/html)]
<html>
<head>
<title>khtml testcase for table width * corrected by V.P.</title>
</head>
<body>
<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>
<table width="100%" border=1>
<tr>
<td style="width: 20%;">This should be 20%</td>
<td>This is not specified</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>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic