Bug 95489 - CSS attribute "height" (in body or table) isn't rendered correctly
Summary: CSS attribute "height" (in body or table) isn't rendered correctly
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 3.3.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-19 23:10 UTC by Martin
Modified: 2006-09-02 14:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2004-12-19 23:10:40 UTC
Version:           3.3.2 (using KDE 3.3.2, Gentoo)
Compiler:          gcc version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)
OS:                Linux (i686) release 2.6.9-gentoo-r9

following code

<html>
<body style="height:100%;">
<table style="height:100%;">
...
</table>
</body>
</html>

when using the height-attribute in any html-tag (like body, table, etc.) it seems not to be displayed correctly in konqueror.
Unfortunately I'm not sure if it's only because of the incorrect rendering of the height-attribute in body or if it is a general problem.
w3c states it to be the only correct way of using a height attribute and there is no problem of having it displayed in firefox (1.0)
Comment 1 Allan Sandfeld 2004-12-22 01:38:22 UTC
Any concrete examples of what you consider wrong?
Comment 2 Martin 2004-12-22 10:50:25 UTC
W3C says that a table on a website will cover the whole browser window from top to bottom if the CSS attribute "height:100%;" is used in both <table> and <body> tag. The height of one element on an HTML site is always set relative to the element on a higher level. So if I set a hight of my <body> it should be possible to make my <table> cover any given space in the browser window.
Like:
<body style="height:100%;">
<table style="height:100%;">
..................
</table>
</body>
would mean that my table covers 100% of the window. This should, of course, also work for constructs like
<body style="height:100%;">
<table style="height:300px;">
..................
</table>
</body>
or other height values.

Unfortunately this does not work with Konqueror. It seems to ignore those "height" attributes. Even if I do set a table to use 100% of the window, it will only use the space actually needed and NOT reach from top to bottom.
Comment 3 Allan Sandfeld 2004-12-22 18:32:09 UTC
That doesn't work? In quirk or strict mode?  and have you tried setting the height of the html element to 100%?
Comment 4 Martin 2004-12-22 20:35:14 UTC
height-attribute of table-tag is not w3c conform and was never!! in any w3c-standard. Width and Height of th- and td-tag is deprecated and shouldn't be used in "Transitional 4.01" Standard.
Comment 5 Allan Sandfeld 2005-01-08 13:33:41 UTC
Okay. In konqueror we treat transitional the same as quirk mode.
Comment 6 Lucas 2006-08-31 18:27:21 UTC
I know you should not use height atributes any longer and you should have never used it in a tr-tag, but I did try it, and it works in iexpl, firefox and opera, but not konqueror. In konqueror it only works in the top row, just test the example below, or click here http://lvdp.student.utwente.nl/temp/tabletest.html and you will see what I mean.
not a big problem but a bit strange.

    <table border='0' cellspacing='0' bgcolor='#000000'>
      <tr height='10'>
        <td width='40' bgcolor='#FF0000'>
        </td>
      </tr>
      <tr height='10'>
        <td width='40' bgcolor='#00FF00'>
        </td>
      </tr>
      <tr height='10'>
        <td width='40' bgcolor='#0000FF'>
        </td>
      </tr>
    </table>
Comment 7 Eric Kjeldergaard 2006-08-31 23:25:27 UTC
<html><head><title>test</title></head>
<body style="height: 100%"><table style="border: solid black 1px; height: 100%"><tr><td>a</td></tr></table></body></html>

I created this gorgeous section of html as a concrete example of what he means.  It renders differently in Konqy and Firefox.  I'd have to agree with FF on this one, though I do not profess to recall the W3C's stance on this.
Comment 8 Eric Kjeldergaard 2006-09-01 00:09:36 UTC
Just one more thing ... I modified the page to the following which demonstrates that it's body (and not table) that's acting in a way other-than-expected:  
<html><head><title>test</title></head>
<body style="border: solid red 1px; height: 300px"><table style="border: solid black 1px; height: 100%"><tr><td>a</td></tr></table></body></html>
Comment 9 Allan Sandfeld 2006-09-02 13:27:12 UTC
Test in comment #6 looks fine here.

The issue in comment #8 and #9 is that setting BODY height doesn't affect the height of HTML as it should in quirk mode. 

Setting "html {height: 100%}" is a quirk work around that would make work in strict mode as well.

Comment 10 Allan Sandfeld 2006-09-02 14:31:37 UTC
SVN commit 580037 by carewolf:

Height of body should be based on canvas in quirks mode.
BUG:95489

Also affects quirksmode.org/css/height/minheightbody.html


 M  +8 -1      render_box.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.cpp #580036:580037
@@ -736,7 +736,7 @@
         }
 
         if(!isInline() || isReplaced()) {
-            _xPos += xPos(), 
+            _xPos += xPos(),
             _yPos += yPos();
         }
 
@@ -1105,6 +1105,7 @@
     if (cb->isTableCell() && style()->htmlHacks()) {
         result = static_cast<RenderTableCell*>(cb)->cellPercentageHeight();
     }
+
     // Otherwise we only use our percentage height if our containing block had a specified
     // height.
     else if (cb->style()->height().isFixed())
@@ -1132,6 +1133,12 @@
                               p->borderTop() + p->borderBottom() +
                               p->paddingTop() + p->paddingBottom());
     }
+    else if (cb->isRoot() && style()->htmlHacks() && cb->style()->height().isVariable()) {
+        int visHeight = canvas()->viewportHeight();
+        result = visHeight - (marginTop() + marginBottom() +
+                              borderTop() + borderBottom() +
+                              paddingTop() + paddingBottom());
+    }
     else if (cb->isAnonymousBlock() || treatAsReplaced && style()->htmlHacks()) {
         // IE quirk.
         result = cb->calcPercentageHeight(cb->style()->height(), treatAsReplaced);