Closed Bug 13568 Opened 26 years ago Closed 26 years ago

{css2} not correctly solving for 'margin-top' when container has height:auto

Categories

(Core :: Layout, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: ian, Assigned: troy)

References

()

Details

(Keywords: css2)

When the containing block has height:auto, we are not correctly solving the equality given in CSS2 section 10.6.4 for margin-top. In this example, the relevant properties have been set like this: top: 0; margin-top: auto; border-width-top: 0; padding-top: 0; height: 1em; padding-bottom: 0; border-width-bottom: 0; margin-bottom: 0; bottom: 0; The equality says that all of those should add up to the height of the containing block (distance from top padding edge to bottom padding edge of nearest non position:static ancestor, in this case the parent). Somehow, we do not perform this calculation correctly if the height in question is 'auto'. (The current result is that the block being positioned goes off to Mars somewhere and we don't render it). If the height is explicitly given, or if we are solving for margin-bottom or just bottom instead of margin-top, then it all works. This can also be seen on this test case: http://www.bath.ac.uk/~py8ieh/internet/projects/mozilla/absolute-margin-top.html
See bug 12945, which is also related to problems in section 10.6.4.
Status: NEW → ASSIGNED
Target Milestone: M12
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
It wasn't just that the containing block has height:auto, it's also that it is relatively positioned (not absolutely positioned). That means we can't compute the containing block height in a top-down fashion and we need to use the shrink wrap height based on the content. The spec is kind of vague on whether these things are calculated top-down (as usual for in flow elements, e.g. percentage heights become 'auto' if the parent's height is specified as 'auto') or bottom-up, but your example seems reasonable and should work so I changed the code to use the shrink wrap height in that case
QA Contact: petersen → chrisd
Status: RESOLVED → VERIFIED
Works fine with Viewer on Win32 1999-10-04. Marking verified.
Keywords: css2
Migrating from {css2} to css2 keyword. The {css1}, {css2}, {css3} and {css-moz} radars should now be considered deprecated in favour of keywords. I am *really* sorry about the spam...
You need to log in before you can comment on or make changes to this bug.