Bug 67849 - [test case] percent width become shorter when CSS fixed table-layout [PATCH]
Summary: [test case] percent width become shorter when CSS fixed table-layout [PATCH]
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal with 1 vote (vote)
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 108239 118183 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-11 04:45 UTC by T. Watanabe
Modified: 2006-06-18 12:03 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
test case (425 bytes, text/html)
2005-02-28 18:06 UTC, Allan Sandfeld
Details
The same symptoms, possibly a different reason (482 bytes, text/html)
2006-01-02 14:25 UTC, Paul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description T. Watanabe 2003-11-11 04:45:18 UTC
Version:            (using KDE KDE 3.1.4)
Installed from:    Unspecified

When I specify both percentage widths and other type widths (eg. "auto" or "em" unit) for table columns, the columns having percentage widths will be rendered too narrow.

See the following test-case.

=-=-=
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>

<table style="width: 100%; table-layout: fixed">
<col style="background: #f99; width: 4em">
<col style="background: #f99; width: auto">
<col style="background: #f99; width: 50%">
<tbody><tr><td>4em</td><td>auto</td><td>50%</td></tr></tbody>
</table>

</body>
</html>
=-=-=

I have made a patch.

=-=-=
--- kdelibs-3.1.4/khtml/rendering/table_layout.cpp.orig	Sat Jul 19 20:47:54 2003
+++ kdelibs-3.1.4/khtml/rendering/table_layout.cpp	Tue Nov 11 11:17:02 2003
@@ -284,15 +284,18 @@
     // assign  percent width
     if ( available > 0 ) {
 	int totalPercent = 0;
+	bool onlyPercent = true;
 	for ( int i = 0; i < nEffCols; i++ )
 	    if ( width[i].isPercent() )
 		totalPercent += width[i].value();
+	    else
+		onlyPercent = false;
 
 	// calculate how much to distribute to percent cells.
 	int base = tableWidth * totalPercent / 100;
 	if ( base > available )
 	    base = available;
-	else
+	else if (onlyPercent)
 	    totalPercent = 100;
 
 #ifdef DEBUG_LAYOUT
=-=-=
Comment 1 Sashmit Bhaduri 2003-11-12 07:19:53 UTC
Yup, this behavior still occurs in HEAD.
Comment 2 Daniel Naber 2004-02-20 00:39:51 UTC
Problem still occurs in KDE 3.2.
Comment 3 Allan Sandfeld 2005-02-28 18:06:39 UTC
Created attachment 9890 [details]
test case

clickable test case
Comment 4 Tommi Tervo 2005-12-12 15:11:45 UTC
*** Bug 118183 has been marked as a duplicate of this bug. ***
Comment 5 Paul 2006-01-02 14:25:48 UTC
Created attachment 14107 [details]
The same symptoms, possibly a different reason
Comment 6 Allan Sandfeld 2006-06-17 19:17:37 UTC
SVN commit 552382 by carewolf:

Fix fixed-layout with percentages
BUG: 67849


 M  +0 -2      table_layout.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/table_layout.cpp #552381:552382
@@ -288,8 +288,6 @@
 	int base = tableWidth * totalPercent / 100;
 	if ( base > available )
 	    base = available;
-	else
-	    totalPercent = 100;
 
 #ifdef DEBUG_LAYOUT
     qDebug("FixedTableLayout::layout: assigning percent width, base=%d, totalPercent=%d", base, totalPercent);
Comment 7 Allan Sandfeld 2006-06-18 12:03:36 UTC
*** Bug 108239 has been marked as a duplicate of this bug. ***