Closed Bug 320865 Opened 14 years ago Closed 11 years ago

absolute positioning doesn't work when root is display:table


(Core :: Layout: Positioned, defect)

Not set





(Reporter: dbaron, Unassigned)



This is spun off of bug 231776.  Absolute positioning doesn't work correctly when the root element is display:table.  (It looks like what the current code does is either treat the element as non-positioned, although it might not create frames for it at all.)

Testcases need to be written, but I'm filing this so we can close out bug 231776, which is fixed based on the original description (crash).

------- Comment #1 From David Baron 2004-01-21 22:13 PST [reply] -------

In the doc element table frame codepath, we're not setting the absolute and fix
containing blocks in the frame constructor state, so the frame is ending up with
a null parent when it shouldn't.

------- Comment #2 From David Baron 2004-01-21 22:31 PST [reply] -------

We should really be creating a wrapper around the root element anyway (to
represent the initial containing block as described in CSS).  This isn't too
hard to fix, but I want to land bug 231787 first.  (That's what happens when you
make me look at this code.)

Blocks: 340946
David: Does your comment mean we should in the table case create

NS_NewDocumentElementFrame(mPresShell, styleContext); 

and put inside it the table frame so that the area frames becomes root?

Fixed by checkin for bug 243519. We still don't support position:relative tables being abs-pos containers, though.
Closed: 11 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Does Firefox still not support relative positioning for display: table or display: table-cell? I have a test case that is failing in Firefox, but is pretty much supported in all other current browsers (IE9 partially supports it):

If I'm using display: table-cell for layout reasons on a div and that div has a child that needs absolute positioning, it's height and width is not relative to its parent, which is position: relative.

Here's a JSFiddle for a demo:

I'd love for this to be consistent across all browsers.
You need to log in before you can comment on or make changes to this bug.