Closed Bug 654990 Opened 13 years ago Closed 13 years ago

Don't use SetInitialChildList to specify the style context of the progress bar anonymous child

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla6

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(1 file)

      No description provided.
Boris, I believe I have to pass the style context of the anonymous child to AppendElements in ::CreateAnonymousContent, right? Do I have to resolve the style in ::CreateAnonymousContent?
Yes.  Is that a problem?
Currently, I do that that way:
  nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozProgressBar;
  nsRefPtr<nsStyleContext> newStyleContext;

  nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
  newStyleContext = barFrame->PresContext()->StyleSet()->
    ResolvePseudoElementStyle(mContent->AsElement(), pseudoType,
                              barFrame->GetParent()->GetStyleContext());

When moving this code to ::CreateAnonymousContent I got a crash that let me think barFrame's parent isn't initialized yet. Given that mBarDiv is freshly created, I was wondering if the parent's frame wasn't set later.
In CreateAnonymousContent, mBarDiv->GetPrimaryFrame() is null.

But shouldn't barFrame->GetParent() just be |this| above?
(In reply to comment #4)
> In CreateAnonymousContent, mBarDiv->GetPrimaryFrame() is null.
> 
> But shouldn't barFrame->GetParent() just be |this| above?

Should be, yes. I was just over cautious. Though, how can I do |barFrame->PresContext()->StyleSet()->| now?
|PresContext()->StyleSet()|.  |this| has the same prescontext as barFrame would!
Attached patch Patch v1Splinter Review
r=bz (over IRC)
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
Pushed:
http://hg.mozilla.org/mozilla-central/rev/437f175609b8
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
Backed out in http://hg.mozilla.org/mozilla-central/rev/dd9ba28d2bd9 to resolve bug 655860.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
The regression wasn't caused by these patches. Re-landed:
http://hg.mozilla.org/mozilla-central/rev/8d378453a8ac
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: