Bug 107521

Summary: [test case] Small problem with position of a table at the bottom without putting the height in the <table>
Product: [Applications] konqueror Reporter: Tom Albers <toma>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: test
patch

Description Tom Albers 2005-06-16 11:19:37 UTC
Version:           3.4.0 (using KDE 3.4.0, Debian Package 4:3.4.0-0pre2 (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-8)
OS:                Linux (i686) release 2.6.10-1-k7

Hello,

Whenever you put a table at the bottom of a page without specifying the height directly in the table, it is rendered from that position down.

I'll attach a small test case for this situation. Internet Explorer (tested with version 6) and Firefox 
(tested with version 1.0.1), render the boxes correctly, Konqueror (version 3.4.0) does not render the first box properly.

Tom
Comment 1 Tom Albers 2005-06-16 11:20:24 UTC
Created attachment 11477 [details]
test
Comment 2 Germain Garand 2006-02-28 22:09:26 UTC
Created attachment 14911 [details]
patch

calculate table height a bit differently for positioned tables, so as to get
accurate bottom positioning,
also adds table { box-sizing: border-box } to default sheet.
Comment 3 Germain Garand 2006-03-02 03:23:49 UTC
SVN commit 514954 by ggarand:

Use the calculated height for positioned tables, so as to always compute an accurate
position. 
Add box-sizing: border-box to table's default style 

BUG: 107521



 M  +1 -0      css/html4.css  
 M  +7 -3      rendering/render_box.cpp  
 M  +3 -1      rendering/render_table.cpp  


--- branches/KDE/3.5/kdelibs/khtml/css/html4.css #514953:514954
@@ -173,6 +173,7 @@
 	text-align: -khtml-auto;
 	border-spacing: 2px;
         -khtml-flow-mode: -khtml-around-floats;
+        box-sizing: border-box;
 }
 
 TABLE[align="center"] {
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.cpp #514953:514954
@@ -1033,7 +1033,7 @@
     }
     if (result != -1) {
         result = height.width(result);
-        if (cb->isTableCell() && !isTable() && style()->boxSizing() != BORDER_BOX) {
+        if (cb->isTableCell() && style()->boxSizing() != BORDER_BOX) {
             result -= (borderTop() + paddingTop() + borderBottom() + paddingBottom());
             result = kMax(0, result);
         }
@@ -1467,8 +1467,12 @@
     else if (!height.isVariable())
     {
         h = height.width(ch);
-        if (ourHeight - pab > h)
-            ourHeight = h + pab;
+        if (ourHeight - pab > h) {
+            if (!isTable())
+                ourHeight = h + pab;
+            else
+                h = ourHeight - pab;
+        }
     }
     else if (isReplaced())
         h = intrinsicHeight();
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_table.cpp #514953:514954
@@ -303,6 +303,8 @@
     m_height += bpTop;
 
     int oldHeight = m_height;
+    if (isPositioned())
+        m_height += calculatedHeight + bpBottom;
     calcHeight();
     int newHeight = m_height;
     m_height = oldHeight;
@@ -310,7 +312,7 @@
     Length h = style()->height();
     int th = -(bpTop + bpBottom); // Tables size as though CSS height includes border/padding.
     if (isPositioned())
-        th = newHeight; // FIXME: Leave this alone for now but investigate later.
+        th += newHeight;
     else if (h.isFixed())
         th += h.value();
     else if (h.isPercent())
Comment 4 Tom Albers 2006-03-02 09:20:27 UTC
Great! Thanks! Looking forward to the next release.