Bug 330934. Set a nsIFrame's stylecontext in its constructor, to ensure that there's always one available for GetPresContext() to use even if Init hasn't been called. Patch by Marc Liddell, r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@193022 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2006-03-26 21:30:36 +00:00
parent cbf12a16e3
commit 140fbb3377
228 changed files with 1576 additions and 1768 deletions

View File

@@ -198,9 +198,9 @@ NS_IMPL_ISUPPORTS1(nsComboButtonListener, nsIDOMMouseListener)
nsComboboxControlFrame * nsComboboxControlFrame::mFocused = nsnull;
nsIFrame*
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, PRUint32 aStateFlags)
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aStateFlags)
{
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame;
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame(aContext);
if (it) {
// set the state flags (if any are provided)
@@ -317,8 +317,8 @@ if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \
//-- Done with macros
//------------------------------------------------------
nsComboboxControlFrame::nsComboboxControlFrame()
: nsAreaFrame()
nsComboboxControlFrame::nsComboboxControlFrame(nsStyleContext* aContext)
: nsAreaFrame(aContext)
{
mListControlFrame = nsnull;
mDroppedDown = PR_FALSE;
@@ -1905,12 +1905,12 @@ nsComboboxControlFrame::CreateFrameFor(nsPresContext* aPresContext,
}
// Start by by creating our anonymous block frame
mDisplayFrame = NS_NewBlockFrame(shell, NS_BLOCK_SPACE_MGR);
mDisplayFrame = NS_NewBlockFrame(shell, styleContext, NS_BLOCK_SPACE_MGR);
if (NS_UNLIKELY(!mDisplayFrame)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv = mDisplayFrame->Init(mContent, this, styleContext, nsnull);
nsresult rv = mDisplayFrame->Init(mContent, this, nsnull);
if (NS_FAILED(rv)) {
mDisplayFrame->Destroy(aPresContext);
mDisplayFrame = nsnull;
@@ -1918,13 +1918,13 @@ nsComboboxControlFrame::CreateFrameFor(nsPresContext* aPresContext,
}
// Create a text frame and put it inside the block frame
mTextFrame = NS_NewTextFrame(shell);
mTextFrame = NS_NewTextFrame(shell, textStyleContext);
if (NS_UNLIKELY(!mTextFrame)) {
return NS_ERROR_OUT_OF_MEMORY;
}
// initialize the text frame
rv = mTextFrame->Init(aContent, mDisplayFrame, textStyleContext, nsnull);
rv = mTextFrame->Init(aContent, mDisplayFrame, nsnull);
if (NS_FAILED(rv)) {
mDisplayFrame->Destroy(aPresContext);
mDisplayFrame = nsnull;