Closed Bug 3306 Opened 26 years ago Closed 26 years ago

Absolute positioning is totally hosed

Categories

(Core :: Layout, defect, P2)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: ian, Assigned: troy)

References

()

Details

I'm not really sure *what* you do at the moment, but it sure doesn't follow the spec. See http://www.w3.org/TR/REC-CSS2/visudet.html#abs-non-replaced-width
I hate to tell you this, Ian, but actually, right now, your test is totally hosed. (sorry if that sounds harsh... I'm really tired, and, well, copying the title of the bug) Read section 10.1 of CSS2. NGLayout is right. Your test needs position:relative on DIV class="test" or a change in descriptions (or both, separately). And also, these bugs should probably go to Component: Layout (which goes to troy@netscape.com, who's been working on this stuff.) If you agree with me, resolve the bug as invalid.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → INVALID
Whiteboard: Currently tracking down bug
Once I track down the exact bug, I will update this entry.
Status: RESOLVED → REOPENED
Component: Style System → Layout
Whiteboard: Currently tracking down bug
Resolution: INVALID → ---
Assignee: peterl → troy
Status: REOPENED → NEW
Ok. Layout on this test page *is* hosed, and I have been able (with the help of David...) to track down what the problem is. Basically, you are calculating the value for 'width' (which is set to auto in this example) based on the containing block's width, but you are not correctly finding the containing block. According to CSS2, section 10.1, the containing block of an absolutely positioned element is not from the left content edge to the right content edge, as for elements in normal flow, but it is the distance from the left *padding* edge to the right *padding* edge. (That is, the distance between the vertical borders, excluding the borders themselves.) This is stated in section 10.1, step 4.1, of the CSS2 spec. The URI given above is to a test page that shows two examples where you break down. Basically, you need simply to disregard the padding of the containing block when doing the width calculations for absolutely positioned boxes. [Note. I have changed the component to Layout on David's recommendations.]
To clarify what I think the problem is -- I think you are using the correct containing block for calculating the placement of the element - i.e., its left/top offsets. However, you're using the wrong one (the content edge) for calculating its width (and maybe height), so the right (and bottom?) offsets are too big by the amount padding-right+padding-left of the element of the containing block.
Status: NEW → ASSIGNED
Yes, it's true that currently the containing block width/height is the content area and not the padding area like it should be. I've been meaning to fix that
Status: ASSIGNED → RESOLVED
Closed: 26 years ago26 years ago
Resolution: --- → FIXED
Fixed it so we're using the padding edge and not the content edge for the containing block
Status: RESOLVED → VERIFIED
This particular bug is fixed, other bugs on this page will be filed separately.
You need to log in before you can comment on or make changes to this bug.