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

RESOLVED FIXED in mozilla6

Status

()

Core
Layout: Form Controls
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mounir, Assigned: mounir)

Tracking

Trunk
mozilla6
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Comment hidden (empty)
(Assignee)

Comment 1

6 years ago
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?
(Assignee)

Comment 3

6 years ago
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?
(Assignee)

Comment 5

6 years ago
(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!
(Assignee)

Comment 7

6 years ago
Created attachment 531068 [details] [diff] [review]
Patch v1

r=bz (over IRC)
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
(Assignee)

Comment 8

6 years ago
Pushed:
http://hg.mozilla.org/mozilla-central/rev/437f175609b8
Status: ASSIGNED → RESOLVED
Last Resolved: 6 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 → ---
(Assignee)

Comment 10

6 years ago
The regression wasn't caused by these patches. Re-landed:
http://hg.mozilla.org/mozilla-central/rev/8d378453a8ac
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.