Bug 172525 - iframe does not respect container height in strict and transitional doctypes
Summary: iframe does not respect container height in strict and transitional doctypes
Status: RESOLVED NOT A BUG
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 3.5
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-10 17:39 UTC by Martin van Es
Modified: 2012-01-13 06:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin van Es 2008-10-10 17:39:13 UTC
Version:           3.5.10 (using 3.5.10, Kubuntu (hardy) 4:3.5.10-0ubuntu1~hardy1)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.27

An iframe in Konqueror does not respect the container's height when set to 100% in transitional and strict doctype. It seems to choose the enclosing total body's height instead.

The following html demonstrates the bug:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html style='height: 100%; margin: 0; padding: 0;'>
<body style='height: 100%; margin: 0; padding: 0;'>

<table style='height: 100%; width: 100%; margin: 0; padding: 0; border-collapse: collapse;'>
  <tr>
    <td style='background: #d0d0d0; height: 80px;'>
    test
    </td>
  </tr>
  <tr>
    <td style='background: #f0f0f0; height: 100%;'>
    <iframe src='iframe.html' style='width: 100%; height: 100%; margin: 0; padding: 0; border: 0;'>No frames</iframe>
    </td>
  </tr>
</table>
</body>
</html>

iframe.html:
<html>
<body>
<h1>Test</h1>
</body>
</html>

The page is rendered with a vertical scroll-bar that travels exactly the height of the first tablerow (80px in this case). The expected behaviour is for the iframe to fill the rest of the page (100%-80px), which is what happens without the iframe and when the doctype is removed (thus falling back into quirks).

The background color of the table cells is added for clarity while rendering.

Firefox renders this page as expected, both with and without doctype set.
Comment 1 Gérard Talbot (no longer involved) 2011-06-25 21:26:16 UTC
Martin van Es,

1- Can you attach a reduced, minimized testcase?

"Throw out anything that has nothing to do with the bug (...)
The important part is: the page should be as short as possible to be able to still reproduce the bug."
http://www.konqueror.org/investigatebug/#html

Since your code involves the deprecated iframe element, please use this doctype declaration

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">

2- Can you specify in a formal manner what is the expected result, the actual result, the browser details (Firefox version, Konqueror version, platform, os, rendering modes, doctype declarations, etc.) which are relevant to your bug report.

3- As far as I can see, you code creates a constraining and constrained design (height: 100% is declared, including for a single table cell) where a vertical scrollbar should be generated to render both rows.

4- Please explain why border-collapse is declared or required or needed in your code 

5- Note that all browsers have a default padding for table cells: Konqueror as well as Firefox (all versions). On the other hand, html, body, table elements have a default padding of 0.

6- iframe is an inline replaced element without an intrinsic ratio. There are rules that apply in such cases (§ 10.3.2, § 10.6.2).

Gérard
Comment 2 Gérard Talbot (no longer involved) 2011-09-25 00:31:48 UTC
Martin van Es,

I have good news regarding this bug report.

> 1- Can you attach a reduced, minimized testcase?

2 reduced testcases:

Iframe element
http://www.gtalbot.org/BrowserBugsSection/Konqueror4Bugs/Bug172525-iframe-height.html
(rendered in Almost standards rendering mode)

Embedded HTML document with the HTML4 <object> element
http://www.gtalbot.org/BrowserBugsSection/Konqueror4Bugs/Bug172525-object-height.html
(rendered in web standards compliant rendering mode)

> 2- Can you specify in a formal manner what is the expected result, the actual
> result, the browser details (Firefox version, Konqueror version, platform, os,
> rendering modes, doctype declarations, etc.) which are relevant to your bug
> report.

I re-read the bug report and expected results would be to *not* have, not see a vertical scrollbar in the webpage.


> 3- As far as I can see, you code creates a constraining and constrained design
> (height: 100% is declared, including for a single table cell) where a vertical
> scrollbar should be generated to render both rows.

The important, decisive information is given in CSS 2.1 spec, section 17.5.3 Table height algorithms which says

  "
  CSS 2.1 does not define how the height of table cells and table rows is 
  calculated when their height is specified using percentage values.  
  "
http://www.w3.org/TR/CSS21/tables.html#height-layout

And this is exactly what happens too in all tested browsers.

Firefox 6.0.2, Chrome 14.0.835.186 and Safari 5.1 do not render a vertical scrollbar in the 2 testcases.

Konqueror 4.7.0, Opera 11.51 and Internet Explorer 8 render a vertical scrollbar in the 2 testcases, which allows to scroll the additional 80px of document box height.

There is no right or wrong rendering in such testcases actually.

I am using
KDE Platform Version: 4.7.0
Konqueror version: 4.7.0 (KHTML rendering engine)
Qt Version: 4.7.2
Operating System: Linux 2.6.38-11-generic-pae i686 (32bits)
Distribution: Kubuntu 11.04
here.

> 4- Please explain why border-collapse is declared or required or needed in 
> your code 

In border-collapse: separate, browsers all render a default border-spacing of 2px (horizontal and vertical). One way that very often people neutralize, zero such border-spacing between table cells is to set 'border-collapse: collapse'. A lot of people do that to neutralize small vertical and horizontal gaps which they may not understand the origin. So, even though there is no border around any part of the table, the side effects of 'border-collapse: collapse' work.

 
> 5- Note that all browsers have a default padding for table cells: Konqueror as
> well as Firefox (all versions). On the other hand, html, body, table elements
> have a default padding of 0.

In the 2 provided testcases, this has been done.

----------

So, to sum up all this, this bug report in my opinion should be resolved as INVALID. The rendered layout in Konqueror 4.7.0 is compliant with the CSS 2.1 spec.

regards, Gérard
Comment 3 Gérard Talbot (no longer involved) 2012-01-13 06:44:18 UTC
Resolving as INVALID