Closed Bug 266850 Opened 20 years ago Closed 20 years ago

[FIX]Table with position:absolute (and no top/left specified) inside div is positioned incorrectly

Categories

(Core :: Layout: Positioned, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8alpha5

People

(Reporter: uriber, Assigned: bzbarsky)

References

Details

(Keywords: regression, testcase)

Attachments

(4 files, 1 obsolete file)

When a table is contained within a div, the table is absolutely-positioned, and no values are given for "top" or "left", the table is positioned regardless of the position of the containing div. Seeing this on: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8a5) Gecko/20041028 Firefox/0.9.1+ Assuming this is a valid bug, it is a recent regression. The 20041026 Firefox trunk build displayes the table just below the text in the containing div. (there was no 20041027 mac trunk build so I couldn't test it). Originally saw this when investigating bug 266715. Testcase and screenshot coming up.
Attached file testcase
Testcase. In recent nightlies, the table is overlayed on the text (dots) above the div in which it is contained.
Attached image screenshot: 20041028
Screenshot of testcase in: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8a5) Gecko/20041028 Firefox/0.9.1+
Attached image screenshot: 20041026
Screenshot of testcase in: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8a5) Gecko/20041026 Firefox/0.9.1+
Keywords: testcase
OS: MacOS X → All
Hardware: Macintosh → All
Regression window on Linux: 2004102606 -- 2004102705 (bug 263406?)
Component: Layout: Tables → Layout: R & A Pos
QA Contact: core.layout.tables → core.layout.r-and-a-pos
Applying attachment 163244 [details] [diff] [review] to a recent but pre-263406 tree introduces the error.
The problem is that the place holder frame has the wrong parent... Before bug 263406: MATS: CreatePlaceholderFrameFor aFrame=TableOuter(table)(1)@0x84d6460 aParentFrame=Block(div)(7)@0x84d61f8 After bug 263406: MATS: CreatePlaceholderFrameFor aFrame=TableOuter(table)(1)@0x84bae20 aParentFrame=Area(html)(-1)@0x84b9b00
Assignee: nobody → mats.palmgren
Perhaps we need to add an assert to SetInitialChildList() that all the incoming frames have our frame as the parent or something? The issue seems to be that in ConstructTableFrame() we have both aGeometricParent (the area frame in this case) and aContentParent (the div in this case). We use the aGeometricParent to create our pseudoframes as needed (which I guess makes some sense). But we init parentFrame to the geometric parent too. That's the part that's wrong, though I'm not sure what the best fix is. I hate table pseudo-frames. :(
Attached patch Patch rev. 1 (obsolete) — Splinter Review
Oh, and maybe we can make the layout regression tests keep track of parent frames? Or do they already?
Attachment #163996 - Flags: superreview?(bzbarsky)
Attachment #163996 - Flags: review?(bzbarsky)
Mats, I'm not sure that's right. In particular, consider the following situation: <div style="display: table-row"> <div style="display: table"> </div> </div> In this case aContentParent should be the table-row, but the frame we actually want to use as the parent of the placeholder is the cell-inner block inside the anonymous cell...
(In reply to comment #9) > Oh, and maybe we can make the layout regression tests keep track of parent > frames? Or do they already? Are you saying that the layout regression tests is working again? I think this would have been caught anyway since the position is wrong.
(In reply to comment #10) > In this case aContentParent should be the table-row, but the frame we actually > want to use as the parent of the placeholder is the cell-inner block inside the > anonymous cell... OK, I see what you mean...
Attachment #163996 - Attachment is obsolete: true
Attachment #163996 - Flags: superreview?(bzbarsky)
Attachment #163996 - Flags: review?(bzbarsky)
> Are you saying that the layout regression tests is working again? They've been working all along.... Build the layout-debug extension, run "mozilla -layoutdebug", load the .lst file is as the regression test, etc. There are instructions somewhere on Mozilla.org. Note that I did run the regression tests on the patch in bug 263406. I agree that they would have caught this anyway, except they have a _lot_ of false positives and I was looking for frame tree changes (since I was changing frame construction) and just skimming over the layout changes..... so I may well have missed this, since it wasn't flagged as a frame tree change.
I think the right thing to do is to eliminate the aGeometricParent argument altogether. It's only used in one place, and that's the one that's messing up. We recompute the geometric parent inside this method anyway. Patch coming up in a second.
Attached patch Like soSplinter Review
Attachment #163999 - Flags: superreview?(roc)
Attachment #163999 - Flags: review?(mats.palmgren)
(In reply to comment #13) > They've been working all along.... Build the layout-debug extension, run > "mozilla -layoutdebug", load the .lst file is as the regression test, etc. Thanks, I got it running now. > There are instructions somewhere on Mozilla.org. Not really, http://www.mozilla.org/newlayout/regress.html
I thought we had a more up-to-date document, but maybe it was just a newsgroup post David made? David, bernd, do you think it would make sense to keep track of parent frames in the regression tests?
(Made summary more readable).
Summary: table with position:absolute and no top/left specified inside div is positioned incorrectly → Table with position:absolute (and no top/left specified) inside div is positioned incorrectly
Comment on attachment 163999 [details] [diff] [review] Like so Just for fun I ran the regression tests on this patch and it resulted in 42 failed files (not counting false positives). I checked a few manually but saw nothing wrong. Does everyone else also get this many false alarms? The patch looks fine to me.
Attachment #163999 - Flags: review?(mats.palmgren) → review+
(In reply to comment #17) > but maybe it was just a newsgroup post David made? I googled for it but could not find it...
Assignee: mats.palmgren → bzbarsky
> Does everyone else also get this many false alarms? Yes. There are a lot of tests which simply have nondeterministic frame bounding boxes (generally this involves comboboxes). So they flag a bunch of stuff as a failure, and since its nondeterministic only some of them overlap with the baseline.... :(
Summary: Table with position:absolute (and no top/left specified) inside div is positioned incorrectly → [FIX]Table with position:absolute (and no top/left specified) inside div is positioned incorrectly
Target Milestone: --- → mozilla1.8alpha5
Attachment #163999 - Flags: superreview?(roc) → superreview+
Fixed
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Blocks: 267978
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: