Closed Bug 386014 Opened 17 years ago Closed 17 years ago

[FIXr]"ASSERTION: Should have found a parent before this" with a position:fixed table and captions

Categories

(Core :: Layout: Tables, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9beta1

People

(Reporter: jruderman, Assigned: bzbarsky)

References

Details

(Keywords: assertion, testcase)

Attachments

(2 files)

###!!! ASSERTION: Should have found a parent before this: 'aProspectiveParent->GetStyleContext()->GetPseudoType() == nsCSSAnonBoxes::viewportScroll', mozilla/layout/generic/nsFrame.cpp, line 5540 This assertion also showed up in bug 378240, which is now fixed.
Attached file testcase
So... is it me, or is dynamically inserting a caption into a table generally broken on trunk? In any case, this assert is firing for a good reason: we're using the wrong style context parent for the caption here.
Looks like dynamic caption insertion in this case got broken by bug 309322. But on trunk only, not branch...
Oh, it hasn't landed on branch...
I filed bug 389924 on that issue.
Attached patch Proposed fixSplinter Review
The idea here is to make ContentInserted more like ContentAppended and the codepath which constructs a table frame and then its kids. For both ContentAppended and that codepath, the parent used for ConstructFrame() when doing the caption is the _inner_ table frame (for ContentAppended() because GetFrameFor() gets the content insertion frame). The caption construction code adjusts this as needed later. Blow by blow: Hunk 1: Remove code that's no longer needed because we never pass outer tables to AdjustParentFrame. Fix some indentation. Hunk 2: Replace the code that finally gets the right parent for the caption by a function that does exactly what this code is doing. Hunk 3: Remove code that's no longer needed because we never pass outer tables to GetAdjustedParentFrame. Hunk 4: Comment change Hunk 5: Remove code that is not needed because AdjustParentFrame handles that situation (and better, since it checks for special kids). Hunk 6: First part that's needed to actually fix this bug: when getting a parent based on prev or next sibling, get that parent's content insertion frame. This makes our prospective parent the same as other codepaths. Hunk 7: Same as hunk 5. Hunk 8: Adjust check for valid prevSibling a little, since now parentFrame may not actually be prevSibling->GetParent() Hunk 9: Same as hunk 8, for captions. The rest is tests. Test 1a (the situation in this testcase) fails without this patch, because the background is not actually inherited from the right place.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #274254 - Flags: superreview?(roc)
Attachment #274254 - Flags: review?(bernd_mozilla)
Flags: in-testsuite?
OS: Mac OS X → All
Priority: -- → P1
Hardware: PC → All
Summary: "ASSERTION: Should have found a parent before this" with a position:fixed table and captions → [FIX]"ASSERTION: Should have found a parent before this" with a position:fixed table and captions
Target Milestone: --- → mozilla1.9beta2
Attachment #274254 - Flags: review?(bernd_mozilla) → review+
Attachment #274254 - Flags: superreview?(roc) → superreview+
Summary: [FIX]"ASSERTION: Should have found a parent before this" with a position:fixed table and captions → [FIXr]"ASSERTION: Should have found a parent before this" with a position:fixed table and captions
Comment on attachment 274254 [details] [diff] [review] Proposed fix Fix incorrect style context parenting for captions when using ContentInserted. Mostly removes redundant code, actually, and makes this codepath act like our other (more commonly used) codepaths for captions. Risk is low.
Attachment #274254 - Flags: approval1.9?
Comment on attachment 274254 [details] [diff] [review] Proposed fix a19=dbaron
Attachment #274254 - Flags: approval1.9? → approval1.9+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Depends on: 390976
Depends on: 482398
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: