Bug 100850 - [testcase] wrong width using position: absolute
Summary: [testcase] wrong width using position: absolute
Status: CONFIRMED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml renderer (show other bugs)
Version: 4.5.4
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-04 23:41 UTC by Manafta
Modified: 2021-03-21 00:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test case (602 bytes, text/html)
2005-03-04 23:42 UTC, Manafta
Details
Test case 2 (417 bytes, text/html)
2005-03-05 16:06 UTC, Manafta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manafta 2005-03-04 23:41:32 UTC
Version:           3.2.2 (using KDE 3.2.3,  (testing/unstable))
Compiler:          gcc version 3.3.4 (Debian 1:3.3.4-5ubuntu2)
OS:                Linux (i686) release 2.6.8.1-3-686-smp

If I have a container div - with position: absolute and no width - and put a div - with a relative width - inside it, the displayed width of all elements is incorrect.
Comment 1 Manafta 2005-03-04 23:42:25 UTC
Created attachment 9972 [details]
Test case
Comment 2 Thiago Macieira 2005-03-05 03:13:03 UTC
By comparing the rendering Firefox and Konqueror gave me, I believe Konqueror is correct and Firefox isn't.

A div with no width (width: auto) means it'll have the size of its child objects. 40% of undefined is still undefined. That could be wrong, though.

Firefox, on the other hand, rendered the container div with 100% width, but the contained ones - 40% and 50% - were far from that.
Comment 3 Manafta 2005-03-05 16:05:53 UTC
In Internet Explorer, Opera and Firefox the container width is 100%. In Firefox the child objects take the width of the text because of float and the fact that the text is less than 40% wide. This is could be incorrect behaviour. I don't know.

But in Konqueror, block 1 (40%) is narrower than the width of the text inside and block 2 (50%) is wider than the width of the text inside. So the container has not the full width of its child objects, but some other value. It appears that the container is 40% of the page width. This would mean that the container inherits the relative width of its first child object. If this is the case, that doesn't seem logic to me.

If the container has a single child object Firefox and Konqueror behave the same. They take the width of the child object.

The bug might be caused by the use of float. If I use float: right for the child object, the container should be 100% (I think). This doesn't happen in Konqueror.

See test case 2.
Comment 4 Manafta 2005-03-05 16:06:49 UTC
Created attachment 9986 [details]
Test case 2
Comment 5 Germain Garand 2005-11-04 12:25:40 UTC
absolutely positioned objects with 'auto' value for left, right and width has a shrink-to-fit width (as specified by CSS 2.1 10.3.7), so our rendering is correct.

As your inner objects are percentage-sized and thus refers to the width of the containing block which itself is auto, the resulting layout is just undefined in CSS 2.1. Sometimes our fallback layout will match one browser or the other, sometimes it won't. Here, we calculate the maximum width of all child objects and make that the width of the container (shrink-to-fit), then divide this width in 40 and 50 percent shares. This is a very reasonable fallback...

Your test case 2 is interesting though. The two blocks should definetly be identical.
Comment 6 Allan Sandfeld 2006-05-19 22:14:06 UTC
Is there any defacto fail back here? 
Does MSIE and Firefox do the same?
Comment 7 Samuel Brack 2011-01-05 00:13:36 UTC
The containers in Testcase 2 are still not identical, updating version.
Comment 8 Justin Zobel 2021-03-21 00:24:49 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 10 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.