Closed Bug 217225 Opened 21 years ago Closed 21 years ago

[FIX]"Wrong parent style context"

Categories

(Core :: CSS Parsing and Computation, defect, P3)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.6beta

People

(Reporter: Biesinger, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

frame: Text(0) (0x88c0000) style: 0x88bffd4 :-moz-non-element {}
Wrong parent style context:  style: 0x88bfd20 {}
should be using:  style: 0x88bff2c :-moz-button-content {}

I'll attach the document that leads to the above warning
Is this the minimal testcase that produces this bug?

Chances are, ReParentStyleContext is having issues here....
The basic problem is that ReParentStyleContext verifies the style tree both
before and after changing the frame's style context.  Now the code in
nsHTMLButtonControlFrame::SetInitialChildList first sets the new parent on the
child frame, then calls ReParentStyleContext.  So the verification before
reparenting fails, since the frame's parent's style context is not in fact the
parent of the frame's style context (since the parent has already been changed).
 If I move the SetParent() call to after ReParentStyleContext, then the check
_after_ the reparenting fails, since the style context now has the new parent's
style context as a parent, but the new parent has not been set on the frame yet.

On the other hand, VerifyStyleTree (in nsFrameManager.cpp) has a slight problem
-- it never uses aParentContext.  Passing that as the last arg to that first
VerifyContextParent call makes all the warnings go away _if_ I reparent before
calling SetParent (since the check after reparenting passes a non-null
aParentContext to VerifyStyleTree).

So what I think we should do is:

1)  Change VerifyStyleTree to pass through aParentStyleContext to
    VerifyContextParent
2a) Document that the frame's position in the frame tree should be changed
    _after_ reparenting its style context.
or
2b) Skip the integrity check at the beginning of ReParentStyleContext.
Blocks: 224867, 224870
Attached patch Proposed patchSplinter Review
Attachment #134948 - Flags: superreview?(dbaron)
Attachment #134948 - Flags: review?(dbaron)
Taking
Assignee: dbaron → bz-vacation
Priority: -- → P3
Summary: "Wrong parent style context" → [FIX]"Wrong parent style context"
Target Milestone: --- → mozilla1.6beta
Comment on attachment 134948 [details] [diff] [review]
Proposed patch

r+sr=dbaron if you run the first-letter and perhaps first-line tests in the
CSS1 test suite (and maybe others).
Attachment #134948 - Flags: superreview?(dbaron)
Attachment #134948 - Flags: superreview+
Attachment #134948 - Flags: review?(dbaron)
Attachment #134948 - Flags: review+
Ran such tests, and the results were good (nothing broken).  Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
*** Bug 133785 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: