Last Comment Bug 654990 - Don't use SetInitialChildList to specify the style context of the progress bar anonymous child
: Don't use SetInitialChildList to specify the style context of the progress ba...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout: Form Controls (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla6
Assigned To: Mounir Lamouri (:mounir)
:
Mentors:
Depends on: 654989
Blocks: 633209
  Show dependency treegraph
 
Reported: 2011-05-05 06:25 PDT by Mounir Lamouri (:mounir)
Modified: 2011-05-10 07:02 PDT (History)
1 user (show)
mounir: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (3.52 KB, patch)
2011-05-09 09:43 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review

Description Mounir Lamouri (:mounir) 2011-05-05 06:25:31 PDT

    
Comment 1 Mounir Lamouri (:mounir) 2011-05-09 07:39:48 PDT
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?
Comment 2 Boris Zbarsky [:bz] 2011-05-09 08:19:45 PDT
Yes.  Is that a problem?
Comment 3 Mounir Lamouri (:mounir) 2011-05-09 08:33:47 PDT
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.
Comment 4 Boris Zbarsky [:bz] 2011-05-09 08:38:13 PDT
In CreateAnonymousContent, mBarDiv->GetPrimaryFrame() is null.

But shouldn't barFrame->GetParent() just be |this| above?
Comment 5 Mounir Lamouri (:mounir) 2011-05-09 08:54:57 PDT
(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?
Comment 6 Boris Zbarsky [:bz] 2011-05-09 09:04:56 PDT
|PresContext()->StyleSet()|.  |this| has the same prescontext as barFrame would!
Comment 7 Mounir Lamouri (:mounir) 2011-05-09 09:43:01 PDT
Created attachment 531068 [details] [diff] [review]
Patch v1

r=bz (over IRC)
Comment 8 Mounir Lamouri (:mounir) 2011-05-09 09:46:02 PDT
Pushed:
http://hg.mozilla.org/mozilla-central/rev/437f175609b8
Comment 9 Shawn Wilsher :sdwilsh 2011-05-09 16:12:43 PDT
Backed out in http://hg.mozilla.org/mozilla-central/rev/dd9ba28d2bd9 to resolve bug 655860.
Comment 10 Mounir Lamouri (:mounir) 2011-05-10 07:02:58 PDT
The regression wasn't caused by these patches. Re-landed:
http://hg.mozilla.org/mozilla-central/rev/8d378453a8ac

Note You need to log in before you can comment on or make changes to this bug.